Skip to main content

Comprehensive virtual environment management tool

Project description

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, or python with automatic fallback
  • Smart Activation: Activate environments with directory mapping for auto-activation
  • Package Management: Install, uninstall, update, and search packages using uv or pip
  • 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 environment
  • ve activate <name> - Activate a virtual environment
  • ve deactivate - Deactivate current virtual environment
  • ve list - List all virtual environments
  • ve delete <name> - Delete a virtual environment
  • ve info - Show current virtual environment info
  • ve which <name> - Show path to virtual environment

Package Management

  • ve install <pkg>... - Install packages in active venv
  • ve installed - List installed packages in active venv
  • ve uninstall <pkg>... - Uninstall packages from active venv
  • ve search <pkg> - Search for packages on PyPI
  • ve update <pkg>... - Update packages in active venv
  • ve run <cmd>... - Run command in active venv

History & Auto-Activation

  • ve history - Show directory → environment mappings
  • ve clear-history - Clear all atv history
  • atv <name> - Activate with directory mapping (alias for ve activate)

Utility Commands

  • create_env <name> - Alternative create command
  • install_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

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Author

anhvth5

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyve-1.0.1.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyve-1.0.1-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file pyve-1.0.1.tar.gz.

File metadata

  • Download URL: pyve-1.0.1.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for pyve-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ba947648a79c8f6d997f1c34e6c4d3efae4269029cd187891b3e5d2738e6bb5f
MD5 b01aa2bfef04881af9f6feb4bb822764
BLAKE2b-256 68b94acbf3b805879864a981a8c2de3f2e96ab14dd0d14802416bee4df8e3fe9

See more details on using hashes here.

File details

Details for the file pyve-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyve-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for pyve-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 626a0cf4c2ad2d785e1274c6a052df5d28e347fd84490157a0106e8874af35f1
MD5 925cf4380441fda9b37d01bdb6777916
BLAKE2b-256 edc6e70352a8132a698a58445021f9730a86156436d0ab7036b858ef00143b31

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page