Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/setuptools scm uv hatch #29

Merged
merged 20 commits into from
Feb 9, 2025

Conversation

habeshaethiopia
Copy link
Contributor

@habeshaethiopia habeshaethiopia commented Jan 31, 2025

Automated Version Management and CI/CD Enhancement

Summary

This PR introduces automatic version management using Git tags and establishes a robust CI/CD pipeline. Key improvements include:

  • 🔄 Automatic Semantic Versioning via setuptools_scm
  • 🚀 Release Automation with GitHub Actions
  • 🔍 Version-Tag Consistency Enforcement
  • 📚 Documentation for versioning workflows
  • 🧩 Hatch Build System Integration

Key Features

Version Management

  • Implemented dynamic versioning using setuptools_scm
  • Added hatch configuration for build system integration
  • Created GitHub Actions workflow for release validation
  • Set up automatic version file generation
[tool.setuptools_scm]
write_to = "py_launch_blueprint/_version.py"
fallback_version = "0.0.0"

CI/CD Pipeline

name: Release
on:
  push:
    tags: ['v*']
jobs:
  publish:
    steps:
      - name: Verify version matches tag
        run: |
          TAG_VERSION=${GITHUB_REF#refs/tags/v}
          PY_VERSION=$(uv run python -c "import py_launch_blueprint; print(...)")
          [ "$TAG_VERSION" = "$PY_VERSION" ] || exit 1

Documentation Update

  • Added versioning workflow section to README
  • Created troubleshooting guide for common version issues
  • Documented release process for maintainers

Migration Notes

For Contributors:

  1. Use annotated tags for releases:
    git tag -a v1.2.3 -m "Feature release"
    git push --tags
  2. Install with development dependencies:
    uv pip install --editable ".[dev]"
  3. Verify versions locally:
    hatch version && python -c "import py_launch_blueprint; print(...)"

Validation

Test Case Method Result
Tag-based Versioning git tag v0.1.0 && hatch build ✅ 0.1.0
Development Version Post-commit check ✅ 0.1.1.dev1
CI Version Matching GitHub Actions workflow ✅ Pass
Fallback Version Fresh clone (no tags) ✅ 0.0.0

Checklist

  • Tested version generation from tags
  • Verified CI workflow success
  • Updated documentation

Resolves: #16 (if applicable)

README.md Outdated
@@ -250,20 +303,6 @@ def process(handler: Handler) -> None:
...
```

## Recommended Extensions
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this because it is duplicated

Copy link
Owner

@smorin smorin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you redo the README.md from the latest README.md? Also please consolidate as much of the documentation as possible into a single section.

Also can you explain the release.yml github action and when , how it's supposed to be used and what should be changed when used as a template for a new project.

@habeshaethiopia
Copy link
Contributor Author

I edited the readme and make my documentation in a single section also added how the release.yml file works (how and when)

@smorin smorin merged commit 5acc9c5 into smorin:main Feb 9, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding version with setuptools_scm + uv + hatch + github actions
2 participants