Skip to content

feat(status): add status command to show venv information#26

Merged
benbenbang merged 1 commit into
mainfrom
feat/uv_shell_status
Mar 28, 2026
Merged

feat(status): add status command to show venv information#26
benbenbang merged 1 commit into
mainfrom
feat/uv_shell_status

Conversation

@benbenbang

Copy link
Copy Markdown
Owner

This pull request adds a new status command that displays detailed information about the current virtual environment, including its location, Python version, activation state, and installed package count. The most important changes are grouped below.

New status command functionality:

  • Added a new status() function in src/main.rs that searches for a virtual environment in the current directory or parent directories, displays venv path, Python version from pyvenv.cfg, prompt name, activation status (by checking $VIRTUAL_ENV), and the count of installed packages.
  • Implemented count_packages() helper function that counts installed packages by enumerating .dist-info directories in the site-packages folder, with cross-platform support for both Unix and Windows directory structures.
  • Integrated the status command into the CLI argument parser with proper help text, and exits with non-zero status code when no venv is found.

Testing improvements:

  • Added comprehensive integration tests in tests/integration.rs covering three scenarios: displaying venv info when present, exiting with error when no venv exists, and finding venv in parent directories when run from subdirectories.

This pull request adds a new `status` command that displays detailed information about the current virtual environment, including its location, Python version, activation state, and installed package count. The most important changes are grouped below.

**New status command functionality:**
* Added a new `status()` function in `src/main.rs` that searches for a virtual environment in the current directory or parent directories, displays venv path, Python version from `pyvenv.cfg`, prompt name, activation status (by checking `$VIRTUAL_ENV`), and the count of installed packages.
* Implemented `count_packages()` helper function that counts installed packages by enumerating `.dist-info` directories in the site-packages folder, with cross-platform support for both Unix and Windows directory structures.
* Integrated the status command into the CLI argument parser with proper help text, and exits with non-zero status code when no venv is found.

**Testing improvements:**
* Added comprehensive integration tests in `tests/integration.rs` covering three scenarios: displaying venv info when present, exiting with error when no venv exists, and finding venv in parent directories when run from subdirectories.
@benbenbang
benbenbang enabled auto-merge (squash) March 28, 2026 10:39
@github-actions github-actions Bot added enhancement New feature or request triage labels Mar 28, 2026
@benbenbang
benbenbang merged commit 07ca4e2 into main Mar 28, 2026
2 checks passed
@benbenbang
benbenbang deleted the feat/uv_shell_status branch March 28, 2026 10:39
@ptah-technical-app

Copy link
Copy Markdown

🎉 This PR is included in version 2.6.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request released triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant