GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||
GeezerVison is showing github.com — gh-160386: Apply changes from importlib_metadata 10.0 and document the shared protocols by jaraco · Pull Request #160344 · python/cpython Conversation
|
Documentation build overview
160 files changed ·
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
importlib_metadata now decides the warning by conformance to IDistribution rather than by class identity, so a provider that presents the whole interface draws no warning and the warning names what a class omits. Co-Authored-By: Claude Opus 5 <[email protected]>
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
The guidance to rely on the interface rather than the type addresses every consumer, not only a provider that consumes metadata, so promote the caveats to their own section and split it by audience. Note that the protocols come from the backport, which this module does not yet present. Co-Authored-By: Claude Opus 5 <[email protected]>
Assume the shared protocols from python/importlib_metadata#505 are presented by this module as well: document IDistribution and IPackagePath, correct PackageMetadata, which is already a protocol here rather than an implementation of the backport's, and write the caveats around the protocols as the interface both libraries satisfy. Co-Authored-By: Claude Opus 5 <[email protected]>
Adds the IDistribution and IPackagePath protocols, so a consumer can target one interface across this module and the backport rather than either library's concrete classes, and annotates the functions returning distributions and files with them. The backport's compat and _compat packages are excluded from the port as usual, so localize and the conformance warning it raises do not appear here; only the protocols they are defined against do. This is what the caveats documented for pythongh-123976 in this branch describe. Co-Authored-By: Claude Opus 5 <[email protected]>
There was an error while loading. Please reload this page.
Documents the two class hierarchies, the protocols both satisfy, and what that asks of consumers and of custom providers, following the protocols and conformance-based warning added in #505. Moved here from a draft against the stdlib docs (python/cpython#160344), where the concern is largely this package's rather than the stdlib's. Co-Authored-By: Claude Opus 5 <[email protected]>
The caveats are largely this backport's concern, so they now live in its own documentation (python/importlib_metadata@be2ea93bc), which this module links to from the overview, from IDistribution, and from the custom provider example. What stays here is the documentation of the protocols themselves. Co-Authored-By: Claude Opus 5 <[email protected]>
|
@jaraco While I think it's a worthy goal to enable type checks in a way that bridges the gap between the stdlib API and the backport API, I have some concerns about backward compatibility. Changing the types can potentially break existing code, so I had my agent help with an analysis. The Both libraries' |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| assert isinstance(metadata('distinfo-pkg'), PackageMetadata) | ||
|
|
||
| def test_package_path_matches_protocol(self): | ||
| assert all(isinstance(file, IPackagePath) for file in files('distinfo-pkg')) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This covers objects that came from files(), but a directly constructed PackagePath doesn't
satisfy the protocol:
>>> isinstance(PackagePath('foo.py'), IPackagePath)
False
hash, size, and dist are only set on instances in make_file(). The doctests on _get_toplevel_name(), now annotated IPackagePath, pass exactly such objects. Since the docs now steer users toward the protocols, it would be good to either give PackagePath class-level defaults for those attributes or note the limitation in the IPackagePath docs. A test for whichever behavior is intended would help too.
See my general comment below.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
When you're done making the requested changes, leave the comment: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.