direnv¶
direnv loads per-project environment variables as you enter and leave directories. In this repo it is initialized from Zsh, while prompt display is handled by Starship.
- Helper file:
~/.config/direnv/direnvrc(chezmoi source:dot_config/direnv/direnvrc) - Zsh init:
~/.config/zsh/tools/30_direnv.zsh - Prompt:
~/.config/starship.tomlvia Starship's[python]module
Python .venv helper¶
This repo provides layout_python_venv [venv_dir=.venv].
- Activates an existing virtual environment directory
- Does not auto-create
.venv - Delegates activation to
layout python3 - Watches the venv marker files so creating
.venvlater triggers a reload on the next prompt
Recommended .envrc¶
Then allow it once per project:
You can target a non-default virtual environment directory if needed:
Behavior Notes¶
- Equivalent for daily use:
VIRTUAL_ENV,PATH, andPYTHONHOMEhandling come from direnv's built-inlayout python3 - Not fully equivalent to
source .venv/bin/activate: nodeactivate()shell function and no directPS1rewriting - Prompt display still works because Starship reads
VIRTUAL_ENVand shows the active environment name - Leaving the directory automatically restores the previous environment