From fb70c42d2f7a722825c18797fb6a390807a2a4b7 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 3 Mar 2026 16:07:23 -0500 Subject: [PATCH 1/2] chore: add check-sdist to checks Signed-off-by: Henry Schreiner --- .pre-commit-config.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5c9b9103..707d9ebd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,5 +34,13 @@ repos: - id: rst-directive-colons - id: rst-inline-touching-normal +- repo: https://github.com/henryiii/check-sdist + rev: v1.4.0 + hooks: + - id: check-sdist + args: [--inject-junk] + additional_dependencies: + - flit-core + ci: autoupdate_schedule: quarterly From f69b51c51fbc238328ea5981a68cab030fc9d13d Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 3 Mar 2026 16:10:55 -0500 Subject: [PATCH 2/2] chore: drop test_sdist Signed-off-by: Henry Schreiner --- .github/workflows/test.yml | 3 --- pyproject.toml | 4 --- tests/test_sdist.py | 51 -------------------------------------- 3 files changed, 58 deletions(-) delete mode 100644 tests/test_sdist.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bf1fbf0b..61357e29 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,9 +38,6 @@ jobs: cache-dependency-path: pyproject.toml - name: Install the project and its test dependencies run: pip install --group test coverage[toml] . - - name: Include SDist check dependencies - if: matrix.python-version == '3.13' - run: pip install build flit - name: Test with pytest run: coverage run -m pytest -v env: diff --git a/pyproject.toml b/pyproject.toml index 9b7ec873..69bb518b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -135,7 +135,3 @@ depends = [] deps = ["pre-commit"] package = "skip" commands = [["pre-commit", "run", "-a"]] - -[tool.tox.env.pkg] -deps = ["build", "flit >= 3.8"] -commands = [["pytest", "tests/test_sdist.py", { replace = "posargs", extend = true }]] diff --git a/tests/test_sdist.py b/tests/test_sdist.py deleted file mode 100644 index 0d5f6b65..00000000 --- a/tests/test_sdist.py +++ /dev/null @@ -1,51 +0,0 @@ -import subprocess -import sys -import tarfile -from pathlib import Path - -import pytest -from pytest import MonkeyPatch - -pytest.importorskip("flit") -pytest.importorskip("build") - -# This test must be run from the source directory - okay to skip if not -DIR = Path(__file__).parent.resolve() -MAIN_DIR = DIR.parent - - -def test_compare_sdists(monkeypatch: MonkeyPatch, tmp_path: Path) -> None: - monkeypatch.chdir(MAIN_DIR) - - sdist_build_dir = tmp_path / "bdir" - - subprocess.run( - [ - sys.executable, - "-m", - "build", - "--sdist", - "--no-isolation", - f"--outdir={sdist_build_dir}", - ], - check=True, - ) - - (sdist_build,) = sdist_build_dir.glob("*.tar.gz") - - # Flit doesn't allow targeting directories, as far as I can tell - process = subprocess.run( - [sys.executable, "-m", "flit", "build", "--format=sdist"], - stderr=subprocess.PIPE, - ) - if process.returncode != 0: - pytest.fail(process.stderr.decode("utf-8")) - - (sdist_flit,) = Path("dist").glob("*.tar.gz") - - out = [set(), set()] - for i, sdist in enumerate([sdist_build, sdist_flit]): - with tarfile.open(sdist, "r:gz") as tar: - out[i] = set(tar.getnames()) - - assert out[0] == (out[1] - {"setup.py"})