Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions check_dist/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,10 @@ def check_sdist_vs_vcs(
# Artifacts are built files not in VCS but expected in dists
artifacts = hatch_config.get("artifacts", [])

# There are also artifact sections in sdist and wheel config that should be considered when comparing against VCS
sdist_artifacts = hatch_config.get("targets", {}).get("sdist", {}).get("artifacts", [])
artifacts.extend(sdist_artifacts)

# "Extra" = files in sdist that are neither VCS-tracked nor
# generated artifacts. This catches truly stray files.
extra = sorted(sdist_set - vcs_set)
Expand Down
8 changes: 8 additions & 0 deletions check_dist/tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,14 @@ def test_artifacts_not_flagged_as_extra(self):
errors = check_sdist_vs_vcs(sdist, vcs, hatch)
assert errors == []

def test_artifacts_in_sdist_section(self):
"""Artifacts listed in hatch sdist config should also be ignored."""
sdist = ["pkg/extension/index.js", "pkg/__init__.py", "pyproject.toml"]
vcs = ["pkg/__init__.py", "pyproject.toml"]
hatch = {"targets": {"sdist": {"artifacts": ["pkg/extension"]}}}
errors = check_sdist_vs_vcs(sdist, vcs, hatch)
assert errors == []

def test_only_include_vcs_check(self):
"""only-include config should scope the VCS comparison."""
sdist = ["pkg/__init__.py", "rust/lib.rs", "Cargo.toml", "pyproject.toml"]
Expand Down
Loading