Skip to content

pip freeze of editable does not point to project location when using src layout #10243

@sbidoul

Description

@sbidoul

Description

This is something I (re)discovered while working on making pip list and pip freeze support PEP 610 for modern editables.

Assume a setuptools project using the src layout, without VCS, and installed in editable mode.

Running pip freeze will output the parent directory of the .egg-info directory, which is the src directory and not where setup.py is located, making reinstallation from the frozen requirement impossible.

This is fixable in principle because the .egg-link file contains a second line pointing to the setup.py directory.

I'm not sure this is something we will want to fix, but I report it for the record and discussion in case anyone has an any insight on the matter.

Expected behavior

No response

pip version

latest and probably all

Python version

3

OS

any

How to Reproduce

Assuming this setup.py:

from setuptools import setup

setup(
    name="pkga",
    packages=["pkga"],
    package_dir={"": "src"},
)

Run pip install -e ., followed by pip freeze. Notice that the directory produced by pip freeze does not point to the setup.py directory but to the src directory.

Output

No response

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: editableEditable installationstype: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions