omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Complete Guide for Python venv setup

Open vitalune opened this issue 9 months ago • 3 comments

System details

Omarchy 3.3.3, Linux 6.18.3, Hyprland 0.53.1, Alacritty 0.16.1

What's wrong?

Python Virtual Environment Setup for Omarchy

Closes/Related to #3156

Omarchy's Starship prompt overrides Python's default venv indicator, and the activation script returns exit code 1 (showing ✗ instead of ❯). this really bothered me as a python dev so i configured my own setup and decided to share it here.

Quick Setup

1. Add Python module to Starship

Edit ~/.config/starship.toml:

# Add $python to your format line:
format = "[$directory$git_branch$git_status$python]($style)$character"

# Add at end of file:
[python]
symbol = "🐍 "
pyenv_version_name = true
format = 'via [${symbol}${pyenv_prefix}(${version} )(\($virtualenv\) )]($style)'
style = "bold yellow"
pyenv_prefix = "pyenv "
python_binary = ["python3", "python", "python2"]
detect_extensions = ["py"]
detect_files = [".python-version", "Pipfile", "pyproject.toml", "requirements.txt", "setup.py", "tox.ini"]
detect_folders = []
disabled = false

2. Add helpers to ~/.bashrc

# Create venv with fixed exit code
mkv() {
    python -m venv .venv && \
    echo -e "\nreturn 0" >> .venv/bin/activate && \
    echo "✓ Created .venv"
}

# Smart activation (prevents double-activation)
alias va='[ -z "$VIRTUAL_ENV" ] && source .venv/bin/activate || echo "Already active: $VIRTUAL_ENV"'

3. Reload shell

source ~/.bashrc

Usage

mkv        # Create venv
va         # Activate
deactivate # Deactivate

Result

# Before
[folder-name] main ✗           # No indicator, wrong symbol

# After  
[folder-name] main (.venv) ❯   # Clear indicator, correct symbol

Demo

Image

vitalune avatar Feb 03 '26 23:02 vitalune

How exactly is this a bug that needs fixing? A post in the discussions tab would be more useful

sean-imus avatar Feb 04 '26 11:02 sean-imus

Lifesaver! Thank you for sharing this. I agree that it'd be nice if Omarchy implemented something like this, or stopped using Starship or something. Starship's default behavior of obscuring the venv is very different from what Python developers would expect.

reniep avatar Feb 10 '26 03:02 reniep

This is great but @sean-imus is right, this should probably be moved over to the discussions tab so as to not drown out people that might actually need help with something

Mrid22 avatar Feb 10 '26 06:02 Mrid22