Skip to content

Conversation

@jensens
Copy link
Member

@jensens jensens commented Oct 31, 2025

Summary

Adds a --version command-line option to display the current mxdev version.

Changes

  • Added version import: Import __version__ from auto-generated _version.py with graceful ImportError fallback
  • Added --version argument: Standard argparse action="version" pattern
  • Added comprehensive tests:
    • test_parser_version(): Verifies --version prints version and exits with code 0
    • test_version_format(): Validates version string format and semantic versioning
  • Updated CHANGES.md: Documented new feature

Example Usage

$ mxdev --version
mxdev 5.0.1

# Development versions show full git info
$ mxdev --version
mxdev 5.0.1.dev27+g62877d7

Testing

  • ✅ All 194 tests pass (192 existing + 2 new)
  • ✅ All linting checks pass (ruff, isort, mypy)
  • ✅ Manual testing confirmed correct output

Implementation Details

The version is automatically derived from git tags via hatch-vcs during build (configured in pyproject.toml). The _version.py file is auto-generated and excluded from version control.

For development/non-installed environments, the version gracefully falls back to "unknown (not installed)".

Adds a --version flag that displays the current mxdev version.
The version is automatically derived from git tags via hatch-vcs
during build.

Changes:
- Import __version__ from auto-generated _version.py with ImportError fallback
- Add --version argument to argparse parser
- Add comprehensive test cases:
  - test_parser_version(): verifies --version prints version and exits cleanly
  - test_version_format(): validates version string format
- Update CHANGES.md with feature documentation

Example usage:
$ mxdev --version
mxdev 5.0.1

All 194 tests pass (192 existing + 2 new version tests).
@jensens jensens marked this pull request as ready for review October 31, 2025 22:01
@jensens jensens merged commit acf481e into main Oct 31, 2025
17 checks passed
@jensens jensens deleted the feature/version-option branch October 31, 2025 22:01
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.

2 participants