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
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ uv run python scripts/run_actionlint.py
when it is not cached. A passing static workflow check does not mean the
workflow has run successfully on GitHub.

Both Hatch build targets explicitly emit Core Metadata 2.4, which the locked
Twine toolchain can validate. Build isolation resolves Hatchling separately from
`uv.lock`, so relying on its default metadata version can break an unchanged
checkout. The build regression test checks both the sdist-to-wheel path and a
direct wheel build with the locked Twine validator. Change the metadata format
only together with verified support in the validation and publication tools.

If a check is unavailable, say so in the pull request rather than describing
it as passing.

Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ requires = ["hatchling>=1.27.0,<2.0.0"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.sdist]
core-metadata-version = "2.4"
include = [
"/AGENTS.md",
"/ARCHITECTURE.md",
Expand All @@ -71,6 +72,7 @@ include = [
]

[tool.hatch.build.targets.wheel]
core-metadata-version = "2.4"
packages = ["src/cometapi"]

[tool.pyright]
Expand Down
24 changes: 24 additions & 0 deletions tests/test_release_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -1576,6 +1576,30 @@ def test_artifact_metadata_accepts_publication_neutral_long_description() -> Non
)


@pytest.mark.parametrize("build_options", [[], ["--wheel"]], ids=["sdist-to-wheel", "direct-wheel"])
def test_built_distributions_pass_locked_twine_check(
tmp_path: Path, build_options: list[str]
) -> None:
"""Exercise the isolated build backend against the locked metadata validator."""
built = tmp_path / "distributions"
subprocess.run(
["uv", "build", *build_options, "--out-dir", str(built)],
cwd=PROJECT_ROOT,
check=True,
capture_output=True,
text=True,
)
artifacts = sorted(built.glob("*.whl")) + sorted(built.glob("*.tar.gz"))
assert len(artifacts) == (1 if build_options else 2)
subprocess.run(
[sys.executable, "-m", "twine", "check", "--strict", *map(str, artifacts)],
cwd=tmp_path,
check=True,
capture_output=True,
text=True,
)


@pytest.mark.parametrize(
"description",
[
Expand Down
Loading