Switch to 1% static packaging configuration (#998)

* Switch to 1% static packaging configuration

* Add shim for @pganssle

* Not worth interpolation

* Kill extra line
This commit is contained in:
Hynek Schlawack 2022-08-10 14:15:32 +02:00 committed by GitHub
parent 6151683244
commit fbcae2a8b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 48 deletions

4
.gitignore vendored
View File

@ -1,5 +1,6 @@
*.egg-info *.egg-info
*.pyc *.pyc
.DS_Store
.cache .cache
.coverage* .coverage*
.direnv .direnv
@ -13,5 +14,4 @@ build
dist dist
docs/_build/ docs/_build/
htmlcov htmlcov
pip-wheel-metadata tmp*
tmp

View File

@ -1,8 +1,17 @@
# SPDX-License-Identifier: MIT
[build-system] [build-system]
requires = ["setuptools>=40.6.0", "wheel"] requires = ["setuptools>=40.6.0", "wheel"]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"
[tool.pytest.ini_options]
addopts = ["-ra", "--strict-markers", "--strict-config"]
xfail_strict = true
testpaths = "tests"
filterwarnings = ["once::Warning", "ignore:::pympler[.*]"]
[tool.coverage.run] [tool.coverage.run]
parallel = true parallel = true
branch = true branch = true
@ -25,6 +34,10 @@ exclude_lines = [
line-length = 79 line-length = 79
[tool.isort]
profile = "attrs"
[tool.interrogate] [tool.interrogate]
verbose = 2 verbose = 2
fail-under = 100 fail-under = 100
@ -35,37 +48,32 @@ whitelist-regex = ["test_.*"]
toplevel = ["attr", "attrs"] toplevel = ["attr", "attrs"]
[tool.isort]
profile = "attrs"
[tool.towncrier] [tool.towncrier]
package = "attr" name = "attrs"
package_dir = "src" filename = "CHANGELOG.rst"
filename = "CHANGELOG.rst" template = "changelog.d/towncrier_template.rst"
template = "changelog.d/towncrier_template.rst" issue_format = "`#{issue} <https://github.com/python-attrs/attrs/issues/{issue}>`_"
issue_format = "`#{issue} <https://github.com/python-attrs/attrs/issues/{issue}>`_" directory = "changelog.d"
directory = "changelog.d" title_format = "{version} ({project_date})"
title_format = "{version} ({project_date})" underlines = ["-", "^"]
underlines = ["-", "^"]
[[tool.towncrier.section]] [[tool.towncrier.section]]
path = "" path = ""
[[tool.towncrier.type]] [[tool.towncrier.type]]
directory = "breaking" directory = "breaking"
name = "Backwards-incompatible Changes" name = "Backwards-incompatible Changes"
showcontent = true showcontent = true
[[tool.towncrier.type]] [[tool.towncrier.type]]
directory = "deprecation" directory = "deprecation"
name = "Deprecations" name = "Deprecations"
showcontent = true showcontent = true
[[tool.towncrier.type]] [[tool.towncrier.type]]
directory = "change" directory = "change"
name = "Changes" name = "Changes"
showcontent = true showcontent = true
[tool.mypy] [tool.mypy]

View File

@ -2,7 +2,6 @@
import codecs import codecs
import os import os
import platform
import re import re
from setuptools import find_packages, setup from setuptools import find_packages, setup
@ -45,25 +44,27 @@ CLASSIFIERS = [
INSTALL_REQUIRES = [] INSTALL_REQUIRES = []
EXTRAS_REQUIRE = { EXTRAS_REQUIRE = {
"docs": ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"], "docs": ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"],
"tests_no_zope": [ "tests-no-zope": [
# For regression test to ensure cloudpickle compat doesn't break. # For regression test to ensure cloudpickle compat doesn't break.
'cloudpickle; python_implementation == "CPython"', 'cloudpickle; python_implementation == "CPython"',
# 5.0 introduced toml; parallel was broken until 5.0.2
"coverage[toml]>=5.0.2",
"hypothesis", "hypothesis",
"pympler", "pympler",
"pytest>=4.3.0", # 4.3.0 dropped last use of `convert` # 4.3.0 dropped last use of `convert`
"pytest>=4.3.0",
# Since the mypy error messages keep changing, we have to keep updating
# this pin.
"mypy>=0.971; python_implementation == 'CPython'",
"pytest-mypy-plugins; python_implementation == 'CPython'",
], ],
"tests": {
"attrs[tests-no-zope]",
"zope.interface",
},
"dev": {"attrs[tests,docs]": ["pre-commit"]},
} }
if platform.python_implementation() != "PyPy": # Don't break Paul unnecessarily just yet. C.f. #685
EXTRAS_REQUIRE["tests_no_zope"].extend( EXTRAS_REQUIRE["tests_no_zope"] = EXTRAS_REQUIRE["tests-no-zope"]
["mypy>=0.900,!=0.940", "pytest-mypy-plugins"]
)
EXTRAS_REQUIRE["tests"] = EXTRAS_REQUIRE["tests_no_zope"] + ["zope.interface"]
EXTRAS_REQUIRE["dev"] = (
EXTRAS_REQUIRE["tests"] + EXTRAS_REQUIRE["docs"] + ["pre-commit"]
)
############################################################################### ###############################################################################

13
tox.ini
View File

@ -41,17 +41,18 @@ commands = python -m pytest {posargs}
[testenv:py36] [testenv:py36]
extras = tests extras = tests
deps = coverage[toml]
commands = coverage run -m pytest {posargs} commands = coverage run -m pytest {posargs}
[testenv:py310] [testenv:py310]
# Python 3.6+ has a number of compile-time warnings on invalid string escapes. # Python 3.6+ has a number of compile-time warnings on invalid string escapes.
# PYTHONWARNINGS=d and --no-compile below make them visible during the Tox run. # PYTHONWARNINGS=d and --no-compile below make them visible during the Tox run.
basepython = python3.10
install_command = pip install --no-compile {opts} {packages} install_command = pip install --no-compile {opts} {packages}
setenv = setenv =
PYTHONWARNINGS=d PYTHONWARNINGS=d
extras = tests extras = tests
deps = coverage[toml]
commands = coverage run -m pytest {posargs} commands = coverage run -m pytest {posargs}
@ -59,7 +60,7 @@ commands = coverage run -m pytest {posargs}
basepython = python3.10 basepython = python3.10
depends = py36,py310 depends = py36,py310
skip_install = true skip_install = true
deps = coverage[toml]>=5.4 deps = coverage[toml]
commands = commands =
coverage combine coverage combine
coverage report coverage report
@ -68,11 +69,9 @@ commands =
[testenv:pre-commit] [testenv:pre-commit]
basepython = python3.10 basepython = python3.10
skip_install = true skip_install = true
deps = deps = pre-commit
pre-commit
passenv = HOMEPATH # needed on Windows passenv = HOMEPATH # needed on Windows
commands = commands = pre-commit run --all-files
pre-commit run --all-files
[testenv:manifest] [testenv:manifest]
@ -97,7 +96,7 @@ commands =
basepython = python3.8 basepython = python3.8
deps = towncrier deps = towncrier
skip_install = true skip_install = true
commands = towncrier --draft commands = towncrier build --version UNRELEASED --draft
[testenv:typing] [testenv:typing]