Poetry does not automatically switch venvs in venv-activated shells
还没有人认领这个 Issue。
评估
调研方向
首先,在 Ubuntu 的 fish shell 中使用 poetry shell、在两个项目之间执行 cd 以及 poetry env info,复现所报告的流程。当在项目之间切换时能够自动选择匹配的虚拟环境,并且 shell 提示符能够反映这一点,而无需执行 poetry env use python 时,修改即告完成。
由索引模型根据 Issue 内容生成。
描述
- 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.2 LTS
- Poetry version: 1.1.16
Issue
Create two blank projects
/t/test> poetry new a
Created package a in a
/t/test> poetry new b
Created package b in b
/t/test> cd a
Create a's venv
/t/t/a> poetry shell
Creating virtualenv a-sARTaVSs-py3.8 in ~/.cache/pypoetry/virtualenvs
Spawning shell within ~/.cache/pypoetry/virtualenvs/a-sARTaVSs-py3.8
source ~/.cache/pypoetry/virtualenvs/a-sARTaVSs-py3.8/bin/activate.fish
Welcome to fish, the friendly interactive shell
Type `help` for instructions on how to use fish
(a-sARTaVSs-py3.8) /t/t/a> exit
We quitted a's venv, now create b's
/t/t/a> cd ../b
/t/t/b> poetry shell
Creating virtualenv b-Eo6UuKir-py3.8 in ~/.cache/pypoetry/virtualenvs
Spawning shell within ~/.cache/pypoetry/virtualenvs/b-Eo6UuKir-py3.8
source ~/.cache/pypoetry/virtualenvs/b-Eo6UuKir-py3.8/bin/activate.fish
Welcome to fish, the friendly interactive shell
Type `help` for instructions on how to use fish
We're still in b's venv, now let's go to a's project
(b-Eo6UuKir-py3.8) /t/t/b> cd ../a
(b-Eo6UuKir-py3.8) /t/t/a> poetry env info
Virtualenv
Python: 3.8.5
Implementation: CPython
Path: ~/.cache/pypoetry/virtualenvs/b-Eo6UuKir-py3.8
Valid: True
System
Platform: linux
OS: posix
Python: /usr
Crap, we are still in b's venv... If we run poetry install we'll install a's dependencies in b's venv
But there is a way out, eventhough the prompt is wrong (should be a-sARTaVSs-py3.8)
(b-Eo6UuKir-py3.8) /t/t/a> poetry env use python
Using virtualenv: ~/.cache/pypoetry/virtualenvs/a-sARTaVSs-py3.8
(b-Eo6UuKir-py3.8) /t/t/a> poetry env info
Virtualenv
Python: 3.8.5
Implementation: CPython
Path: ~/.cache/pypoetry/virtualenvs/a-sARTaVSs-py3.8
Valid: True
System
Platform: linux
OS: posix
Python: /usr
Now we are in a's venv (the right one), let's go back to b's project folder
(b-Eo6UuKir-py3.8) /t/t/a> cd ../b
(b-Eo6UuKir-py3.8) /t/t/b> poetry env info
Virtualenv
Python: 3.8.5
Implementation: CPython
Path: ~/.cache/pypoetry/virtualenvs/b-Eo6UuKir-py3.8
Valid: True
System
Platform: linux
OS: posix
Python: /usr
Surprisingly, on the way back everything is alright
- 主要语言
- Python
- 星标
- 141
- 派生
- 10
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python-poetry/poetry-plugin-shell 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 20/100
python-poetry/poetry-plugin-shell#43 · 1 条评论 · 1 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 52/100
python-poetry/poetry-plugin-shell#42 · 4 条评论 · 15 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 38/100
python-poetry/poetry-plugin-shell#40 · 4 条评论 · 2 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 42/100
python-poetry/poetry-plugin-shell#37 · 3 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 25/100
python-poetry/poetry-plugin-shell#34 · 1 条评论 ·
查看 python-poetry/poetry-plugin-shell 的全部 Issue
相似的 Issue
-
intake mcp-intake needs-ac needs-human-review priority:medium
难度 2/5 1-3 小时 新手友好度 67/100
Ikalus1988/MisakaNet#3848 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 75/100
521xueweihan/HelloGitHub#4105 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
igormcsouza/bookloud#54 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
aws-samples/sample-per-model-bedrock#526 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
ok-oldking/ok-wuthering-waves#1802 ·
维护者通常 2 天内回复