From 9f584d788207d58ad62ba17d575a0a2e91263528 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Sun, 11 Dec 2022 10:03:00 +0000 Subject: [PATCH] Adopt PEP-621 for packaging --- .flake8 | 15 +++++++ pyproject.toml | 116 ++++++++++++++++++++++++++++++++++++++++++++++++- setup.cfg | 115 ------------------------------------------------ setup.py | 5 --- tox.ini | 9 ++-- 5 files changed, 136 insertions(+), 124 deletions(-) create mode 100644 .flake8 delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.flake8 b/.flake8 new file mode 100644 index 000000000..a6ed61924 --- /dev/null +++ b/.flake8 @@ -0,0 +1,15 @@ +[flake8] +max-line-length = 100 +# E203 conflicts with PEP8; see https://github.com/psf/black#slices +extend-ignore = E203 + +# flake8-pytest-style +# PT001: +pytest-fixture-no-parentheses = true +# PT006: +pytest-parametrize-names-type = tuple +# PT007: +pytest-parametrize-values-type = tuple +pytest-parametrize-values-row-type = tuple +# PT023: +pytest-mark-no-parentheses = true diff --git a/pyproject.toml b/pyproject.toml index a81638437..eeceabfee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,119 @@ [build-system] -requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] +requires = ["setuptools>=63", "setuptools_scm[toml]>=7"] build-backend = "setuptools.build_meta" +[project] +# https://peps.python.org/pep-0621/#readme +requires-python = ">=3.7" +dynamic = ["version"] +name = "pip-tools" +description = "pip-tools keeps your pinned dependencies fresh." +readme = "README.rst" +authors = [{ "name" = "Vincent Driessen", "email" = "me@nvie.com" }] +license = { text = "BSD" } +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Programming Language :: Python", + "Topic :: Software Development :: Quality Assurance", + "Topic :: Software Development :: Testing", + "Topic :: System :: Systems Administration", + "Topic :: Utilities", + "Typing :: Typed", +] +keywords = ["pip", "requirements", "packaging"] +dependencies = [ + # direct dependencies + "build", + "click >= 8", + "pip >= 22.2", + # indirect dependencies + "setuptools", # typically needed when pip-tools invokes setup.py + "wheel", # pip plugin needed by pip-tools +] + +[project.urls] +homepage = "https://github.com/jazzband/pip-tools/" +documentation = "https://pip-tools.readthedocs.io/en/latest/" +repository = "https://github.com/jazzband/pip-tools" +changelog = "https://github.com/jazzband/pip-tools/releases" + +[project.optional-dependencies] +testing = [ + "pytest >= 7.2.0", + "pytest-rerunfailures", + "pytest-xdist", + # build deps for tests + "flit_core >=2,<4", + "poetry_core>=1.0.0", +] +coverage = [ + "pytest-cov", +] + +[project.scripts] +pip-compile = "piptools.scripts.compile:cli" +pip-sync = "piptools.scripts.sync:cli" + +[tool.isort] +profile = "black" +add_imports = "from __future__ import annotations" + +[tool.mypy] +disallow_untyped_defs = true +disallow_any_generics = true +disallow_incomplete_defs = true +disallow_subclassing_any = true +disallow_untyped_calls = true +disallow_untyped_decorators = true +ignore_missing_imports = true +no_implicit_optional = true +no_implicit_reexport = true +strict_equality = true +warn_redundant_casts = true +warn_return_any = true +warn_unused_configs = true +warn_unused_ignores = true + +# Avoid error: Duplicate module named 'setup' +# https://github.com/python/mypy/issues/4008 +exclude = "^tests/test_data/" + +[tool.mypy.overrides] +modules = [ + "tests.*" +] +disallow_untyped_defs = false + +[tool.pytest.ini_options] +addopts = [ + # `pytest-xdist`: + "--numprocesses=auto" +] +norecursedirs = ".* build dist venv test_data piptools/_compat/*" +testpaths = "tests piptools" +filterwarnings = [ + "always" +] +markers = [ + "network: mark tests that require internet access" +] + +[tool.setuptools.packages.find] +# needed only because we did not adopt src layout yet +exclude = ["img"] + [tool.setuptools_scm] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 6cde1d037..000000000 --- a/setup.cfg +++ /dev/null @@ -1,115 +0,0 @@ -[metadata] -name = pip-tools -url = https://github.com/jazzband/pip-tools/ -license = BSD 3 Clause -author = Vincent Driessen -author_email = me@nvie.com -description = pip-tools keeps your pinned dependencies fresh. -long_description = file: README.rst -classifiers = - Development Status :: 5 - Production/Stable - Intended Audience :: Developers - Intended Audience :: System Administrators - License :: OSI Approved :: BSD License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - 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 :: Implementation :: CPython - Programming Language :: Python :: Implementation :: PyPy - Topic :: System :: Systems Administration - Typing :: Typed - -[options] -python_requires = >=3.7 -setup_requires = setuptools_scm -packages = find: -zip_safe = false -install_requires = - # direct dependencies - build - click >= 8 - pip >= 22.2 - # indirect dependencies - setuptools # typically needed when pip-tools invokes setup.py - wheel # pip plugin needed by pip-tools - -[options.packages.find] -exclude = tests - -[options.package_data] -piptools = py.typed - -[options.extras_require] -testing = - pytest - pytest-rerunfailures - pytest-xdist - # build deps for tests - flit_core >=2,<4 - poetry_core>=1.0.0 -coverage = pytest-cov - -[options.entry_points] -console_scripts = - pip-compile = piptools.scripts.compile:cli - pip-sync = piptools.scripts.sync:cli - -[tool:pytest] -addopts = - # `pytest-xdist`: - --numprocesses=auto -norecursedirs = .* build dist venv test_data piptools/_compat/* -testpaths = tests piptools -filterwarnings = - always -markers = - network: mark tests that require internet access - -[flake8] -max-line-length = 100 -# E203 conflicts with PEP8; see https://github.com/psf/black#slices -extend-ignore = E203 - -# flake8-pytest-style -# PT001: -pytest-fixture-no-parentheses = true -# PT006: -pytest-parametrize-names-type = tuple -# PT007: -pytest-parametrize-values-type = tuple -pytest-parametrize-values-row-type = tuple -# PT023: -pytest-mark-no-parentheses = true - -[isort] -profile = black -add_imports = from __future__ import annotations - -[mypy] -disallow_untyped_defs = true -disallow_any_generics = true -disallow_incomplete_defs = true -disallow_subclassing_any = true -disallow_untyped_calls = true -disallow_untyped_decorators = true -ignore_missing_imports = true -no_implicit_optional = true -no_implicit_reexport = true -strict_equality = true -warn_redundant_casts = true -warn_return_any = true -warn_unused_configs = true -warn_unused_ignores = true - -# Avoid error: Duplicate module named 'setup' -# https://github.com/python/mypy/issues/4008 -exclude = ^tests/test_data/ - -[mypy-tests.*] -disallow_untyped_defs = false diff --git a/setup.py b/setup.py deleted file mode 100644 index 046d466e8..000000000 --- a/setup.py +++ /dev/null @@ -1,5 +0,0 @@ -from __future__ import annotations - -from setuptools import setup - -setup(use_scm_version=True) diff --git a/tox.ini b/tox.ini index 98f3f285c..3ef2ef2bc 100644 --- a/tox.ini +++ b/tox.ini @@ -22,8 +22,11 @@ commands_pre = pip --version commands = pytest {posargs} passenv = - CI - GITHUB_ACTIONS + CI + GITHUB_ACTIONS + PY_COLORS + PY_FORCE_COLOR + PRE_COMMIT_COLOR pip_pre=True [testenv:checkqa] @@ -41,7 +44,7 @@ deps = commands_pre = commands = python -m build --outdir {envtmpdir} --sdist {toxinidir} - twine check {envtmpdir}{/}* + twine check --strict {envtmpdir}{/}* skip_install = true [testenv:build-docs]