What does HackerNews think of direnv?

unclutter your .profile

Language: Go

#24 in Bash
#29 in Shell
venv is a bundled virtualenv subset. It came after it. Now you don't need to install virtualenv since venv comes bundled with python. Don't concern yourself.

pyenv, poetry are wrappers and do different things.

You would use pyenv to create a virtual environment. Or venv directly. Or the older virtualenv tool. Stick to pyenv as it is easiest.

You can setup your shell to activate/deactivate automagically for you when you cd into your project directory using something like: https://github.com/direnv/direnv

I would avoid poetry.

Edit: bah, somebody answered already

tl;dr - Setup direnv and pyenv once and foggetaboutit.

This comment made me wonder if there's a tool out there akin to ~~autoenv~~ direnv [1], but that automatically activates a virtual environment when you cd into a directory with e.g., a poetry.lock.

Surprisingly, it seems like the answer today is no. But there's a little bash snippet that wraps cd to give us a start [2]. But just dropping `poetry shell` in an `.envrc` for direnv is better than nothing too.

[1]: https://github.com/direnv/direnv

[2]: https://stackoverflow.com/a/50830617/149428

Another way to do this is to install Nix and direnv (and/or Emacs direnv-mode), then include a `use nix` statement in the .envrc file inside your project root.

Then, when you `cd` into your project directory, your environment with all its dependencies appears.

However, there are some downsides to this magical future tech:

+ Nix is hard to learn.

+ Not compatible with the standard environment managers for each language.

https://github.com/direnv/direnv https://nixos.org/nix/

https://github.com/direnv/direnv very Important for me, to load envs