Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activate python venv by default? #1264

Open
AwesomeDog opened this issue Apr 2, 2024 · 2 comments
Open

Activate python venv by default? #1264

AwesomeDog opened this issue Apr 2, 2024 · 2 comments
Labels

Comments

@AwesomeDog
Copy link

Is your feature request related to a problem? Please describe.
sourcing .envrc files goes fine. But activating python virtualenv requires tedious work.
As far as I have searched, one has to define it in the .envrc file, or something.

Describe the solution you'd like
when the directory has ./venv/bin/activate file, then activate it by default, without any configuration.
and deactivate when leaves the directory.

Describe alternatives you've considered

Additional context

@steinybot
Copy link

Have you read https://github.com/direnv/direnv/wiki/Python?

You just need to put this in .envrc:

layout python

Then it will create the virtual environment within .direnv/python-$python_version (not ./venv like you might be used to)

@brunns
Copy link

brunns commented May 13, 2024

And you can override the name of the virtual environment to .venv if you like:

export VIRTUAL_ENV=."venv"
layout python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants