python-poetry / python-poetry/poetry
poetry install generated .pth files don't use drive letter for mapped network drives
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
- Poetry version: 1.7.1
- Python version: 3.12.1
- OS version and name: Windows 11
- I am on the latest stable Poetry version, installed using a recommended method.
- I have searched the issues of this repo and believe that this is not a duplicate.
- I have consulted the FAQ and blog for any relevant entries or release notes.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption) and have included the output below.
Issue
possibly related to https://github.com/python-poetry/poetry/issues/4327 https://github.com/python-poetry/poetry/issues/959
I have a poetry project on a mapped network drive (z:) in Windows. When I run poetry install, the .venv\Lib\site-packages\app.pth file that is created uses the UNC path instead of the drive path:
app.pth
//server/share/app
But it should be:
Z:\app
This specifically caused problems for me because both the UNC path and the Z:\ path ended up in sys.path in my virtualenv:
Python 3.12.1 (tags/v3.12.1:2305ca5, Dec 7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)] on win32
>>> import sys
>>> sys.path
['Z:\\app\\.venv', 'Z:\\app\\.venv\\Lib\\site-packages', '\\\\server\\share\\app']
This slowed Pylance to a crawl in VS Code. Might be a bug in Pylance but it basically made it re-index my project continually, as it presumably tried to reconcile duplicate search paths.
Manually changing the app.pth path to use Z:\ and restarting VS Code fixed all issues.
Curiously, direct_url.json appears to use the correct path:
.venv/Lib/site-packages/app-0.0.1-dist-into/direct_url.json
{"dir_info": {"editable": true}, "url": "file:///Z:/app"}
Contributor guide
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 by reproducing poetry install for the reported Windows 11 project on mapped drive Z:, then trace how the editable install writes .venv\Lib\site-packages\app.pth and compare it with the direct_url.json path. Done means the .pth file preserves the drive-letter path rather than the UNC path, avoiding duplicate entries in sys.path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100