Skip to content

[BUG] Editable Installation with src-layout Fails Due to Hidden '.venv' #4595

@fkhn

Description

@fkhn

setuptools version

setuptools==65.5.0

Python version

Python 3.11

OS

macOS

Additional environment information

a venv name '.venv'
pip 24.2

Description

When using pip install -e . with a src-layout, an entry is typically added to sys.path via a file named __editable__.pakagename.pth. However, the loading of this .pth file fails if the virtual environment is hidden, which is the case for the default .venv name used by many tools.
To be precise, cpython/Lib/site.py uses os.lstat on the .pth file and skips it.
It is likely the same on other Unix-like systems.

Expected behavior

Since src-layout and editable installs are frequently used, they should be supported regardless of the virtual environment's naming convention or visibility status.

How to Reproduce

create a venv with a name starting by a dot, typically .venv
use a src-layout
python3 -v -m packagename

Output

Skipping hidden .pth file: '/project_folder/.venv/lib/python3.11/site-packages/__editable__.packagename.pth'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssues that need to be evaluated for severity and status.bug

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions