pyruve

Crates.iopyruve
lib.rspyruve
version0.1.0
sourcesrc
created_at2023-12-08 22:03:02.912792
updated_at2023-12-08 22:03:02.912792
descriptionActivate python virtual environment on directory change
homepage
repositoryhttps://github.com/insomnes/pyruve/
max_upload_size
id1062432
size11,828
Mikhail Dengin (insomnes)

documentation

README

pyruve

Tool to automatically activate your python virtual environment inside project folder.

Supported shells:

  • bash
  • fish
  • zsh

Install

You will need cargo:

cargo install pyruve

Add $HOME/.cargo/bin to your path.

bash

Add to your .bashrc (commonly in $HOME/.bashrc):

eval "$(pyruve shell bash)"

fish

Add to your config.fish (commonly in $HOME/.config/fish/config.fish):

pyruve shell fish | source

zsh

Add to your .zshrc (commonly in $HOME/.zshrc):

eval "$(pyruve shell zsh)"

How it works?

Binary will return specific command on new instances of shell or change directory based on current venv status.

No venv is active

If you have any of: venv,.venv subdirs with available bin/activate script => it will be activated. Dir list is configurable by PYRUVE_VENV_DIRS env var, list should be delimited by commas like:

venv,.venv,virtenv,.virtenv

It will also try to search combinations of projectdir-{iter of venv dirs} or projectdir_{iter of venv dirs} like pyruve-venv or pyruve_virtenv. This can be disabled via PYRUVE_COMBINE_DIRS env var with any value except:

"true" | "t" | "1" | "on"

Delimiters are configured via PYRUVE_DELIMITERS env var, list should be delimited by commas like:

-,_

Venv is active

Going to any child of directory which contains active virtual environment dir will not lead to deactivation. Only parent or completely another dir in tree will cause deactivation. Going to dir with new virtual environment available will also cause activation of new virtual environment.

Commit count: 1

cargo fmt