Elektrine lite

← Feed

@treyhunner@mastodon.social

Post #2626910

2025-07-07 17:07 UTC

@minkiu@mastodon.social @webology@mastodon.social @tsvenson@fosstodon.org @hynek@mastodon.social @brianokken@fosstodon.org @offby1@wandering.shop direnv will set and unset environment variables whenever a directory is entered. So a simple "cd" can be activate a virtual environment automatically for example.

Replies (3)

  • @minkiu@mastodon.social 2025-07-07 17:13

    @treyhunner@mastodon.social right, but if using .venv and uv, then there is no need to activate the virtual env to begin with? As in uv will see the venv and activate it before running right? And the env vars can be set with the flag. I get it direnv might be handy for other stuff, but in this specific workflow feels redundant. @webology@mastodon.social @tsvenson@fosstodon.org @hynek@mastodon.social @brianokken@fosstodon.org @offby1@wandering.shop

    Open ##2626911

  • @webology@mastodon.social 2025-07-07 17:14

    @treyhunner@mastodon.social @minkiu@mastodon.social (letting the others off at the stop) direnv can also call custom commands/scripts when you "cd" into a folder. I think the most important feature is that direnv will *deactivate* or unset ENV variables once you CD out of the folder. This has saved me a ton of grief and was the main driver for why I switched to direnv to manage ENV variables.

    Open ##2626913

  • @tsvenson@fosstodon.org 2025-07-07 18:45

    @treyhunner@mastodon.social @minkiu@mastodon.social @webology@mastodon.social @hynek@mastodon.social @brianokken@fosstodon.org @offby1@wandering.shop There is still a 🥳 in my brain going on from learning about that today in this thread 🤪

    Open ##2626918