feat: add --version flag to CLI #39
Merged
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.
Summary
Implements
hatch --versioncommand to display the Hatch application version following modern Python best practices.Changes
This PR includes 4 focused commits:
__version__fromhatch/__init__.py--versionflag to CLI argument parserImplementation Details
importlib.metadata.version('hatch')for dynamic version retrieval frompyproject.tomlhatch <version>(e.g.,hatch 0.6.1)-vshort form to avoid conflict with existing package version flagTest Results
✅ 5/5 tests passing (100% pass rate)
test_get_hatch_version_retrieves_from_metadata- Unit test for version retrievaltest_get_hatch_version_handles_package_not_found- Unit test for error handlingtest_version_command_displays_correct_format- Integration test for CLI flowtest_import_hatch_without_version_attribute- Integration test for import safetytest_no_conflict_with_package_version_flag- Regression test for flag conflictsDocumentation Updates
--versionto global options tablehatch --versionBreaking Changes
__version__attribute: Code that relied onhatch.__version__will need to useimportlib.metadata.version('hatch')instead.This establishes
pyproject.tomlas the single source of truth for version information.Implementation Reports
Detailed implementation documentation available in
Laghari/Augment/Cracking_Shells/Hatch/version_command/:Verification
Related Issues
N/A - New feature implementation
Ready for review - All phases complete (Analysis, Test Definition, Implementation, Debugging, Git Commits, Documentation, Knowledge Transfer)
Pull Request opened by Augment Code with guidance from the PR author