https://github.com/kunihiros/ve_manager
vertual env managing script
https://github.com/kunihiros/ve_manager
Last synced: 26 days ago
JSON representation
vertual env managing script
- Host: GitHub
- URL: https://github.com/kunihiros/ve_manager
- Owner: KunihiroS
- License: mit
- Created: 2024-09-03T06:38:44.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-24T13:57:01.000Z (5 months ago)
- Last Synced: 2025-09-14T23:02:06.199Z (26 days ago)
- Language: Shell
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Virtual Environment Management Script (ve)
## Version
1.0.0
## Overview
The `ve` script is a command-line tool designed to simplify the management of Python virtual environments (venv) and Conda environments. It allows for easy activation of the nearest virtual environment and deactivation of all active virtual environments.
## Features
- Automatically detects and activates the nearest virtual environment (venv or Conda)
- Deactivates all active virtual environments at once
- Supports multiple nested virtual environments
- Provides detailed error handling and logging
- Includes a debug mode for troubleshooting
- Includes a help option for quick reference## Installation
1. Clone this repository:
2. Make the script executable:
```bash
chmod +x ve.sh
```3. Move the script to a directory in your PATH (e.g., ~/.local/bin):
```bash
mkdir -p ~/.local/bin
mv ve.sh ~/.local/bin/ve
```4. Ensure `~/.local/bin` is in your PATH. Add the following line to your `~/.bashrc` (or your shell's configuration file) if it's not already there:
```bash
export PATH="$HOME/.local/bin:$PATH"
```5. Add the following function to your `~/.bashrc` (or your shell's configuration file):
```bash
ve() {
case "$1" in
act|deact)
source ~/.local/bin/ve "$@"
;;
*)
~/.local/bin/ve "$@"
;;
esac
}
```6. Reload your shell configuration:
```bash
source ~/.bashrc
```7. Rename ve files
Change the file name from "ve.sh" to "ve" (Just remove .sh).
The `ve` command should now be globally available.
## Usage
### Activate a Virtual Environment
To activate the nearest virtual environment in the current or parent directories:
```bash
ve act
```### Deactivate All Virtual Environments
To deactivate all active virtual environments:
```bash
ve deact
```## Notes
- This script runs in bash. Adjustments may be needed for other shells.
- The script handles nested virtual environments and will activate the nearest one.
- For Conda environments, ensure Conda is properly installed and initialized.## Troubleshooting
- If the script doesn't work, verify that `~/.local/bin` is in your PATH.
- For permission issues, run `chmod +x ~/.local/bin/ve` to ensure the script is executable.
- For Conda environment issues, check if `conda init` has been properly executed.
- Use the debug mode (`ve --debug act` or `ve --debug deact`) to get more information about what the script is doing.## Contributing
Please use the GitHub Issue tracker for bug reports and feature requests. Pull requests are welcome.
## License
This script is released under the [MIT License](LICENSE).