A shell wrapper for UV that provides enhanced virtual environment management.
- Simplified virtual environment creation and activation with a single command
- Automatic environment naming based on project directory and Python version
- Cross-platform support for macOS, Linux, and Windows
- Support for multiple shells (bash, zsh, fish, PowerShell)
Essentially, the way that virtual environment prompt get updated (project_name-python_version) is very simple.
It just needs to add the following line to your ./.venv/pyvenv.cfg file:
prompt = "({project_name}-{python_version})"
This is a manual setup, but it's very simple and works well.
This repository is for the uv-shell.sh script, which aims for a more automated setup.
- Ensure you have uv installed
- Clone this repository or download
uv-shell.sh - Add it to your shell configuration:
# In your .bashrc, .zshrc, or equivalent:
source /path/to/uv-shell.shRun the uv shell command in any project directory:
$ cd your-project
$ uv shellThis will:
- Create a virtual environment (
.venv) if it doesn't exist - Set the prompt to include the project name and Python version
- Activate the environment in a new shell session
To exit the virtual environment, press Ctrl+D or type exit.
The script implements a wrapper around the standard uv command that:
- Intercepts the
shellsubcommand to provide enhanced functionality - Passes all other subcommands directly to the original
uvcommand - Handles platform-specific configuration for different operating systems and shells
See the LICENSE file for details.