diff --git a/MANIFEST.in b/MANIFEST.in index 3af4619..1c9629a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -5,6 +5,6 @@ graft tests prune docs/build prune tests/http2-frame-test-case -include README.rst LICENSE CHANGELOG.rst CONTRIBUTORS.rst pyproject.toml tox.ini .gitmodules +include README.rst LICENSE CHANGELOG.rst CONTRIBUTORS.rst pyproject.toml .gitmodules global-exclude *.pyc *.pyo *.swo *.swp *.map *.yml *.DS_Store diff --git a/pyproject.toml b/pyproject.toml index 5413614..98beef6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta" [project] name = "hyperframe" -description = "HTTP/2 framing layer for Python" +description = "Pure-Python HTTP/2 framing" readme = { file = "README.rst", content-type = "text/x-rst" } license = { file = "LICENSE" } @@ -46,6 +46,13 @@ classifiers = [ "Documentation" = "https://python-hyper.org/" [dependency-groups] +dev = [ + { include-group = "testing" }, + { include-group = "linting" }, + { include-group = "packaging" }, + { include-group = "docs" }, +] + testing = [ "pytest>=8.3.3,<9", "pytest-cov>=6.0.0,<7", @@ -105,3 +112,68 @@ source = [ "src/", ".tox/**/site-packages/", ] + +[tool.tox] +min_version = "4.23.2" +env_list = [ "py39", "py310", "py311", "py312", "py313", "pypy3", "lint", "docs", "packaging" ] + +[tool.tox.gh-actions] +python = """ + 3.9: py39, h2spec, lint, docs, packaging + 3.10: py310 + 3.11: py311 + 3.12: py312 + 3.13: py313 + pypy3: pypy3 +""" + +[tool.tox.env_run_base] +pass_env = [ + "GITHUB_*", +] +dependency_groups = ["testing"] +commands = [ + ["pytest", "--cov-report=xml", "--cov-report=term", "--cov=hyperframe", { replace = "posargs", extend = true }] +] + +[tool.tox.env.pypy3] +# temporarily disable coverage testing on PyPy due to performance problems +commands = [ + ["pytest", { replace = "posargs", extend = true }] +] + +[tool.tox.env.lint] +dependency_groups = ["linting"] +commands = [ + ["ruff", "check", "src/"], + ["mypy", "src/"], +] + +[tool.tox.env.docs] +dependency_groups = ["docs"] +allowlist_externals = ["make"] +changedir = "{toxinidir}/docs" +commands = [ + ["make", "clean"], + ["make", "html"], +] + +[tool.tox.env.packaging] +base_python = ["python39"] +dependency_groups = ["packaging"] +allowlist_externals = ["rm"] +commands = [ + ["rm", "-rf", "dist/"], + ["check-manifest"], + ["python", "-m", "build", "--outdir", "dist/"], + ["twine", "check", "dist/*"], +] + +[tool.tox.env.publish] +base_python = "{[tool.tox.env.packaging]base_python}" +deps = "{[tool.tox.env.packaging]deps}" +allowlist_externals = "{[tool.tox.env.packaging]allowlist_externals}" +commands = [ + "{[testenv:packaging]commands}", + ["twine", "upload", "dist/*"], +] diff --git a/tox.ini b/tox.ini deleted file mode 100644 index dfca357..0000000 --- a/tox.ini +++ /dev/null @@ -1,58 +0,0 @@ -[tox] -envlist = py39, py310, py311, py312, py313, pypy3, lint, docs, packaging - -[gh-actions] -python = - 3.9: py39, lint, docs, packaging - 3.10: py310 - 3.11: py311 - 3.12: py312 - 3.13: py313 - pypy3: pypy3 - -[testenv] -passenv = - GITHUB_* -dependency_groups = testing -commands = - pytest --cov-report=xml --cov-report=term --cov=hyperframe {posargs} - -[testenv:pypy3] -# temporarily disable coverage testing on PyPy due to performance problems -commands = pytest {posargs} - -[testenv:lint] -dependency_groups = linting -allowlist_externals = - ruff - mypy -commands = - ruff check src/ tests/ - mypy --strict src/ - -[testenv:docs] -dependency_groups = docs -allowlist_externals = make -changedir = {toxinidir}/docs -commands = - make clean - make html - -[testenv:packaging] -basepython = python3.9 -dependency_groups = packaging -allowlist_externals = rm -commands = - rm -rf dist/ - check-manifest - python -m build --outdir dist/ - twine check dist/* - -[testenv:publish] -basepython = {[testenv:packaging]basepython} -deps = - {[testenv:packaging]deps} -allowlist_externals = {[testenv:packaging]allowlist_externals} -commands = - {[testenv:packaging]commands} - twine upload dist/*