Replace hardcoded version with release tag-based versioning - #7
Merged
Conversation
- pyproject.toml: switch to dynamic = ["version"] so maturin reads from Cargo.toml - release.yml: add step to patch Cargo.toml version from the git tag (GITHUB_REF_NAME) before building wheels and sdist - __init__.py: use importlib.metadata.version() instead of hardcoded string https://claude.ai/code/session_01VuQFDGxWFdbVyvxRiNiftQ
There was a problem hiding this comment.
Pull request overview
This PR switches rustypca to tag-driven, single-source versioning by deriving the Python package version from Cargo.toml (via maturin) and ensuring release builds patch Cargo.toml from the Git tag.
Changes:
- Make
pyproject.tomlversion dynamic so maturin reads the version fromCargo.toml. - Update the GitHub release workflow to set
Cargo.toml’s version fromGITHUB_REF_NAMEbefore building wheels/sdist. - Replace the hardcoded
__version__withimportlib.metadata.version()lookup at runtime.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
rustypca/__init__.py |
Uses package metadata to populate __version__ instead of a hardcoded string. |
pyproject.toml |
Switches to dynamic = ["version"] to source version from maturin/Cargo. |
.github/workflows/release.yml |
Patches Cargo.toml version from the release tag prior to building/publishing artifacts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Owner
Author
|
@claude Fix comments that copilot pointed out |
Add a version input to workflow_dispatch so manual runs can supply an explicit version. Fall back to the git tag name when triggered by a push. Validate the resolved value against a semver regex and fail early with a clear message rather than silently writing an invalid version into Cargo.toml. https://claude.ai/code/session_01VuQFDGxWFdbVyvxRiNiftQ
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.
https://claude.ai/code/session_01VuQFDGxWFdbVyvxRiNiftQ