diff --git a/MANIFEST.in b/MANIFEST.in index a98d169..3492f72 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -10,6 +10,6 @@ exclude tasks.py exclude tests/test_fixtures/*/*.json exclude tests/test_hpack_integration.py -include README.rst LICENSE CHANGELOG.rst CONTRIBUTORS.rst pyproject.toml tox.ini +include README.rst LICENSE CHANGELOG.rst CONTRIBUTORS.rst pyproject.toml global-exclude *.pyc *.pyo *.swo *.swp *.map *.yml *.DS_Store diff --git a/pyproject.toml b/pyproject.toml index 470e9a1..db11975 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta" [project] name = "hpack" -description = "Pure-Python HPACK header compression" +description = "Pure-Python HPACK header encoding" readme = { file = "README.rst", content-type = "text/x-rst" } license = { file = "LICENSE" } @@ -46,6 +46,12 @@ 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", @@ -103,3 +109,83 @@ 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=hpack", { 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/*"], +] + +[tool.tox.env.bench] +deps = [ + "{[tool.tox.env]deps}", + "pytest-benchmark==3.2.3", +] +commands = [ + ["pytest {toxinidir}/bench/ --benchmark-only --benchmark-group-by=name --benchmark-autosave --benchmark-compare --benchmark-min-rounds=500000"], +] + +[tool.tox.env.create_test_output] +base_python = ["python3.9"] +commands = [ + ["python", "{toxinidir}/utils/create_test_output.py", { replace = "posargs", extend = true }], +] diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 75e5c44..0000000 --- a/tox.ini +++ /dev/null @@ -1,71 +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=hpack {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/* - -[testenv:bench] -deps = - {[testenv]deps} - pytest-benchmark==3.2.3 -commands = - pytest {toxinidir}/bench/ --benchmark-only --benchmark-group-by=name --benchmark-autosave --benchmark-compare --benchmark-min-rounds=500000 - -[testenv:create_test_output] -basepython = python3.9 -; rm -rf hpack-test-case/ -; git clone https://github.com/http2jp/hpack-test-case.git -commands = python {toxinidir}/utils/create_test_output.py {posargs}