Skip to content

importlib.metadata API docs are incomplete (especially importlib.metadata.Distribution) #139695

@flying-sheep

Description

@flying-sheep

importlib.metadata.Distribution only has narrative docs that tell us

  • there are subclasses such as PathDistribution
  • it has a .version attribute that contains the version metadata
  • it has .metadata attribute whose __getitem__ accepts strings and returns metadata (unclear what is returned if 1. there are multiple values for the key 2. there aren’t multiple values but there could be, and 3. in case it always returns one value, how to get a list of multiple values)
  • since 3.13, it may have an .origin attribute of unknown type which has a .url attribute pointing to the origin of an editable package (unclear if not having the .origin attribute means the package is not editable, something else and .orgin.url is None then or something.)

the Extending the search algorithm header tells us to subclass that class, referencing some otherwise undocumented attributes and functions. Does that imply that we’re supposed to dive into the code and treat all attributes that don’t start with an underscore as public?

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions