Open
Conversation
Co-authored-by: SwarnenduG07 <141937171+SwarnenduG07@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add CLI command to check version of Contextinator
Add --version/-v CLI flag
Feb 5, 2026
SwarnenduG07
approved these changes
Feb 5, 2026
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="src/contextinator/cli.py">
<violation number="1" location="src/contextinator/cli.py:9">
P2: Importing `__version__` from the package `__init__` triggers heavy module imports; `--version` should avoid loading chunking/embedding/vectorstore modules. Import the version directly (e.g., from the generated `_version.py`) with a fallback instead.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| import os | ||
| from .chunking import chunk_repository | ||
| from .config import get_storage_path | ||
| from . import __version__ |
There was a problem hiding this comment.
P2: Importing __version__ from the package __init__ triggers heavy module imports; --version should avoid loading chunking/embedding/vectorstore modules. Import the version directly (e.g., from the generated _version.py) with a fallback instead.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/contextinator/cli.py, line 9:
<comment>Importing `__version__` from the package `__init__` triggers heavy module imports; `--version` should avoid loading chunking/embedding/vectorstore modules. Import the version directly (e.g., from the generated `_version.py`) with a fallback instead.</comment>
<file context>
@@ -6,6 +6,7 @@
import os
from .chunking import chunk_repository
from .config import get_storage_path
+from . import __version__
</file context>
Suggested change
| from . import __version__ | |
| try: | |
| from ._version import version as __version__ | |
| except ImportError: | |
| __version__ = "0.0.0+unknown" |
Collaborator
|
I doubt this won't work; since we're using We decide to like manually to update the version in our system too. |
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.
Adds version checking via
contextinator --versionorcontextinator -v. Version is sourced from setuptools-scm, which generates it from git tags during build.Changes
__version__from package__init__.py--version/-vargument withaction="version"to argparseBehavior
Development builds show
0.0.0+unknownwhen no git tag is present. Release builds automatically display the tag version via setuptools-scm'swrite_todirective inpyproject.toml.Original prompt
version#52💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
Summary by cubic
Adds a CLI command to print the installed Contextinator version: contextinator --version and contextinator -v.
Written for commit 0437e10. Summary will update on new commits.