/direnv-venv

Super-tiny script that makes Python's venvs slightly less annoying (one-line creation! and automatic activation!)

Primary LanguageShell

direnv-venv

venvs, but a little less annoying™

direnv-venv preview

This is a super tiny shell script with a function that makes creating and using Python's venvs a little easier. Just run venv and you'll have a venv at .venv within your working directory, plus a .envrc file so that, thanks to the awesome direnv, every time you cd into the directory your venv will automatically be activated. It's pretty snazzy, even if a very minor quality-of-life thing.

Installation

  1. First, make sure that you've installed direnv and hooked it into your shell.

  2. Then, for the actual thing: you can either…

…copy the script to somewhere and add the following line to your .zshrc or .bash_profile or whatever applicable file

source ~/path/to/direnv-venv.sh

or you could be extra cool and use a plugin manager thingy like the really awesome sheldon, which I overenthusiastically love and highly recommend. In that case, add this to ~/.sheldon/plugins.toml:

[plugins.direnv-venv]
github = "jltml/direnv-venv"

Usage

venv

…that's it

I'm just realizing that this README is like three times longer than the function itself… haha