From 9089b881671d3dfa2f90214847697e997a8957eb Mon Sep 17 00:00:00 2001 From: Lennart Regebro Date: Sat, 26 Mar 2022 14:30:20 +0100 Subject: [PATCH] Modernize pyroma setup (#72) * Move to setup.cfg and a pyproject.toml for black * Add pre-commit hook * Make the generated code in classifiers.py friendly to black --- .github/workflows/test.yml | 2 +- .pre-commit-config.yaml | 19 ++++ MANIFEST.in | 1 + fetch_classifiers.py | 11 ++- pyproject.toml | 3 + pyroma/classifiers.py | 189 ++++++++++++++++++------------------- setup.cfg | 63 ++++++++++++- setup.py | 45 +-------- 8 files changed, 189 insertions(+), 144 deletions(-) create mode 100644 .pre-commit-config.yaml create mode 100644 pyproject.toml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 160152e..fd46c43 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.6', '3.10', 'pypy-3.7'] + python-version: ['3.7', '3.10', 'pypy-3.7'] steps: - name: Checkout diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..e696212 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,19 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.1.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace +- repo: https://github.com/psf/black + rev: 22.1.0 + hooks: + - id: black +- repo: https://github.com/pycqa/flake8 + rev: 4.0.1 + hooks: + - id: flake8 +- repo: https://github.com/regebro/pyroma + rev: '3.2' + hooks: + - id: pyroma diff --git a/MANIFEST.in b/MANIFEST.in index 60dd469..0ef3790 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -5,3 +5,4 @@ graft pyroma/testdata/distributions include tox.ini include DEVELOPMENT.rst include Makefile +exclude .pre-commit-config.yaml diff --git a/fetch_classifiers.py b/fetch_classifiers.py index 3b72ba9..dfcb510 100644 --- a/fetch_classifiers.py +++ b/fetch_classifiers.py @@ -50,9 +50,14 @@ def update_classifiers(): out.write(b"""CODE_LICENSES = {\n""") for code, licenses in code_map.items(): - out.write(b' "%s": {\n "' % code) - out.write(b'",\n "'.join(licenses)) - out.write(b'"},\n') + out.write(b' "%s": {' % code) + if len(licenses) > 1: + out.write(b'\n "') + out.write(b'",\n "'.join(licenses)) + out.write(b'",\n },\n') + else: + out.write(b'"%s' % list(licenses)[0]) + out.write(b'"},\n') out.write(b"""}\n""") diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..46934ef --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[tool.black] +line-length = 120 + diff --git a/pyroma/classifiers.py b/pyroma/classifiers.py index bb2f2e1..ffa7218 100644 --- a/pyroma/classifiers.py +++ b/pyroma/classifiers.py @@ -41,6 +41,9 @@ "Environment :: GPU :: NVIDIA CUDA :: 11.0", "Environment :: GPU :: NVIDIA CUDA :: 11.1", "Environment :: GPU :: NVIDIA CUDA :: 11.2", + "Environment :: GPU :: NVIDIA CUDA :: 11.3", + "Environment :: GPU :: NVIDIA CUDA :: 11.4", + "Environment :: GPU :: NVIDIA CUDA :: 11.5", "Environment :: Handhelds/PDA's", "Environment :: MacOS X", "Environment :: MacOS X :: Aqua", @@ -64,6 +67,9 @@ "Framework :: AWS CDK :: 1", "Framework :: AiiDA", "Framework :: Ansible", + "Framework :: AnyIO", + "Framework :: Apache Airflow", + "Framework :: Apache Airflow :: Provider", "Framework :: AsyncIO", "Framework :: BEAT", "Framework :: BFG", @@ -74,11 +80,14 @@ "Framework :: Buildout :: Recipe", "Framework :: CastleCMS", "Framework :: CastleCMS :: Theme", + "Framework :: Celery", "Framework :: Chandler", "Framework :: CherryPy", "Framework :: CubicWeb", "Framework :: Dash", + "Framework :: Datasette", "Framework :: Django", + "Framework :: Django :: 1", "Framework :: Django :: 1.4", "Framework :: Django :: 1.5", "Framework :: Django :: 1.6", @@ -87,30 +96,54 @@ "Framework :: Django :: 1.9", "Framework :: Django :: 1.10", "Framework :: Django :: 1.11", + "Framework :: Django :: 2", "Framework :: Django :: 2.0", "Framework :: Django :: 2.1", "Framework :: Django :: 2.2", + "Framework :: Django :: 3", "Framework :: Django :: 3.0", "Framework :: Django :: 3.1", "Framework :: Django :: 3.2", + "Framework :: Django :: 4", + "Framework :: Django :: 4.0", "Framework :: Django CMS", "Framework :: Django CMS :: 3.4", "Framework :: Django CMS :: 3.5", "Framework :: Django CMS :: 3.6", "Framework :: Django CMS :: 3.7", "Framework :: Django CMS :: 3.8", + "Framework :: Django CMS :: 3.9", + "Framework :: Django CMS :: 3.10", + "Framework :: FastAPI", "Framework :: Flake8", "Framework :: Flask", "Framework :: Hypothesis", "Framework :: IDLE", "Framework :: IPython", "Framework :: Jupyter", + "Framework :: Jupyter :: JupyterLab", + "Framework :: Jupyter :: JupyterLab :: 1", + "Framework :: Jupyter :: JupyterLab :: 2", + "Framework :: Jupyter :: JupyterLab :: 3", + "Framework :: Jupyter :: JupyterLab :: 4", + "Framework :: Jupyter :: JupyterLab :: Extensions", + "Framework :: Jupyter :: JupyterLab :: Extensions :: Mime Renderers", + "Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt", + "Framework :: Jupyter :: JupyterLab :: Extensions :: Themes", "Framework :: Kedro", "Framework :: Lektor", "Framework :: Masonite", "Framework :: Matplotlib", "Framework :: Nengo", "Framework :: Odoo", + "Framework :: Odoo :: 8.0", + "Framework :: Odoo :: 9.0", + "Framework :: Odoo :: 10.0", + "Framework :: Odoo :: 11.0", + "Framework :: Odoo :: 12.0", + "Framework :: Odoo :: 13.0", + "Framework :: Odoo :: 14.0", + "Framework :: Odoo :: 15.0", "Framework :: Opps", "Framework :: Paste", "Framework :: Pelican", @@ -161,6 +194,8 @@ "Framework :: Zope :: 3", "Framework :: Zope :: 4", "Framework :: Zope :: 5", + "Framework :: aiohttp", + "Framework :: cocotb", "Framework :: napari", "Framework :: tox", "Intended Audience :: Customer Service", @@ -372,6 +407,7 @@ "Programming Language :: C++", "Programming Language :: Cold Fusion", "Programming Language :: Cython", + "Programming Language :: D", "Programming Language :: Delphi/Kylix", "Programming Language :: Dylan", "Programming Language :: Eiffel", @@ -424,6 +460,7 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: Implementation", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: IronPython", @@ -756,6 +793,7 @@ "Topic :: Text Processing :: Markup :: XML", "Topic :: Text Processing :: Markup :: reStructuredText", "Topic :: Utilities", + "Typing :: Stubs Only", "Typing :: Typed", } @@ -780,13 +818,13 @@ "License :: OSI Approved :: GNU Free Documentation License (FDL)": {"FDL"}, "License :: OSI Approved :: GNU General Public License (GPL)": {"GPL"}, "License :: OSI Approved :: GNU General Public License v2 (GPLv2)": {"GPL", "GPLv2"}, - "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)": {"GPL", "GPLv2+"}, + "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)": {"GPLv2+", "GPL"}, "License :: OSI Approved :: GNU General Public License v3 (GPLv3)": {"GPL", "GPLv3"}, "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)": {"GPL", "GPLv3+"}, "License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)": {"LGPL", "LGPLv2"}, - "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)": {"LGPL", "LGPLv2+"}, - "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)": {"LGPLv3", "LGPL"}, - "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)": {"LGPLv3+", "LGPL"}, + "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)": {"LGPLv2+", "LGPL"}, + "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)": {"LGPL", "LGPLv3"}, + "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)": {"LGPL", "LGPLv3+"}, "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)": {"LGPL"}, "License :: OSI Approved :: Historical Permission Notice and Disclaimer (HPND)": {"HPND"}, "License :: OSI Approved :: ISC License (ISCL)": {"ISCL"}, @@ -808,102 +846,61 @@ } CODE_LICENSES = { - "AFPL": { - "License :: Aladdin Free Public License (AFPL)"}, - "CC0 1.0": { - "License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication"}, - "CECILL-B": { - "License :: CeCILL-B Free Software License Agreement (CECILL-B)"}, - "CECILL-C": { - "License :: CeCILL-C Free Software License Agreement (CECILL-C)"}, - "EFL": { - "License :: Eiffel Forum License (EFL)"}, - "NPL": { - "License :: Netscape Public License (NPL)"}, - "NOKOS": { - "License :: Nokia Open Source License (NOKOS)"}, - "AFL": { - "License :: OSI Approved :: Academic Free License (AFL)"}, - "BSL-1.0": { - "License :: OSI Approved :: Boost Software License 1.0 (BSL-1.0)"}, - "CeCILL-2.1": { - "License :: OSI Approved :: CEA CNRS Inria Logiciel Libre License, version 2.1 (CeCILL-2.1)"}, - "CDDL-1.0": { - "License :: OSI Approved :: Common Development and Distribution License 1.0 (CDDL-1.0)"}, - "EPL-1.0": { - "License :: OSI Approved :: Eclipse Public License 1.0 (EPL-1.0)"}, - "EPL-2.0": { - "License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0)"}, - "EUPL 1.0": { - "License :: OSI Approved :: European Union Public Licence 1.0 (EUPL 1.0)"}, - "EUPL 1.1": { - "License :: OSI Approved :: European Union Public Licence 1.1 (EUPL 1.1)"}, - "EUPL 1.2": { - "License :: OSI Approved :: European Union Public Licence 1.2 (EUPL 1.2)"}, - "AGPLv3+": { - "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)"}, - "FDL": { - "License :: OSI Approved :: GNU Free Documentation License (FDL)"}, + "AFPL": {"License :: Aladdin Free Public License (AFPL)"}, + "CC0 1.0": {"License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication"}, + "CECILL-B": {"License :: CeCILL-B Free Software License Agreement (CECILL-B)"}, + "CECILL-C": {"License :: CeCILL-C Free Software License Agreement (CECILL-C)"}, + "EFL": {"License :: Eiffel Forum License (EFL)"}, + "NPL": {"License :: Netscape Public License (NPL)"}, + "NOKOS": {"License :: Nokia Open Source License (NOKOS)"}, + "AFL": {"License :: OSI Approved :: Academic Free License (AFL)"}, + "BSL-1.0": {"License :: OSI Approved :: Boost Software License 1.0 (BSL-1.0)"}, + "CeCILL-2.1": {"License :: OSI Approved :: CEA CNRS Inria Logiciel Libre License, version 2.1 (CeCILL-2.1)"}, + "CDDL-1.0": {"License :: OSI Approved :: Common Development and Distribution License 1.0 (CDDL-1.0)"}, + "EPL-1.0": {"License :: OSI Approved :: Eclipse Public License 1.0 (EPL-1.0)"}, + "EPL-2.0": {"License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0)"}, + "EUPL 1.0": {"License :: OSI Approved :: European Union Public Licence 1.0 (EUPL 1.0)"}, + "EUPL 1.1": {"License :: OSI Approved :: European Union Public Licence 1.1 (EUPL 1.1)"}, + "EUPL 1.2": {"License :: OSI Approved :: European Union Public Licence 1.2 (EUPL 1.2)"}, + "AGPLv3+": {"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)"}, + "FDL": {"License :: OSI Approved :: GNU Free Documentation License (FDL)"}, "GPL": { - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", - "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "License :: OSI Approved :: GNU General Public License (GPL)", - "License :: OSI Approved :: GNU General Public License v2 (GPLv2)"}, - "GPLv2": { - "License :: OSI Approved :: GNU General Public License v2 (GPLv2)"}, - "GPLv2+": { - "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)"}, - "GPLv3": { - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)"}, - "GPLv3+": { - "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)"}, - "LGPLv2": { - "License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)"}, + "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", + "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", + }, + "GPLv2": {"License :: OSI Approved :: GNU General Public License v2 (GPLv2)"}, + "GPLv2+": {"License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)"}, + "GPLv3": {"License :: OSI Approved :: GNU General Public License v3 (GPLv3)"}, + "GPLv3+": {"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)"}, + "LGPLv2": {"License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)"}, "LGPL": { - "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", - "License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)", "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)", - "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)"}, - "LGPLv2+": { - "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)"}, - "LGPLv3": { - "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)"}, - "LGPLv3+": { - "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)"}, - "HPND": { - "License :: OSI Approved :: Historical Permission Notice and Disclaimer (HPND)"}, - "ISCL": { - "License :: OSI Approved :: ISC License (ISCL)"}, - "MIT": { - "License :: OSI Approved :: MIT License"}, - "MIT-0": { - "License :: OSI Approved :: MIT No Attribution License (MIT-0)"}, - "CVW": { - "License :: OSI Approved :: MITRE Collaborative Virtual Workspace License (CVW)"}, - "MirOS": { - "License :: OSI Approved :: MirOS License (MirOS)"}, - "MPL": { - "License :: OSI Approved :: Mozilla Public License 1.0 (MPL)"}, - "MPL 1.1": { - "License :: OSI Approved :: Mozilla Public License 1.1 (MPL 1.1)"}, - "MPL 2.0": { - "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)"}, - "OSL-3.0": { - "License :: OSI Approved :: Open Software License 3.0 (OSL-3.0)"}, - "CNRI Python License": { - "License :: OSI Approved :: Python License (CNRI Python License)"}, - "QPL": { - "License :: OSI Approved :: Qt Public License (QPL)"}, - "OFL-1.1": { - "License :: OSI Approved :: SIL Open Font License 1.1 (OFL-1.1)"}, - "SISSL": { - "License :: OSI Approved :: Sun Industry Standards Source License (SISSL)"}, - "Unlicense": { - "License :: OSI Approved :: The Unlicense (Unlicense)"}, - "UPL": { - "License :: OSI Approved :: Universal Permissive License (UPL)"}, - "ZPL": { - "License :: OSI Approved :: Zope Public License"}, + "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", + "License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)", + "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)", + }, + "LGPLv2+": {"License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)"}, + "LGPLv3": {"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)"}, + "LGPLv3+": {"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)"}, + "HPND": {"License :: OSI Approved :: Historical Permission Notice and Disclaimer (HPND)"}, + "ISCL": {"License :: OSI Approved :: ISC License (ISCL)"}, + "MIT": {"License :: OSI Approved :: MIT License"}, + "MIT-0": {"License :: OSI Approved :: MIT No Attribution License (MIT-0)"}, + "CVW": {"License :: OSI Approved :: MITRE Collaborative Virtual Workspace License (CVW)"}, + "MirOS": {"License :: OSI Approved :: MirOS License (MirOS)"}, + "MPL": {"License :: OSI Approved :: Mozilla Public License 1.0 (MPL)"}, + "MPL 1.1": {"License :: OSI Approved :: Mozilla Public License 1.1 (MPL 1.1)"}, + "MPL 2.0": {"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)"}, + "OSL-3.0": {"License :: OSI Approved :: Open Software License 3.0 (OSL-3.0)"}, + "CNRI Python License": {"License :: OSI Approved :: Python License (CNRI Python License)"}, + "QPL": {"License :: OSI Approved :: Qt Public License (QPL)"}, + "OFL-1.1": {"License :: OSI Approved :: SIL Open Font License 1.1 (OFL-1.1)"}, + "SISSL": {"License :: OSI Approved :: Sun Industry Standards Source License (SISSL)"}, + "Unlicense": {"License :: OSI Approved :: The Unlicense (Unlicense)"}, + "UPL": {"License :: OSI Approved :: Universal Permissive License (UPL)"}, + "ZPL": {"License :: OSI Approved :: Zope Public License"}, } diff --git a/setup.cfg b/setup.cfg index aacb72f..fe60124 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,66 @@ +[metadata] +name = pyroma +version = 3.3.dev0 +description = Test your project's packaging friendliness +long_description = file: README.rst, CHANGES.txt +classifiers = + Development Status :: 5 - Production/Stable + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Operating System :: OS Independent + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: Implementation :: PyPy +keywords = pypi, quality, testing +author = Lennart Regebro +author_email = regebro@gmail.com +url = https://github.com/regebro/pyroma +license = MIT +project_urls = + Source Code = https://github.com/regebro/pyroma + +[options] +zip_safe = True +include_package_data = True +packages = find: +package_dir = + = . +test_suite = pyroma.tests +install_requires = + setuptools + docutils + pygments + requests + +[options.packages.find] +where = . + +[options.extras_require] +test = + pytest + pytest-cov + +[options.entry_points] +console_scripts = + pyroma = pyroma:main + +zest.releaser.prereleaser.before = + pyroma = pyroma:zester + +[flake8] +max-line-length=120 + [bdist_wheel] -universal=0 +universal=1 + +[tool:pytest] +testpaths = + pyroma/tests.py [check-manifest] ignore = diff --git a/setup.py b/setup.py index 16d9eaa..6068493 100644 --- a/setup.py +++ b/setup.py @@ -1,44 +1,3 @@ -from setuptools import setup, find_packages +from setuptools import setup -version = "3.3.dev0" - -with open("README.rst", encoding="UTF-8") as file: - long_description = file.read() + "\n" - -with open("HISTORY.txt", encoding="UTF-8") as file: - long_description += file.read() - -setup( - name="pyroma", - version=version, - description="Test your project's packaging friendliness", - long_description=long_description, - python_requires=">=3.6", - classifiers=[ - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: Implementation :: PyPy", - "License :: OSI Approved :: MIT License", - "Development Status :: 5 - Production/Stable", - ], - keywords=["pypi", "quality", "testing"], - author="Lennart Regebro", - author_email="regebro@gmail.com", - url="https://github.com/regebro/pyroma", - project_urls={"Source Code": "https://github.com/regebro/pyroma"}, - license="MIT", - packages=find_packages(exclude=["ez_setup"]), - include_package_data=True, - zip_safe=False, - install_requires=["setuptools", "docutils", "pygments", "requests"], - entry_points={ - "console_scripts": ["pyroma = pyroma:main"], - "zest.releaser.prereleaser.before": ["pyroma = pyroma:zester"], - }, - test_suite="pyroma", -) +setup()