Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📦 Publish this project to PYPI #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# create by https://github.com/iamcco/coc-gitignore (Tue Apr 09 2024 15:59:42 GMT+0800 (China Standard Time))
# Python.gitignore:
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ A improved supermario game based on https://github.com/justinmeister/Mario-Level
* Python-Pygame 1.9

# How To Start Game
$ python main.py
$ python -m super_mario
# or
$ pip install super-mario-game
$ super-mario

# How to Play
* use LEFT/RIGHT/DOWN key to control player
Expand Down
6 changes: 0 additions & 6 deletions main.py

This file was deleted.

55 changes: 55 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
[project]
name = "super-mario-game"
version = "0.0.1"
description = "a simple SuperMario game"
readme = "README.md"
requires-python = ">= 3.7"
keywords = ["pygame"]
dependencies = ["pygame >= 1.9"]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Topic :: Software Development :: Build Tools",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: Unix",
"Operating System :: MacOS",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]

[[project.authors]]
name = "marblexu"
email = "[email protected]"

[project.license]
text = "MIT"

[project.urls]
Homepage = "https://github.com/marblexu/PythonSuperMario"
Download = "https://github.com/marblexu/PythonSuperMario/releases"
"Bug Report" = "https://github.com/marblexu/PythonSuperMario/issues"
Source = "https://github.com/marblexu/PythonSuperMario"

[project.scripts]
super-mario = "super_mario.__main__:main"

[tool.setuptools.packages.find]
include = ["super_mario*"]

[tool.setuptools.package-data]
super_mario = ["data/**", "resources/**"]
File renamed without changes.
4 changes: 4 additions & 0 deletions source/main.py → super_mario/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ def main():
c.TIME_OUT: load_screen.TimeOut()}
game.setup_states(state_dict, c.MAIN_MENU)
game.main()


if __name__ == '__main__':
main()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def restart(self):

def load_data(self):
player_file = str(self.player_name) + '.json'
file_path = os.path.join('source', 'data', 'player', player_file)
file_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'data', 'player', player_file)
f = open(file_path)
self.player_data = json.load(f)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion source/setup.py → super_mario/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
SCREEN = pg.display.set_mode(c.SCREEN_SIZE)
SCREEN_RECT = SCREEN.get_rect()

GFX = tools.load_all_gfx(os.path.join("resources","graphics"))
GFX = tools.load_all_gfx(os.path.join(os.path.dirname(__file__), "resources","graphics"))
File renamed without changes.
2 changes: 1 addition & 1 deletion source/states/level.py → super_mario/states/level.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def startup(self, current_time, persist):

def load_map(self):
map_file = 'level_' + str(self.game_info[c.LEVEL_NUM]) + '.json'
file_path = os.path.join('source', 'data', 'maps', map_file)
file_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'data', 'maps', map_file)
f = open(file_path)
self.map_data = json.load(f)
f.close()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.