From 6bf781e6d10f12fd9898e6c16f722e66f4558e2f Mon Sep 17 00:00:00 2001 From: Nicolas Braud-Santoni Date: Sat, 30 Mar 2019 13:58:38 +0100 Subject: [PATCH 1/8] setup.py: Extract dependencies to a requirements.txt file --- requirements.txt | 3 +++ setup.py | 9 ++++----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..0424c85e --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +pygame +ppb-vector +dataclasses; python_version < "3.7" diff --git a/setup.py b/setup.py index 7d3052fb..86c97b8c 100644 --- a/setup.py +++ b/setup.py @@ -5,16 +5,15 @@ def readme(): with open('README.md') as file: return file.read() +def requirements(): + with open('requirements.txt') as file: + return [line.strip() for line in file] setup( name='ppb', version='0.5.0', packages=['ppb', 'ppb.systems'], - install_requires=[ - 'pygame', - 'ppb-vector', - 'dataclasses; python_version < "3.7"' - ], + install_requires=requirements(), python_requires=">=3.6", url='https://github.com/ppb/pursuedpybear', license='Artistic-2.0', From 604698ff1b8da889e194cdf23fc02163e5cfdd68 Mon Sep 17 00:00:00 2001 From: Nicolas Braud-Santoni Date: Mon, 1 Apr 2019 16:31:33 +0200 Subject: [PATCH 2/8] setup.py: Add test dependencies in external file Closes #222 --- .travis.yml | 2 +- appveyor.yml | 2 +- requirements-tests.txt | 1 + setup.py | 10 ++++++++-- 4 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 requirements-tests.txt diff --git a/.travis.yml b/.travis.yml index c95cf670..f2f7ceb4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ before_install: install: - pip install -e .; - - pip install pytest; + - pip install -r requirements-tests.txt; script: - pytest diff --git a/appveyor.yml b/appveyor.yml index 0b3b88fe..8af33a03 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,7 +9,7 @@ environment: install: - '%PYTHON%\Scripts\pip install -e .' - - '%PYTHON%\Scripts\pip install pytest' + - '%PYTHON%\Scripts\pip install -r requirements-tests.txt' build: off test_script: - '%PYTHON%\Scripts\pytest' diff --git a/requirements-tests.txt b/requirements-tests.txt new file mode 100644 index 00000000..e079f8a6 --- /dev/null +++ b/requirements-tests.txt @@ -0,0 +1 @@ +pytest diff --git a/setup.py b/setup.py index 86c97b8c..56d0bfca 100644 --- a/setup.py +++ b/setup.py @@ -5,8 +5,13 @@ def readme(): with open('README.md') as file: return file.read() -def requirements(): - with open('requirements.txt') as file: +def requirements(section=None): + if section is None: + filename = "requirements.txt" + else: + filename = f"requirements-{section}.txt" + + with open(filename) as file: return [line.strip() for line in file] setup( @@ -14,6 +19,7 @@ def requirements(): version='0.5.0', packages=['ppb', 'ppb.systems'], install_requires=requirements(), + tests_require=requirements('tests'), python_requires=">=3.6", url='https://github.com/ppb/pursuedpybear', license='Artistic-2.0', From 1dd2b31f6c3be824abadb49a2d6c435f83265fb4 Mon Sep 17 00:00:00 2001 From: Nicolas Braud-Santoni Date: Mon, 1 Apr 2019 23:15:24 +0200 Subject: [PATCH 3/8] setup.py: Integrate with pytest See pytest's documented best practices: https://docs.pytest.org/en/latest/goodpractices.html#integrating-with-setuptools-python-setup-py-test-pytest-runner --- setup.cfg | 2 ++ setup.py | 1 + 2 files changed, 3 insertions(+) create mode 100644 setup.cfg diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..31ad82b6 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[aliases] +test = pytest diff --git a/setup.py b/setup.py index 56d0bfca..1c990658 100644 --- a/setup.py +++ b/setup.py @@ -19,6 +19,7 @@ def requirements(section=None): version='0.5.0', packages=['ppb', 'ppb.systems'], install_requires=requirements(), + setup_requires=['pytest-runner'], tests_require=requirements('tests'), python_requires=">=3.6", url='https://github.com/ppb/pursuedpybear', From 6eb410b7d665c263e2f5b67dfbfd4b1d8dffed4e Mon Sep 17 00:00:00 2001 From: Nicolas Braud-Santoni Date: Mon, 1 Apr 2019 23:31:09 +0200 Subject: [PATCH 4/8] setup.py: Move all configuration to setup.cfg --- setup.cfg | 30 ++++++++++++++++++++++++++++++ setup.py | 29 +++-------------------------- 2 files changed, 33 insertions(+), 26 deletions(-) diff --git a/setup.cfg b/setup.cfg index 31ad82b6..514d5a8c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,32 @@ [aliases] test = pytest + +[metadata] +name = ppb +version = 0.5.0 +author = Piper Thunstrom +author_email = pathunstrom@gmail.com +description = An Event Driven Python Game Engine +long_description = file: README.md +long_description_content_type = text/markdown +url = https://github.com/ppb/pursuedpybear +license = Artistic-2.0 +classifiers = + Development Status :: 4 - Beta + Intended Audience :: Education + Intended Audience :: Developers + License :: OSI Approved :: Artistic License + Natural Language :: English + Programming Language :: Python :: 3.7 + Topic :: Games/Entertainment + Topic :: Software Development :: Libraries + +[options] +packages = + ppb + ppb.systems + +setup_requires = + pytest-runner + +python_requires = >= 3.6 diff --git a/setup.py b/setup.py index 1c990658..5c15ec1e 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,8 @@ from setuptools import setup -def readme(): - with open('README.md') as file: - return file.read() - def requirements(section=None): + """Helper for loading dependencies from requirements files.""" if section is None: filename = "requirements.txt" else: @@ -14,29 +11,9 @@ def requirements(section=None): with open(filename) as file: return [line.strip() for line in file] + +# See setup.cfg for the actual configuration. setup( - name='ppb', - version='0.5.0', - packages=['ppb', 'ppb.systems'], install_requires=requirements(), - setup_requires=['pytest-runner'], tests_require=requirements('tests'), - python_requires=">=3.6", - url='https://github.com/ppb/pursuedpybear', - license='Artistic-2.0', - author='Piper Thunstrom', - author_email='pathunstrom@gmail.com', - description='An Event Driven Python Game Engine', - long_description=readme(), - long_description_content_type="text/markdown", - classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Education", - "Intended Audience :: Developers", - "License :: OSI Approved :: Artistic License", - "Natural Language :: English", - "Programming Language :: Python :: 3.7", - "Topic :: Games/Entertainment", - "Topic :: Software Development :: Libraries", - ] ) From 039176c3979cbf2f93d1a7c1608c85b7e40fceb5 Mon Sep 17 00:00:00 2001 From: Nicolas Braud-Santoni Date: Mon, 1 Apr 2019 23:31:46 +0200 Subject: [PATCH 5/8] setup.py: Add shebang, make executable --- setup.py | 1 + 1 file changed, 1 insertion(+) mode change 100644 => 100755 setup.py diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 index 5c15ec1e..ce402e03 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 from setuptools import setup From 59529c4c3641945bde5d9c0c052eea4c9b36f904 Mon Sep 17 00:00:00 2001 From: Nicolas Braud-Santoni Date: Mon, 1 Apr 2019 23:35:28 +0200 Subject: [PATCH 6/8] setup.cfg: Add selectors for supported Python version (3.6) Done on the basis of what's tested in CI. --- setup.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.cfg b/setup.cfg index 514d5a8c..c61cc90f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,6 +17,8 @@ classifiers = Intended Audience :: Developers License :: OSI Approved :: Artistic License Natural Language :: English + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Topic :: Games/Entertainment Topic :: Software Development :: Libraries From 883c65c819ab19b7f5d1305388cbfd1db6437934 Mon Sep 17 00:00:00 2001 From: Nicolas Braud-Santoni Date: Mon, 1 Apr 2019 23:36:03 +0200 Subject: [PATCH 7/8] setup.cfg: Mark as OS-independent --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index c61cc90f..8c56440c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -22,6 +22,7 @@ classifiers = Programming Language :: Python :: 3.7 Topic :: Games/Entertainment Topic :: Software Development :: Libraries + Operating System :: OS Independent [options] packages = From 09998e9faa48d41b0271147b51a7349173118c07 Mon Sep 17 00:00:00 2001 From: Nicolas Braud-Santoni Date: Mon, 1 Apr 2019 23:43:38 +0200 Subject: [PATCH 8/8] Add PEP 518 pyproject.toml This tells packaging tools, such as pip, that we use setuptools. --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..019b0d84 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +# Minimum requirements for the build system to execute. +requires = ["setuptools", "wheel"] # PEP 508 specifications.