Autopy.fish
A Fish Shell plugin that automatically activates a Python virtual environment (venv, UV or Poetry) when entering a project directory. Deactivates the previous one if needed. Works with pyproject.toml or .venv – no manual switching required.
Install / Use
/learn @SpaceShaman/Autopy.fishREADME
autopy.fish
A Fish Shell plugin that automatically activates a Python virtual environment (venv, UV or Poetry) when you cd into a project directory. If another environment was previously activated by autopy.fish, it will be deactivated.
If a virtual environment is activated by other means (e.g. by explicitly running source {venv_path}/bin/activate.fish), autopy.fish will do nothing until this environment is deactivated.
Features
- 🔁 Auto-activation of venv, UV or Poetry environments
- 🔻 Automatic deactivation of previously active environments
- 🐟 Lightweight and runs on every directory change
- 🧠 Detects
.venvorpyproject.tomlin project root - 🐙 Supports Git repositories (uses repo root as project dir)
Installation
With Fisher
fisher install SpaceShaman/autopy.fish
With reef
reef install SpaceShaman/autopy.fish
Manually
Copy autopy.fish to your ~/.config/fish/conf.d/ directory.
Experimental async version
The default behavior of autopy.fish is blocking—the fish prompt is displayed only after all necessary computations are performed. This might be too distracting for some users, especially users of poetry, which is known to not be particularly fast.
Async version of autopy.fish is available in branch experimental and uses fish-async-prompt. Install with
fisher install SpaceShaman/autopy.fish@experimental
fisher install acomagu/fish-async-prompt
or
reef install SpaceShaman/autoenv.fish@experimental
reef install acomagu/fish-async-prompt
and put the following into your config.fish:
set -g async_prompt_functions autopy
set -g async_prompt_inherit_variables all
