`poetry exit` to safely exit the virtualenv

See original GitHub issue

Add a poetry exit command to exit a poetry shell; do so safely when the poetry shell is not active already. Since exit will exit a bash shell when a poetry shell is not active, it’s “dangerous”. At present, there are issues asking for some form of “marker” that a poetry shell is active (i.e. there seems to be no easy way to tell whether or not a poetry shell is active without issuing another poetry shell to get poetry feedback about it). A poetry exit command is an additional feature that provides a safe exit, regardless of whether a poetry shell is active or if the status of it is visible.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:6

github_iconTop GitHub Comments

1reaction
floer32commented, May 5, 2019

I could see the utility in your suggestion @darrenleeweber ; though maybe, “poetry shell --exit”? I don’t think it needs another top-level command. Then if Poetry-subshell was not already active, it can print a warning, but still exit-0-OK.

1reaction
Victor-Savucommented, Apr 26, 2019

I’m not sure if it helps, but what I find myself doing is:

source $(poetry env info -p)/bin/activate

using the preview version of poetry. This activates the virtualenv in my current shell which gives me the prompt indicator as well as the option to call deactivate as with any virtual environment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Method to Exit Poetry Virtual Environment #2792 - GitHub
So if I deactivate or delete the existing virtual environment and create a new one with virtualenv , do I then need to...
Read more >
Poetry | Dev Cheatsheets - Michael Currin
Activate environment. This creates a subshell, so when you exit the subshell no changes are persisted. $ poetry shell.
Read more >
How to leave/exit/deactivate a Python virtualenv - Stack Overflow
This exits the entire shell the venv is in, and drops you back to the original shell from before the activation script made...
Read more >
Configure a virtual environment | PyCharm Documentation
The main purpose of virtual environments is to manage settings and dependencies of a particular project regardless of other Python projects. virtualenv tool ......
Read more >
Rebuilding a Virtualenv - PythonAnywhere help
1) Use a requirements.txt file to record what packages you're using¶ · Activate your virtualenv, using source /home/myusername/path/to/virtualenv/bin/activate or ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found