-
-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Files for a src-style project installed in editable or develop mode #112
Comments
In GitLab by @blueyed on Mar 17, 2020, 12:34 mentioned in commit blueyed/importlib_metadata@5d73789b0619d5ac53dfb2966902c13b24d31e2b |
In GitLab by @blueyed on Mar 17, 2020, 12:34 mentioned in merge request !114 |
In GitLab by @blueyed on Mar 17, 2020, 12:35 This is also a problem when not using "wheel". |
Although some work was done on related issues, I believe this one remains. I welcome efforts to revive the effort or come up with a new approach. |
This probably works (somehow) for (Everything that depends on the |
So, if we perform a modern editable installation with setuptools, # > docker run --rm -it python:3.12-bookworm /bin/bash
mkdir -p /tmp/proj && cd /tmp/proj
cat <<EOF > pyproject.toml
[build-system]
requires = ["setuptools>=74.1.2"]
build-backed = "setuptools.build_meta"
EOF
mkdir -p src tests
touch src/proj.py
python -m venv .venv
.venv/bin/python -m pip install -U importlib_metadata
.venv/bin/python -m pip install -e . .venv/bin/python
>>> import importlib_metadata as metadata
>>> metadata.distribution("proj")._path
PosixPath('/tmp/proj/.venv/lib/python3.12/site-packages/proj-0.0.0.dist-info')
>>> [d._path for d in metadata.Distribution.discover(name="proj")]
[PosixPath('/tmp/proj/.venv/lib/python3.12/site-packages/proj-0.0.0.dist-info'), PosixPath('/tmp/proj/src/proj.egg-info')]
>>> dists = list(metadata.Distribution.discover(name="proj"))
>>> dists[0].files
[PackagePath('__editable__.proj-0.0.0.pth'), PackagePath('proj-0.0.0.dist-info/INSTALLER'), PackagePath('proj-0.0.0.dist-info/METADATA'), PackagePath('proj-0.0.0.dist-info/RECORD'), PackagePath('proj-0.0.0.dist-info/REQUESTED'), PackagePath('proj-0.0.0.dist-info/WHEEL'), PackagePath('proj-0.0.0.dist-info/direct_url.json'), PackagePath('proj-0.0.0.dist-info/top_level.txt')]
>>> dists[1].files
[] As mentioned above the # cat .venv/lib/python3.12/site-packages/proj-0.0.0.dist-info/RECORD
__editable__.proj-0.0.0.pth,sha256=XPp0xdLqXFR6kF2e4inRSr6TMwICwiKNaxmrwpJL7Mw,14
proj-0.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
proj-0.0.0.dist-info/METADATA,sha256=nZ_rXvwV8Ga5N5gGdUug8soyeMqt1_cO15vN1XN2Tfw,49
proj-0.0.0.dist-info/RECORD,,
proj-0.0.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
proj-0.0.0.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
proj-0.0.0.dist-info/direct_url.json,sha256=ZZzJsymE1uuQ_YSuj329jxgglIcLOhr53kUF-Iik53g,59
proj-0.0.0.dist-info/top_level.txt,sha256=kUODLUKrmhiCRxf_flnhS_wRM9siiDohJ4iCL_SE8IM,5 On the other hand, the # cat src/proj.egg-info/SOURCES.txt
pyproject.toml
src/proj.py
src/proj.egg-info/PKG-INFO
src/proj.egg-info/SOURCES.txt
src/proj.egg-info/dependency_links.txt So |
Thanks for the added clarity. Regarding the egg-info, I'd like to avoid adding more special cases for setuptools-specific behaviors. In fact, I'd really like to see egg-info generation removed. I'm pleased to see that the PEP 660 behaviors are trending toward some reasonable behavior. Although Maybe what That will do the "right thing" by some accounts, essentially providing >>> import importlib_metadata as md
>>> dist = md.distribution('setuptools-scm')
>>> dist.origin
namespace(dir_info=namespace(editable=True), url='file:///Users/jaraco/code/pypa/setuptools-scm') Similarly, for essential layout, the I'm inclined to say that |
The broader issue is being tracked in pypa/packaging-problems#620. |
In GitLab by @sinoroc on Feb 23, 2020, 18:34
In the case of a project with a
src
-style directory structure that is installed in develop or editable mode, it is not immediately possible to access the files.This is obviously a special case, the combination of editable (or develop) mode with setuptools
package_dir
seems quite tricky to deal with.The text was updated successfully, but these errors were encountered: