Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Should PackageMetadata.get be supported? #384

Closed
@duckinator

Description

@duckinator

This isn't a feature request. I'm looking for a quick clarification, so other folks who encounter python/typeshed#7767 have a definitive answer.


In the wild, I've seen things like this:

from importlib.metadata import metadata
print(metadata("bork").get("Version"))

Both the stdlib documentation and the readthedocs documentation never mention .get(), and PackageMetadata does not define it. Due to that, using it and running mypy returns error: "PackageMetadata" has no attribute "get". I suspect I made a bad assumption when I used it, but if so it's one I've seen other folks make — so it seems worthwhile to get an explicit answer on whether leaving it out is deliberate.

So, my question is this:

Is .get() an implementation detail that folks latched on to and should migrate away from? Or should it be added to PackageMetadata?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions