https://github.com/spaceshaman/autopy.fish
A Fish Shell plugin that automatically activates a Python virtual environment (venv or Poetry) when entering a project directory. Deactivates the previous one if needed. Works with pyproject.toml or .venv – no manual switching required.
https://github.com/spaceshaman/autopy.fish
fish fish-plugin fish-shell fisher poetry poetry-python python venv venv-python
Last synced: 5 months ago
JSON representation
A Fish Shell plugin that automatically activates a Python virtual environment (venv or Poetry) when entering a project directory. Deactivates the previous one if needed. Works with pyproject.toml or .venv – no manual switching required.
- Host: GitHub
- URL: https://github.com/spaceshaman/autopy.fish
- Owner: SpaceShaman
- License: mit
- Created: 2025-07-12T08:58:18.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2025-07-12T09:18:40.000Z (6 months ago)
- Last Synced: 2025-07-12T11:37:36.284Z (6 months ago)
- Topics: fish, fish-plugin, fish-shell, fisher, poetry, poetry-python, python, venv, venv-python
- Language: Shell
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# autopy.fish
A [Fish Shell](https://fishshell.com/) plugin that automatically activates a Python virtual environment ([venv](https://docs.python.org/3/library/venv.html) or [Poetry](https://python-poetry.org/)) when you `cd` into a project directory. If another environment is already active, it will be deactivated.
## Features
- 🔁 Auto-activation of [venv](https://docs.python.org/3/library/venv.html) or [Poetry](https://python-poetry.org/) 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](https://github.com/jorgebucaran/fisher)
```fish
fisher install SpaceShaman/autopy.fish
```
### Manually
Copy `autopy.fish` to your `~/.config/fish/conf.d/` directory.
## Usage tip
If you want the virtual environment to be activated automatically every time you start a new shell (even in terminals spawned from within other tools like Vim), add the following line to your `config.fish`:
```fish
autopy
```
This ensures the environment is activated right after shell startup, not just when changing directories.