Shell
Shell integration commands and initialization.
init
Initialize uvup shell integration.
Usage
bash
# Automatic setup - initialize all detected shells
uvup init
# Initialize specific shell
uvup init <shell>
# Options
uvup init --raw # Print shell script instead of installing
uvup init --reverse # Remove uvup initialization
uvup init --dry-run # Preview changes without modifying filesSupported Shells
| Platform | Auto-detected Shells |
|---|---|
| Windows | PowerShell, Git Bash |
| macOS | Bash, Zsh, Fish |
| Linux | Bash, Zsh, Fish |
Examples
bash
# Automatically configure all detected shells
uvup init
# Initialize only PowerShell
uvup init powershell
# Initialize only Bash
uvup init bash
# Preview what would be changed
uvup init --dry-run
# Remove shell integration
uvup init --reverse
# Get raw shell script for manual setup
uvup init --rawWhat It Does
Automatic mode (uvup init):
- Detects all installed shells on your system
- Adds initialization code to each shell's configuration file
- Creates configuration files if they don't exist
Configuration files modified:
| Shell | File |
|---|---|
| Bash | ~/.bashrc (also creates ~/.bash_profile on Windows) |
| Zsh | ~/.bashrc |
| Fish | ~/.config/fish/config.fish |
| PowerShell | $PROFILE |
Manual mode (uvup init --raw):
- Prints the shell hook script for the current shell
- Useful for custom setups or CI/CD environments
After Running
You need to reload your shell configuration:
bash
# Bash
source ~/.bashrc
# Zsh
source ~/.zshrc
# Fish
source ~/.config/fish/config.fish
# PowerShell
# Just restart your terminalOr simply restart your terminal.
Notes
- Run once after installation
- Safe to run multiple times (idempotent)
- Uses marked sections in config files for easy removal
- Doesn't modify existing configuration
activate
Activate a virtual environment.
Usage
bash
uvup activate <name>Arguments
<name>- Environment name to activate
Examples
bash
uvup activate myprojectWhat It Does
- Checks if the environment exists
- Activates the
.venvwithin the environment - Modifies shell prompt to show environment name
- Enables package commands
Effects
After activation:
- Shell prompt shows
(myproject) pythonpoints to environment's Pythonpipand other tools use environment's packages- Package commands (
add,remove,lock,tree) are enabled - Works from any directory
Notes
- Requires
uvup initto be set up first - Only one environment can be active at a time
- Activating a new environment automatically deactivates the current one
deactivate
Deactivate the current virtual environment.
Usage
bash
uvup deactivateExamples
bash
uvup deactivateWhat It Does
- Deactivates the current virtual environment
- Restores original shell prompt
- Restores original PATH
- Disables package management commands
Effects
After deactivation:
- Shell prompt returns to normal
pythonpoints to system Python- Package commands will fail with "No active environment" error
Notes
- Requires
uvup initto be set up first - Safe to run even if no environment is active
- Does not delete or modify the environment