python-poetry / python-poetry/poetry

feat: poetry env remove should display full path if using in-project virtualenvs

Open
#9,321 0 comments 1 reaction 1 assignee View on GitHub

@Secrus is already working on this.

Since Oct 6, 2024.

kind/feature
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

Issue Kind

Change in current behaviour

Description

Here's me trying to delete the venv that was created locally by poetry (doing this for vscode compatibilty)

It wasn't obvious that the env to remove needed a full path

So I had to do poetry env remove --all

Which of course may not be desirable for people

I suggest a helper message
If using local in-project virtualenvs be sure to specify the full path of the venv
or always displaying the venv path

teto@Ashleys-iMac InternHelper % poetry env list
.venv (Activated)
teto@Ashleys-iMac InternHelper % poetry env remove \.env

[Errno 2] No such file or directory: '.env'
teto@Ashleys-iMac InternHelper % poetry env remove \.\env

[Errno 2] No such file or directory: '.env'
teto@Ashleys-iMac InternHelper % poetry env remove \.\venv

[Errno 2] No such file or directory: '.venv'
teto@Ashleys-iMac InternHelper % poetry env remove ".venv"

[Errno 2] No such file or directory: '.venv'
teto@Ashleys-iMac InternHelper % poetry env remove --help 

Description:
  Remove virtual environments associated with the project.

Usage:
  env remove [options] [--] [<python>...]

Arguments:
  python                     The python executables associated with, or names of the virtual environments which are to be removed.

Options:
      --all                  Remove all managed virtual environments associated with the project.
  -h, --help                 Display help for the given command. When no command is given display help for the list command.
  -q, --quiet                Do not output any message.
  -V, --version              Display this application version.
      --ansi                 Force ANSI output.
      --no-ansi              Disable ANSI output.
  -n, --no-interaction       Do not ask any interactive question.
      --no-plugins           Disables plugins.
      --no-cache             Disables Poetry source caches.
  -C, --directory=DIRECTORY  The working directory for the Poetry command (defaults to the current working directory).
  -v|vv|vvv, --verbose       Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.
teto@Ashleys-iMac InternHelper % poetry env remove --all 
Deleted virtualenv: /Users/teto/textbook-search/InternHelper/.venv
teto@Ashleys-iMac InternHelper %                          
Impact

User experience improvement

Workarounds

Current workaround is to increase your skill with poetry and python

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.