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.
- 🔁 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)
With Fisher
fisher install SpaceShaman/autopy.fishWith reef
reef install SpaceShaman/autoenv.fishCopy autopy.fish to your ~/.config/fish/conf.d/ directory.
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-promptor
reef install SpaceShaman/autoenv.fish@experimental
reef install acomagu/fish-async-promptand put the following into your config.fish:
set -g async_prompt_functions autopy
set -g async_prompt_inherit_variables all