Skip to content

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.

License

Notifications You must be signed in to change notification settings

SpaceShaman/autopy.fish

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 

Repository files navigation

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 .venv or pyproject.toml in project root
  • 🐙 Supports Git repositories (uses repo root as project dir)

Installation

With Fisher

fisher install SpaceShaman/autopy.fish

With reef

reef install SpaceShaman/autoenv.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

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages