feat(status): add status command to show venv information#26
Merged
Conversation
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
enabled auto-merge (squash)
March 28, 2026 10:39
|
🎉 This PR is included in version 2.6.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
This pull request adds a new
statuscommand 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:
status()function insrc/main.rsthat searches for a virtual environment in the current directory or parent directories, displays venv path, Python version frompyvenv.cfg, prompt name, activation status (by checking$VIRTUAL_ENV), and the count of installed packages.count_packages()helper function that counts installed packages by enumerating.dist-infodirectories in the site-packages folder, with cross-platform support for both Unix and Windows directory structures.Testing improvements:
tests/integration.rscovering three scenarios: displaying venv info when present, exiting with error when no venv exists, and finding venv in parent directories when run from subdirectories.