-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(core): use pyproject.toml as single source of truth for version (#248) #249
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
Merged
dan-petty
merged 3 commits into
release/v0.2.20
from
refactor/pyproject-version-single-source
Sep 18, 2026
+112
−39
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
34 changes: 34 additions & 0 deletions
34
docs/agent/tasks/task-248-pyproject-version-single-source.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # Task 248: Use pyproject.toml as Single Source of Truth for Version | ||
|
|
||
| **Issue**: [#248](https://github.com/dan-petty/devops-cli/issues/248) | ||
| **PR**: [#249](https://github.com/dan-petty/devops-cli/pull/249) | ||
| **Status**: In Review | ||
| **Milestone**: `v0.2.20` | ||
| **Priority**: `priority/p1-high` | ||
| **Scope**: `scope/cli`, `scope/config` | ||
|
|
||
| --- | ||
|
|
||
| ## 1. Description & Objectives | ||
|
|
||
| The application version was duplicated in multiple locations across the codebase, notably hardcoded as `__version__ = "0.2.20"` in `src/devops_cli/__init__.py`, `version="0.1.11"` in `src/devops_cli/config/metadata.py`, and `return "0.1.0"` in `src/devops_cli/telemetry/tracer.py`. This required synchronized manual edits or release automation rewriting across multiple files on every version increment, risking divergence. | ||
|
|
||
| This refactor establishes `pyproject.toml` as the single authoritative source of truth for the application version, with `src/devops_cli/__init__.py` dynamically loading the version via `devops_cli.config.metadata.get_version()`. | ||
|
|
||
| #### Key Deliverables: | ||
| 1. **Dynamic Version Initialization ([`src/devops_cli/__init__.py`](file:///workspaces/devops-cli/src/devops_cli/__init__.py))**: | ||
| - Initialize `__version__` from `get_version()` (derived from `pyproject.toml` with `load_project_metadata()`). | ||
| - Maintain public API exports (`__version__`, `get_version`, etc.). | ||
| 2. **Release Engine Compatibility ([`src/devops_cli/commands/release.py`](file:///workspaces/devops-cli/src/devops_cli/commands/release.py))**: | ||
| - Ensure `_get_init_version` returns `pyproject.toml` version when `__init__.py` uses dynamic derivation. | ||
| - Ensure `_update_init_version` detects dynamic derivation and returns `True` without modifying `__init__.py`. | ||
| - Ensure `_update_pyproject_version` invalidates `load_project_metadata.cache_clear()` upon updating version. | ||
| 3. **Clean Up Stale Version Fallbacks ([`src/devops_cli/config/metadata.py`](file:///workspaces/devops-cli/src/devops_cli/config/metadata.py), [`src/devops_cli/telemetry/tracer.py`](file:///workspaces/devops-cli/src/devops_cli/telemetry/tracer.py))**: | ||
| - Update `_DEFAULT_METADATA.version` in `metadata.py` to `"0.0.0"`. | ||
| - Update fallback in `tracer.py` to `"0.0.0"`. | ||
| 4. **Test Suite Standardization ([`tests/test_instruction_generator.py`](file:///workspaces/devops-cli/tests/test_instruction_generator.py), [`tests/test_release.py`](file:///workspaces/devops-cli/tests/test_release.py))**: | ||
| - Replace hardcoded `version="0.2.20"` in `test_instruction_generator.py` with `__version__`. | ||
| - Add unit test verifying release commands properly handle dynamically versioned `__init__.py`. | ||
| 5. **Quality & Architectural Invariant Gates**: | ||
| - Strictly enforce cyclomatic complexity $\le 10$ and nesting depth $\le 5$. | ||
| - 100% passing across all 10 CI quality gates (`uv run devops ci`). |
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.