bpo-43926: Cleaner metadata with PEP 566 JSON support.#25565
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.
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.
Fixed in 289665029e (also versionchanged for changes to the interpretation of the metadata).
There was a problem hiding this comment.
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