Comments (6)
I can explain, but I can't claim my explanation is good :)
The short version is that we have our own internal package manager, and it apparently uses the pypi package name (with dashes) as is to generate the egg-info / dist-info directories.
That makes sense, and it's not a big surprise that after creating a standard for package names in a repository that people would be tempted to use that standard elsewhere, even in places where it's incompatible with established designs (such as in metadata filename conventions).
In my opinion, normalization is broken in a few dimensions, but the designs are established and are what they are.
That thread reminds me that I did discover the alternate spec for dist-info names, which explicitly calls out the need to replace dashes with underscores.
So while the "correct normalization" was perhaps difficult to find, it was in fact present and has been implied by the implementations of other installers for some time.
And while importlib_metadata did incidentally support that form for some time, that support was not intentional and it was a bug that it was allowed. So while it did have a backward-incompatible effect to fix that bug, it was not breaking a tested/supported form, so wasn't treated as such. In retrospect, if we'd expected this to have breaking effects, we might have indicated it as a breaking change or at least given users a stronger message about what was changed broken.
At this point, there's not much else I think this project could do except maybe to enhance the changelog to indicate the break.
Let me know how this project can support you.
from importlib_metadata.
I believe flake8-plugin-utils
is not correctly normalized for a name in the file system. While you're right that the PEP 503 normalization does prefer -
to _
, this separator is inadequate for prefixes on .egg-info
or .dist-info
because those filenames expect -
to separate the name from the version and other discriminators. That's why the normalization specifically and intentionally expects underscore in place of dash in filenames and specifically relies on -
to separate the name.
We probably could trace what the differences were between Python 3.10.5 and .9, but probably they were intentional and more correct.
Before we go down that route, can you explain more about how you ended up with a file called flake8-plugin-utils.egg-info
? When I install he package pip-run
, I end up with pip_run
in my file system:
>>> import sys
>>> sys.path
['', '/Library/Frameworks/Python.framework/Versions/3.12/lib/python312.zip', '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12', '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload', '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages']
>>> import pathlib
>>> list(pathlib.Path(sys.path[-1]).glob('pip*run*info'))
[PosixPath('/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip_run-11.0.0.dist-info')]
Similarly, if I install flake8-plugin-utils:
~ $ pip-run flake8-plugin-utils -- -q
>>> import sys, pathlib
>>> list(pathlib.Path(sys.path[1]).glob('flake8*info'))
[PosixPath('/var/folders/sx/n5gkrgfx6zd91ymxr2sr9wvw00n8zm/T/pip-run-yw4ze02_/flake8_plugin_utils-1.3.2.dist-info')]
This all leads me to believe that flake8-plugin-utils.egg-info
is not a valid form. Please help me understand why that's not the case.
from importlib_metadata.
Thank you for the reply @jaraco !
We probably could trace what the differences were between Python 3.10.5 and .9, but probably they were intentional and more correct.
I believe this was the relevant change. I agree it's more correct (e.g. the normalized name for "flake8.egg-info" goes from "flake8.egg" to "flake8"), but it is also making a backwards incompatible change (maybe justifiable, I don't have all the context).
Before we go down that route, can you explain more about how you ended up with a file called
flake8-plugin-utils.egg-info
?
I can explain, but I can't claim my explanation is good :)
The short version is that we have our own internal package manager, and it apparently uses the pypi package name (with dashes) as is to generate the egg-info / dist-info directories.
This all leads me to believe that
flake8-plugin-utils.egg-info
is not a valid form. Please help me understand why that's not the case.
This may be the case, and if it is, we need to fix our package manager to apply consistent normalization.
My concern with this conclusion is that while our internal implementation was supposedly PyPA-compliant, it was still wrong (in practice), and I don't know how we were supposed to come up with the correct normalization without reading the importlib metadata normalization implementation that you linked above (and that changed between 3.10 bugfix versions).
from importlib_metadata.
thanks, that's informative and helpful!
this doc is indeed helpful - I wish it was more discoverable and maybe linked from the other places that could potentially lead to the confusion.
maybe highlighting this change in the release notes of 3.10.9 and 3.11 could help as well.
feel free to close this issue or repurpose it for docs improvements.
from importlib_metadata.
I've added a note to the importlib_metadata changelog so the issue could be readily discovered there. Looking at the Python release notes, I think the story is harder. The "what's new" document is for point releases and not bugfixes (e.g. 3.10, not 3.10.9). There is a news file for patch releases, so the notice could go there, but I'm not confident that's discoverable enough to be worthwhile to amend. Moreover, those notes already link to the changelog entry in importlib_metadata. If you think it would be worthwhile to amend the entry in the changelog, just say so and I'll make the change.
If you can think of a better way to increase the visibility of the concern, I'm open to other suggestions. Otherwise, I think this bug report (and the related one in cpython) will be sufficient to surface the concern for others affected.
from importlib_metadata.
thanks @jaraco !
I hope the note you added and the existence of this issue would be sufficient for future stumblers.
from importlib_metadata.
Related Issues (20)
- ContextualVersionConflict error on jupyter notebook HOT 1
- pypy test has started failing HOT 12
- Rely on zipfile.Path (where viable) HOT 1
- Backport docs changes HOT 1
- Invalid annotation in `SimplePath` protocol HOT 2
- Change build backend to flit-core? HOT 2
- 6.8.0: pytest is failing in tests/test_api.py::APITests::test_prefix_not_matched` unit HOT 3
- PackageNotFoundError No package metadata was found for <myproject> HOT 1
- Question: parsing package names & versions from METADATA file instead of dist-info directory HOT 1
- Provide a helper for "is distribution present" HOT 2
- Mypy tests failing on Windows only HOT 1
- 6.9.0: `DiscoveryTests.test_package_discovery` fails HOT 7
- distributions() finds two packages for editable installs HOT 2
- MetadataPathFinder has `find_distributions` as a classmethod in CPython HOT 1
- Intersphinx mapping for stdlib version
- API incompatibility with `importlib.metadata` (or at least the API is not type-safe?) HOT 5
- AttributeError changed to AssertionError for invalid identifiers HOT 1
- Ensure stale empty python module directories don't break the build HOT 16
- 7.2.0: pytest fails in exercises.py units HOT 4
- importlib metadata 8.0 causes unusual errors in startup for twine, others(?) HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from importlib_metadata.