-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
bpo-43926: Cleaner metadata with PEP 566 JSON support. #25565
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
Conversation
927b148 to
2b26539
Compare
2b26539 to
fc87e54
Compare
|
|
| >>> wheel_metadata['Requires-Python'] # doctest: +SKIP | ||
| '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*' | ||
|
|
||
| ``PackageMetadata`` also presents a ``json`` attribute that returns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a Python 3.10 only feature and hence a versionadded directive can be added.
Slightly out of topic, are Distribution objects and metadata attribute immutable? Accessing json attribute from metadata objects repeats the computation though it looks like a computed once attribute so just curious if metadata attribute of Distribution, json attribute etc. can be made a cached_property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 289665029e (also versionchanged for changes to the interpretation of the metadata).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be made a cached_property?
Although technically the PackageMetadata object is mutable, the protocol for it doesn't allow for mutation, so it's effectively immutable, so yes, a cached_property could be employed. Such an optimization may be premature, so I'm slightly inclined to defer that concern until a use-case presents itself. I don't feel strongly about it though and would likely accept a PR to importlib_metadata.
fc87e54 to
a0d64c7
Compare
|
@warsaw I note also that while we intentionally consolidated |
2896650 to
a9463bd
Compare
|
In order to ensure this change is included in the 3.10 release, I'm merging now. Happy to troubleshoot or back out specific behaviors as needed. |
https://bugs.python.org/issue43926