From 8331ad083c44565a7a540f049b3255a036153d36 Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Sun, 24 Aug 2025 08:14:31 +0200 Subject: [PATCH 01/14] build: Revert pinning of build-time dependencing due to issues with downstream packaging. see https://github.com/pytest-dev/pytest-asyncio/pull/1192#issuecomment-3194461684 --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4f78afb9..46804245 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ [build-system] build-backend = "setuptools.build_meta" requires = [ - "setuptools==80.9", - "setuptools-scm==9.2", + "setuptools>=77", + "setuptools-scm[toml]>=6.2", ] [project] From b984c644af3912a0b65c32123b6694e3693fdc3a Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Sun, 24 Aug 2025 10:54:08 +0200 Subject: [PATCH 02/14] build: Unify constraints files. Pytest-asyncio currently uses separate constraints files for the base package and the [docs] extra. This creates issues when both files specify constraints on the same dependency and that dependency is bumped by Dependabot in only one file. In that case, the build may fail due to conflicting constraints (see for example https://github.com/pytest-dev/pytest-asyncio/pull/986). This patch creates a unified constraints file for pytest-asyncio. There's still a second constraints file for pytest-min, which is used to test against the minimum supported version of pytest. --- .github/dependabot.yml | 6 ----- dependencies/default/constraints.txt | 26 +++++++++++++++++++ .../requirements-docs.txt} | 0 tox.ini | 4 +-- 4 files changed, 28 insertions(+), 8 deletions(-) rename dependencies/{docs/requirements.txt => default/requirements-docs.txt} (100%) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3d725a50..9a663d8e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,12 +7,6 @@ updates: interval: weekly open-pull-requests-limit: 10 target-branch: main -- package-ecosystem: pip - directory: /dependencies/docs - schedule: - interval: weekly - open-pull-requests-limit: 10 - target-branch: main - package-ecosystem: github-actions directory: / schedule: diff --git a/dependencies/default/constraints.txt b/dependencies/default/constraints.txt index 713a8558..e1030416 100644 --- a/dependencies/default/constraints.txt +++ b/dependencies/default/constraints.txt @@ -1,11 +1,37 @@ +alabaster==0.7.16 attrs==25.3.0 +babel==2.17.0 +backports.asyncio.runner==1.2.0 +certifi==2025.8.3 +charset-normalizer==3.4.3 coverage==7.10.6 +docutils==0.21.2 exceptiongroup==1.3.0 hypothesis==6.138.13 iniconfig==2.1.0 +idna==3.10 +imagesize==1.4.1 +importlib_metadata==8.7.0 +iniconfig==2.1.0 +Jinja2==3.1.6 +MarkupSafe==3.0.2 packaging==25.0 pluggy==1.6.0 +Pygments==2.19.2 pytest==8.4.1 +requests==2.32.4 +snowballstemmer==3.0.1 sortedcontainers==2.4.0 +Sphinx==8.0.2 +sphinx-rtd-theme==3.0.2 +sphinxcontrib-applehelp==2.0.0 +sphinxcontrib-devhelp==2.0.0 +sphinxcontrib-htmlhelp==2.1.0 +sphinxcontrib-jquery==4.1 +sphinxcontrib-jsmath==1.0.1 +sphinxcontrib-qthelp==2.0.0 +sphinxcontrib-serializinghtml==2.0.0 tomli==2.2.1 typing_extensions==4.15.0 +urllib3==2.5.0 +zipp==3.23.0 diff --git a/dependencies/docs/requirements.txt b/dependencies/default/requirements-docs.txt similarity index 100% rename from dependencies/docs/requirements.txt rename to dependencies/default/requirements-docs.txt diff --git a/tox.ini b/tox.ini index 3608cc56..7699a2df 100644 --- a/tox.ini +++ b/tox.ini @@ -30,8 +30,8 @@ allowlist_externals = git extras = docs deps = - --requirement dependencies/docs/requirements.txt - --constraint dependencies/docs/constraints.txt + --requirement dependencies/default/requirements-docs.txt + --constraint dependencies/default/constraints.txt change_dir = docs description = Build The Docs with {basepython} commands = From b030c2cd5a37813dde2fdfaae953a4fcf8db3b7b Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Sun, 24 Aug 2025 10:57:56 +0200 Subject: [PATCH 03/14] build: Updated minimum required tox version to v4.28. --- .pre-commit-config.yaml | 2 +- changelog.d/+dc5bb56e.downstream.rst | 1 + tox.ini | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changelog.d/+dc5bb56e.downstream.rst diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 32556fe7..0a6219cb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -72,7 +72,7 @@ repos: hooks: - id: pyproject-fmt # https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version - additional_dependencies: [tox>=4.9] + additional_dependencies: [tox>=4.28] - repo: https://github.com/zizmorcore/zizmor-pre-commit rev: v1.12.1 hooks: diff --git a/changelog.d/+dc5bb56e.downstream.rst b/changelog.d/+dc5bb56e.downstream.rst new file mode 100644 index 00000000..6bb210bb --- /dev/null +++ b/changelog.d/+dc5bb56e.downstream.rst @@ -0,0 +1 @@ +Bump the minimum required version of tox to v4.28. This change is only relevant if you use the ``tox.ini`` file provided by pytest-asyncio to run tests. diff --git a/tox.ini b/tox.ini index 7699a2df..4e794b0b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -minversion = 4.9.0 +minversion = 4.28.0 envlist = py39, py310, py311, py312, py313, py314, pytest-min, docs, pyright isolated_build = true passenv = From 8d964343ffb7a3fbb1b11a54074da58f1f8a1a87 Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Sun, 24 Aug 2025 11:23:55 +0200 Subject: [PATCH 04/14] build: Use tox "constraints" and "deps" configuration options rather than assembling a custom install_command. --- tox.ini | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/tox.ini b/tox.ini index 4e794b0b..7b18470d 100644 --- a/tox.ini +++ b/tox.ini @@ -7,20 +7,16 @@ passenv = [testenv] extras = testing -install_command = python -m pip install \ - --requirement dependencies/default/requirements.txt \ - --constraint dependencies/default/constraints.txt \ - {opts} {packages} +constraints = dependencies/default/constraints.txt +deps = -r dependencies/default/requirements.txt commands = make test allowlist_externals = make [testenv:pytest-min] extras = testing -install_command = python -m pip install \ - --requirement dependencies/pytest-min/requirements.txt \ - --constraint dependencies/pytest-min/constraints.txt \ - {opts} {packages} +constraints = dependencies/pytest-min/constraints.txt +deps = -r dependencies/pytest-min/requirements.txt commands = make test allowlist_externals = make @@ -29,9 +25,7 @@ allowlist_externals = allowlist_externals = git extras = docs -deps = - --requirement dependencies/default/requirements-docs.txt - --constraint dependencies/default/constraints.txt +deps = -r dependencies/default/requirements-docs.txt change_dir = docs description = Build The Docs with {basepython} commands = From 99073bc532987b3e1f903f3c19b9384c754dd1e9 Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Sun, 24 Aug 2025 12:15:41 +0200 Subject: [PATCH 05/14] build: Install wheel instead of sdist into tox environments. This avoids building the package separately for each environment. --- tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tox.ini b/tox.ini index 7b18470d..b6f3dc47 100644 --- a/tox.ini +++ b/tox.ini @@ -6,6 +6,8 @@ passenv = CI [testenv] +package = wheel +wheel_build_env = .pkg extras = testing constraints = dependencies/default/constraints.txt deps = -r dependencies/default/requirements.txt From 73acd117cb69fb215f5c4cacc0f454267914e739 Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Sun, 24 Aug 2025 12:18:20 +0200 Subject: [PATCH 06/14] build: Pin setuptools and setuptools-scm versions during tox build. --- dependencies/default/constraints.txt | 2 ++ tox.ini | 3 +++ 2 files changed, 5 insertions(+) diff --git a/dependencies/default/constraints.txt b/dependencies/default/constraints.txt index e1030416..e751598f 100644 --- a/dependencies/default/constraints.txt +++ b/dependencies/default/constraints.txt @@ -20,6 +20,8 @@ pluggy==1.6.0 Pygments==2.19.2 pytest==8.4.1 requests==2.32.4 +setuptools==80.9.0 +setuptools-scm==8.3.0 snowballstemmer==3.0.1 sortedcontainers==2.4.0 Sphinx==8.0.2 diff --git a/tox.ini b/tox.ini index b6f3dc47..11b1ccd5 100644 --- a/tox.ini +++ b/tox.ini @@ -5,6 +5,9 @@ isolated_build = true passenv = CI +[pkgenv] +constraints = dependencies/default/constraints.txt + [testenv] package = wheel wheel_build_env = .pkg From 827dd66762a270d036f0dcaea561b6ea8f54d78b Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Sun, 24 Aug 2025 13:38:51 +0200 Subject: [PATCH 07/14] build: Remove unnecessary deps specification in tox.ini --- tox.ini | 2 -- 1 file changed, 2 deletions(-) diff --git a/tox.ini b/tox.ini index 11b1ccd5..702800a6 100644 --- a/tox.ini +++ b/tox.ini @@ -13,7 +13,6 @@ package = wheel wheel_build_env = .pkg extras = testing constraints = dependencies/default/constraints.txt -deps = -r dependencies/default/requirements.txt commands = make test allowlist_externals = make @@ -30,7 +29,6 @@ allowlist_externals = allowlist_externals = git extras = docs -deps = -r dependencies/default/requirements-docs.txt change_dir = docs description = Build The Docs with {basepython} commands = From 18a83988e060d7aa3e26dc8717022e8311547f84 Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Sun, 24 Aug 2025 13:39:58 +0200 Subject: [PATCH 08/14] build: Removed obsolete requirements.txt files --- dependencies/default/requirements-docs.txt | 2 -- dependencies/default/requirements.txt | 3 --- 2 files changed, 5 deletions(-) delete mode 100644 dependencies/default/requirements-docs.txt delete mode 100644 dependencies/default/requirements.txt diff --git a/dependencies/default/requirements-docs.txt b/dependencies/default/requirements-docs.txt deleted file mode 100644 index 1bfd7f50..00000000 --- a/dependencies/default/requirements-docs.txt +++ /dev/null @@ -1,2 +0,0 @@ -sphinx >= 5.3 -sphinx-rtd-theme >= 1.0 diff --git a/dependencies/default/requirements.txt b/dependencies/default/requirements.txt deleted file mode 100644 index 42cfc8d3..00000000 --- a/dependencies/default/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -# Always adjust install_requires in setup.cfg and pytest-min-requirements.txt -# when changing runtime dependencies -pytest >= 8.2,<9 From 3e0b8681621c85f6b6b981f25f4a367f5fc3c332 Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Sun, 24 Aug 2025 13:41:18 +0200 Subject: [PATCH 09/14] build: Move constraints file to project root. --- .github/dependabot.yml | 2 +- dependencies/default/constraints.txt => constraints.txt | 0 tox.ini | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) rename dependencies/default/constraints.txt => constraints.txt (100%) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9a663d8e..c79c0de8 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,7 +2,7 @@ version: 2 updates: - package-ecosystem: pip - directory: /dependencies/default + directory: / schedule: interval: weekly open-pull-requests-limit: 10 diff --git a/dependencies/default/constraints.txt b/constraints.txt similarity index 100% rename from dependencies/default/constraints.txt rename to constraints.txt diff --git a/tox.ini b/tox.ini index 702800a6..b6539cd1 100644 --- a/tox.ini +++ b/tox.ini @@ -6,13 +6,13 @@ passenv = CI [pkgenv] -constraints = dependencies/default/constraints.txt +constraints = constraints.txt [testenv] package = wheel wheel_build_env = .pkg extras = testing -constraints = dependencies/default/constraints.txt +constraints = constraints.txt commands = make test allowlist_externals = make From 7e623acaa2ad0379c6423e68b84c11b1ae8da238 Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Sun, 24 Aug 2025 14:08:48 +0200 Subject: [PATCH 10/14] build: Use tox to build both sdist and wheel files. --- tox.ini | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index b6539cd1..e087680c 100644 --- a/tox.ini +++ b/tox.ini @@ -9,14 +9,20 @@ passenv = constraints = constraints.txt [testenv] -package = wheel -wheel_build_env = .pkg +package = external extras = testing constraints = constraints.txt commands = make test allowlist_externals = make +[testenv:.pkg_external] +deps = build +package_glob = {toxinidir}{/}dist{/}*.whl +commands = + python -c 'import shutil; shutil.rmtree("{toxinidir}{/}dist", ignore_errors=True)' + pyproject-build --outdir {toxinidir}{/}dist . + [testenv:pytest-min] extras = testing constraints = dependencies/pytest-min/constraints.txt From c8af9697619f065c4e3a2cf51a0b32b21b6f8543 Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Sun, 24 Aug 2025 14:25:27 +0200 Subject: [PATCH 11/14] build: Move building and checking of distribution files into dedicated tox environment. This simplifies the GitHub Actions workflow, allows future pinning of the dependencies associated with the check, and aligns development and CI setups more closely. --- .github/workflows/main.yml | 12 ++++-------- tox.ini | 13 +++++++++++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ccfbec02..74cfbc52 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,16 +37,12 @@ jobs: run: python -m pip install pre-commit - name: Run pre-commit checks run: pre-commit run --all-files --show-diff-on-failure - - name: Install check-wheel-content, and twine - run: python -m pip install build check-wheel-contents twine - - name: Build package - run: python -m build + - name: Install tox + run: python -m pip install tox + - name: Build package and check distributions + run: tox run -e build - name: List result run: ls -l dist - - name: Check wheel contents - run: check-wheel-contents dist/*.whl - - name: Check long_description - run: python -m twine check dist/* - name: Install pytest-asyncio run: pip install . - name: Get version info diff --git a/tox.ini b/tox.ini index e087680c..b6121581 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 4.28.0 -envlist = py39, py310, py311, py312, py313, py314, pytest-min, docs, pyright +envlist = build, py39, py310, py311, py312, py313, py314, pytest-min, docs, pyright isolated_build = true passenv = CI @@ -23,6 +23,15 @@ commands = python -c 'import shutil; shutil.rmtree("{toxinidir}{/}dist", ignore_errors=True)' pyproject-build --outdir {toxinidir}{/}dist . +[testenv:build] +description = Check distribution files +deps = + check-wheel-contents + twine +commands = + check-wheel-contents {toxinidir}{/}dist + twine check {toxinidir}{/}dist{/}* + [testenv:pytest-min] extras = testing constraints = dependencies/pytest-min/constraints.txt @@ -81,7 +90,7 @@ skip_install = true [gh-actions] python = - 3.9: py39, pytest-min + 3.9: py39, pytest-min, build 3.10: py310 3.11: py311 3.12: py312 From a8bed23751794e0ee446dc1ee6daa871310da81c Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Sun, 24 Aug 2025 14:33:04 +0200 Subject: [PATCH 12/14] ci: Split lint job into separate jobs for building and linting. --- .github/workflows/main.yml | 44 ++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 74cfbc52..d5fb8624 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,8 +16,8 @@ env: PYTHON_LATEST: 3.13 jobs: - lint: - name: Run linters + build: + name: Build package runs-on: ubuntu-latest outputs: version: ${{ steps.version.outputs.version }} @@ -30,13 +30,6 @@ jobs: - uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_LATEST }} - - name: Install GitHub matcher for ActionLint checker - run: | - echo "::add-matcher::.github/actionlint-matcher.json" - - name: Install pre-commit - run: python -m pip install pre-commit - - name: Run pre-commit checks - run: pre-commit run --all-files --show-diff-on-failure - name: Install tox run: python -m pip install tox - name: Build package and check distributions @@ -54,6 +47,25 @@ jobs: name: dist path: dist + lint: + name: Run linters + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + persist-credentials: false + - uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHON_LATEST }} + - name: Install GitHub matcher for ActionLint checker + run: | + echo "::add-matcher::.github/actionlint-matcher.json" + - name: Install pre-commit + run: python -m pip install pre-commit + - name: Run pre-commit checks + run: pre-commit run --all-files --show-diff-on-failure + test: name: ${{ matrix.os }} - Python ${{ matrix.python-version }} runs-on: ${{ matrix.os }}-latest @@ -105,7 +117,7 @@ jobs: check: name: Check if: always() - needs: [lint, test] + needs: [build, lint, test] runs-on: ubuntu-latest steps: - name: Decide whether the needed jobs succeeded or failed @@ -141,7 +153,7 @@ jobs: create-github-release: name: Create GitHub release - needs: [lint, check] + needs: [build, lint, check] runs-on: ubuntu-latest permissions: contents: write @@ -164,7 +176,7 @@ jobs: if: ${{ !contains(github.ref, 'refs/tags/') }} run: towncrier build --draft --version "${version}" > release-notes.rst env: - version: ${{ needs.lint.outputs.version }} + version: ${{ needs.build.outputs.version }} - name: Extract release notes from Git tag if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') run: | @@ -190,16 +202,16 @@ jobs: if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') uses: ncipollo/release-action@1c89adf39833729d8f85a31ccbc451b078733c80 # v1.19.1 with: - name: pytest-asyncio ${{ needs.lint.outputs.version }} + name: pytest-asyncio ${{ needs.build.outputs.version }} artifacts: dist/* bodyFile: release-notes.md - prerelease: ${{ needs.lint.outputs.prerelease }} + prerelease: ${{ needs.build.outputs.prerelease }} token: ${{ secrets.GITHUB_TOKEN }} publish-test-pypi: name: Publish packages to test.pypi.org if: github.event_name == 'push' && github.ref == 'refs/heads/main' - needs: [lint, check] + needs: [build, lint, check] runs-on: ubuntu-latest permissions: id-token: write @@ -218,7 +230,7 @@ jobs: name: Publish packages to pypi.org environment: release if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') - needs: [lint, check] + needs: [build, lint, check] runs-on: ubuntu-latest permissions: id-token: write From 61da31e380a31bfd7222587af6501994f62c549e Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Sun, 24 Aug 2025 14:39:04 +0200 Subject: [PATCH 13/14] build: Add constraints for dependency check-wheel-contents. --- constraints.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/constraints.txt b/constraints.txt index e751598f..38fb4000 100644 --- a/constraints.txt +++ b/constraints.txt @@ -1,9 +1,12 @@ alabaster==0.7.16 +annotated-types-0.7.0 attrs==25.3.0 babel==2.17.0 backports.asyncio.runner==1.2.0 certifi==2025.8.3 charset-normalizer==3.4.3 +check-wheel-contents==0.6.1 +click==8.1.8 coverage==7.10.6 docutils==0.21.2 exceptiongroup==1.3.0 @@ -18,6 +21,8 @@ MarkupSafe==3.0.2 packaging==25.0 pluggy==1.6.0 Pygments==2.19.2 +pydantic==2.11.7 +pydantic-core==2.33.2 pytest==8.4.1 requests==2.32.4 setuptools==80.9.0 @@ -35,5 +40,7 @@ sphinxcontrib-qthelp==2.0.0 sphinxcontrib-serializinghtml==2.0.0 tomli==2.2.1 typing_extensions==4.15.0 +typing-inspection==0.4.1 urllib3==2.5.0 +wheel-filename==1.4.2 zipp==3.23.0 From ffb6c5aea8d2939b7933a8d3e8f29c814ed365f9 Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Sun, 24 Aug 2025 14:48:18 +0200 Subject: [PATCH 14/14] build: Add constraints for dependency twine. --- constraints.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/constraints.txt b/constraints.txt index 38fb4000..0f2012ff 100644 --- a/constraints.txt +++ b/constraints.txt @@ -3,28 +3,47 @@ annotated-types-0.7.0 attrs==25.3.0 babel==2.17.0 backports.asyncio.runner==1.2.0 +backports.tarfile==1.2.0 certifi==2025.8.3 charset-normalizer==3.4.3 check-wheel-contents==0.6.1 +cffi==1.17.1 click==8.1.8 coverage==7.10.6 +cryptography==45.0.6 docutils==0.21.2 exceptiongroup==1.3.0 hypothesis==6.138.13 iniconfig==2.1.0 +id==1.5.0 idna==3.10 imagesize==1.4.1 importlib_metadata==8.7.0 iniconfig==2.1.0 +jaraco.classes==3.4.0 +jaraco.context==6.0.1 +jaraco.functools==4.3.0 +jeepney==0.9.0 Jinja2==3.1.6 +keyring==25.6.0 +markdown-it-py==3.0.0 MarkupSafe==3.0.2 +mdurl==0.1.2 +more-itertools==10.7.0 +nh3==0.3.0 packaging==25.0 pluggy==1.6.0 Pygments==2.19.2 +pycparser==2.22 pydantic==2.11.7 pydantic-core==2.33.2 pytest==8.4.1 +readme-renderer==44.0 requests==2.32.4 +requests-toolbelt==1.0.0 +rfc3986==2.0.0 +rich==14.1.0 +SecretStorage==3.3.3 setuptools==80.9.0 setuptools-scm==8.3.0 snowballstemmer==3.0.1 @@ -39,6 +58,7 @@ sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==2.0.0 sphinxcontrib-serializinghtml==2.0.0 tomli==2.2.1 +twine==6.1.0 typing_extensions==4.15.0 typing-inspection==0.4.1 urllib3==2.5.0