Virtual Environment Manager
A comprehensive Python package for managing virtual environments, providing equivalent functionality to the bash venv.sh script with enhanced features.
Features
- Environment Creation: Create virtual environments using
uv,python3, orpythonwith automatic fallback - Smart Activation: Activate environments with directory mapping for auto-activation
- Package Management: Install, uninstall, update, and search packages using
uvorpip - History Tracking: Track directory-to-environment mappings for automatic activation
- Cross-Platform: Works on Linux, macOS, and Windows with Python 3.7+
Installation
From Source
pip install git+https://github.com/anhvth/uv-virtual-environs-manager
From PyPI (once published)
pip install pyve
Quick Start
# Create a new virtual environment
ve create myproject --python=3.12
# Activate an environment (creates directory mapping)
atv myproject
# List all environments
ve list
# Install packages
ve install requests numpy
# Show environment info
ve info
# Auto-activation: when you cd back to this directory,
# the environment will be suggested for activation
Commands
Main Commands
ve create <name> [options]- Create a new virtual environmentve activate <name>- Activate a virtual environmentve deactivate- Deactivate current virtual environmentve list- List all virtual environmentsve delete <name>- Delete a virtual environmentve info- Show current virtual environment infove which <name>- Show path to virtual environment
Package Management
ve install <pkg>...- Install packages in active venvve installed- List installed packages in active venvve uninstall <pkg>...- Uninstall packages from active venvve search <pkg>- Search for packages on PyPIve update <pkg>...- Update packages in active venvve run <cmd>...- Run command in active venv
History & Auto-Activation
ve history- Show directory → environment mappingsve clear-history- Clear all atv historyatv <name>- Activate with directory mapping (alias forve activate)
Utility Commands
create_env <name>- Alternative create commandinstall_uv- Install uv package manager
Configuration
The package uses the following files for tracking:
~/.venv_all_env- Global environment tracking~/.config/atv_history- Directory-to-environment mappings~/.venvs/- Default location for virtual environments~/.last_venv- Last activated environment
Shell Integration
For full shell integration (auto-activation on directory change), add this to your shell configuration:
Zsh
# Add to ~/.zshrc
eval "$(ve shell-integration zsh)" # Future feature
Bash
# Add to ~/.bashrc
eval "$(ve shell-integration bash)" # Future feature
Auto-Activation
When you use atv <name> to activate an environment, the current directory is mapped to that environment. When you navigate back to that directory later, you'll be reminded to activate the environment.
Examples
# Create a new project environment
ve create myproject --python=3.12
cd /path/to/myproject
# Install dependencies
ve install requests flask pytest
# Later, when you cd back to the project
cd /path/to/myproject
# The tool will remind you about the mapped environment
# View all mappings
# Clean up
ve delete myproject
Differences from Shell Version
- Shell Integration: The Python version can't directly modify the current shell environment. It provides activation commands to run.
- Auto-Activation: Requires shell integration for automatic activation on directory change.
- Browser Opening: Package search opens browser when available.
Development
Local Development
# Clone and install in development mode
git clone <repo-url>
cd virtual_envs_manager
pip install -e .
# Run tests (if available)
python -m pytest
# Type checking
mypy pyve/
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
MIT License - see LICENSE file for details.
Author
anhvth5
Metadata
Release files for pyve 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyve-1.0.1.tar.gz | 17.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyve-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.5 kB
Release files / pyve-1.0.1.tar.gz
| Download URL | pyve-1.0.1.tar.gz |
|---|---|
| Size | 17.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba947648a79c8f6d997f1c34e6c4d3efae4269029cd187891b3e5d2738e6bb5f
|
|
BLAKE2b-256 checksum How to use checksums |
68b94acbf3b805879864a981a8c2de3f2e96ab14dd0d14802416bee4df8e3fe9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.11
|
Release files / pyve-1.0.1-py3-none-any.whl
| Download URL | pyve-1.0.1-py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
626a0cf4c2ad2d785e1274c6a052df5d28e347fd84490157a0106e8874af35f1
|
|
BLAKE2b-256 checksum How to use checksums |
edc6e70352a8132a698a58445021f9730a86156436d0ab7036b858ef00143b31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.11
|