[META]: Generate package metadata dynamically for PyPI#95
Open
spencrr wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Move RAMPART package metadata generation to Hatchling so release artifacts can produce PyPI-safe metadata without requiring manual README or version edits.
Dynamic README metadata
The source
README.mdnow keeps repository image links relative, while package builds generate PyPI README metadata with raw GitHub image URLs. This keeps the README readable in GitHub and makes images render reliably on PyPI. The build-time README generation uses Hatch’s dynamic metadata hook pattern (Hatch dynamic metadata, custom metadata hooks).Dynamic version metadata
Package versions are now derived from Git tags through Hatch VCS instead of a static
project.versionfield. Release builds get their version from tags likevX.Y.Z; development builds after a tag infer a development version. Local version suffixes such as+g<sha>are omitted for public-package compatibility vialocal_scheme = "no-local-version"(hatch-vcs version source, setuptools-scm local schemes).The release process docs were updated to describe tag-derived versions, relative README image links, and the requirement that release tags be reachable from
mainhistory for expected development-version inference.Package data inclusion
The setuptools-specific prompt inclusion configuration was removed as part of the Hatchling migration:
Hatchling does not use
tool.setuptools.package-data. Instead, it uses Hatch’s file-selection model. With:the wheel target explicitly selects the
rampart/package directory. Hatch documentspackagesas semantically equivalent toonly-include, with package paths rewritten as needed. Selected directories are traversed by default, subject to normal VCS ignore andexcludebehavior.I verified the built wheel directly and confirmed the prompt YAML files are still present:
This preserves the previous package data behavior while removing configuration that only applied to the old setuptools backend. References: Hatch file selection, Hatch
packages, and wheel default file selection.Breaking changes
None. This changes package build metadata generation only; runtime APIs and package contents are unchanged.
Checklist
pre-commit run --all-filespassesVerification
uv lock --check: passesuv run ruff check scripts/hatch_build.py: passesuv run --with build python -m build: passesuv run pytest tests/unit -q: 489 passed+g<sha>suffix, instead.dev{commits_since_tag}