-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Pipenv activate command - activate the virtual environment in the current shell #5007
Comments
This is probably not so straight forward. What I can offer is that we create an alias and inject it to the bash shell together with the bash-completions. |
@oz123 understood, calling shell-specific commands from the existing shell process just might not be possible (this). I could be interested in having it as a bash-completion made available by pipenv. Also ok if the answer is just, you can't source a file in python, keep using |
What about |
The run subcommand already creatures a subshell. |
It is very easy to create an alias or shell function that does the following: source $(pipenv --venv)/bin/activate we are not going to implement it in pipenv. |
That would be a nice tid-bit to add to the docs at some point. |
Yeah, fine by me. For posterity, that command doesn't work in windows since virtual environment exes are placed in the "Scripts" folder. That's why I've been using |
Is your feature request related to a problem? Please describe.
I'd like to be able to use a pipenv command to activate the virtual environment for a project in the current shell.
pipenv shell
spawns a new shell (and often doesn't work in a containerized environment) and the alternative is to use shell commands, which is fine but less straightforward.Describe the solution you'd like
A new command
pipenv activate
that does the equivalent of callingsource activate
for the virtual environment. Then a user can call the exsting virtualenvdeactivate
when they want to deactivate the environment.Describe alternatives you've considered
My current workaround on bash is
source $(dirname $(pipenv run which python))/activate
. It's fine but not intuitive for someone not experienced with bash. It also breaks due to things like #5003 modifying stdout.Additional context
Add any other context or screenshots about the feature request here. It may be a good idea to mention that platform and Python version you are on.
Please run
$ pipenv --support
, and paste the results here. Don't put backticks (`
) around it! The output already contains Markdown formatting.(removed because too long for max issue body)
The text was updated successfully, but these errors were encountered: