Versioning and Release Management¶
This project uses automatic version management powered by Git tags and setuptools_scm. The version is dynamically generated during installation and build processes.
Key Features¶
Automatic Versioning: Version derived from Git tags (e.g.,
v1.2.3→1.2.3)Development Versions: Unreleased commits show as
1.2.4.dev1+gabcdef12(includes commit ID by default)CI/CD Integration: GitHub Actions validate version-tag alignment
Semantic Versioning: Enforces proper version format in tags
Customizable Local Scheme: Control how development versions are formatted (e.g., include/exclude commit ID)
Fallback Version:
0.0.0(if no tags exist)
Creating Releases¶
# Create annotated tag
git tag -a v0.0.2 -m "Release version 0.0.2"
git push --tags
# Verify version
uv run python -c "import py_launch_blueprint; print(py_launch_blueprint.__version__)"
Daily Development with Version Management¶
# Install with development dependencies
uv pip install --editable ".[dev]"
# Check current version
uv run python -c "import py_launch_blueprint; print(py_launch_blueprint.__version__)"
# Build package
hatch build
Customizing Development Versions¶
The format of development versions can be customized using the local_scheme option in pyproject.toml. By default, the commit ID is included (e.g., 1.2.4.dev1+gabcdef12). To change this behavior:
Example: Remove Commit ID¶
[tool.hatch.version.raw-options]
local_scheme = "no-local-version" # Excludes commit ID
Output:
1.2.4.dev1
Example: Include Commit ID and Date¶
[tool.hatch.version.raw-options]
local_scheme = "node-and-date" # Include commit ID and date
Output:
1.2.4.dev1+gabcdef12.d20231025
Common local_scheme Options¶
Scheme |
Example Output |
Description |
|---|---|---|
|
|
No commit ID or dirty flag |
|
|
Commit ID and date |
|
|
Commit ID and timestamp |
|
|
Commit ID and dirty flag |
|
|
Commit ID only |
CI/CD Automation¶
The pre-configured GitHub Actions workflow (release.yml) ensures a robust release process. Here’s how it works:
Workflow Steps¶
Trigger: Pushing a tag (e.g.,
v1.0.0) triggers the workflow.Checkout: The repository is checked out with full Git history (
fetch-depth: 0) to enablesetuptools_scmversion detection.Setup:
Installs
uvfor fast dependency management.Sets up Python using the specified version.
Build:
Installs build tools (
hatchandbuild).Builds the package using
hatch build.
Version Validation:
Extracts the version from the Git tag (e.g.,
v1.0.0→1.0.0).Compares it with the package version generated by
setuptools_scm.Fails if there’s a mismatch.
Output:
If successful, the built distributions are available in the
dist/directory.
Troubleshooting Versions¶
Version Issues¶
Version shows 0.0.0: Create initial Git tag (
v0.1.0).Version mismatch in CI: Ensure GitHub Actions uses
fetch-depth: 0.Dirty version suffix: Commit all changes before tagging.
Missing commit ID: Check the
local_schemesetting inpyproject.toml.
Workflow Issues¶
Workflow not triggered: Ensure the tag follows the
v*format (e.g.,v1.0.0).Build failures: Check the
pyproject.tomlconfiguration and dependencies.