Conversation
- Change __version__: str → __version__: Final[str] in __init__.py per coding guidelines requiring Final for module-level constants - Add shutdown_cycles row to SessionSummary fields table in implementation.md - Add test_version_is_final_str regression test in test_packaging.py Closes #1059 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR addresses two small code-health/documentation gaps in copilot_usage: it makes the public __version__ constant explicitly non-reassignable via Final[str], and documents the existing SessionSummary.shutdown_cycles field in the implementation guide. It also adds a regression test to prevent the annotation from being accidentally removed later.
Changes:
- Annotate
copilot_usage.__version__asFinal[str]. - Document
SessionSummary.shutdown_cyclesindocs/implementation.md’s field table. - Add a packaging regression test asserting the
Final[str]annotation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/copilot_usage/__init__.py |
Updates __version__ typing to Final[str] to match constant conventions. |
src/copilot_usage/docs/implementation.md |
Adds missing shutdown_cycles entry to the SessionSummary fields table. |
tests/test_packaging.py |
Adds a regression test ensuring __version__ remains annotated as Final[str]. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #1059
Changes
1.
__version__missingFinalannotationFile:
src/copilot_usage/__init__.pyChanged
__version__: str→__version__: Final[str]per coding guidelines requiringFinalfor module-level constants that should never be reassigned.Finalwas already imported in the file.2.
SessionSummary.shutdown_cyclesabsent fromimplementation.mdfield tableFile:
src/copilot_usage/docs/implementation.mdAdded the
shutdown_cyclesrow to theSessionSummaryfields table, documenting its type (list[tuple[datetime | None, SessionShutdownData]]) and how it's populated bybuild_session_summary().3. Regression test for
FinalannotationFile:
tests/test_packaging.pyAdded
test_version_is_final_str()which asserts that__version__is annotated asFinal[str]usingtyping.get_originandtyping.get_args, guarding against regression.Warning
The following domains were blocked by the firewall during workflow execution:
astral.shpypi.orgTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.