python-poetry / python-poetry/poetry-plugin-shell
Allow `--force` activate `poetry shell` when poetry fails to activate it
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 141
- Forks
- 10
- Avg merge
- 59m
- Merged PRs (30d)
- 3
Description
-
I am on the latest Poetry version.
-
I have searched the issues of this repo and believe that this is not a duplicate.
-
If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption). -
OS version and name: Ubuntu 20.04
-
Poetry version: 1.1.13
Issue
Often times poetry keeps thinking I have a shell already activated, and I don't. This is widely reported by others too (#4622, python-poetry/poetry-plugin-shell#21, python-poetry/poetry#5050, python-poetry/poetry#3136). I also do not have any conda environment activated (not even base). In this case, I am just forced to use the full path to the venv to run the activate script manually. I propose that we should be able to do this in poetry, when it inevitable fails to activate the venv, to --force activate the environment, so that even if it is "already active" (not actually), it will still be "activated" (for the first time).
Current output
$ poetry shell -vvv
Using virtualenv: ...-py3.8
Virtual environment already activated: ...-py3.8
Proposed Usage example:
$ poetry shell
Virtual environment already activated: ...
$ poetry shell -f
Force-activating Virtual environment: ...
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the poetry shell command and reproduce the reported Virtual environment already activated output on Ubuntu. Trace the existing activation decision and define completion as a force option that activates the environment despite that detection, with output matching the proposed usage example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100