Skip to content

Add lightweight CLI --version support#357

Open
Leon-Algo wants to merge 2 commits intovolcengine:mainfrom
Leon-Algo:codex/cli-version-output-pr
Open

Add lightweight CLI --version support#357
Leon-Algo wants to merge 2 commits intovolcengine:mainfrom
Leon-Algo:codex/cli-version-output-pr

Conversation

@Leon-Algo
Copy link
Copy Markdown

@Leon-Algo Leon-Algo commented Mar 28, 2026

Description

Add a top-level opencontext --version flag that prints the installed package version and exits successfully. The CLI now keeps that path lightweight by lazily importing FastAPI/Uvicorn and other runtime web pieces, while preserving the legacy opencontext.cli:app entrypoint through a lazy compatibility shim. The Uvicorn import-string targets also switch to the app factory so multi-worker and reload flows continue to work with lazy app construction.

Closes: #359

Test Plan

  • python3 -m unittest tests.test_cli_version -v
  • python3 -m unittest discover -s tests -v
  • python3 -m compileall opencontext tests
  • python3 -m opencontext.cli --version
  • python3 -m opencontext.cli --help
  • python3 -c "import opencontext.cli as c; print(type(c.app).__name__)"

@Leon-Algo Leon-Algo closed this Apr 5, 2026
@Leon-Algo Leon-Algo reopened this Apr 5, 2026
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.

CLI should support a lightweight --version path

1 participant