No document for `importlib.metadata.distributions` · Issue #136023 · python/cpython · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

No document for importlib.metadata.distributions #136023

Closed as duplicate of#134740
Closed as duplicate of#134740
@bebound

Description

@bebound

Documentation

Since pkg_resources is deprecated, I'm trying to migrate pkg_resources.working_set to importlib.metadata.

working set
A collection of distributions actually available for importing, as on sys.path. At most one distribution (release version) of a given project may be present in a working set, as otherwise there would be ambiguity as to what to import.
--- https://setuptools.pypa.io/en/latest/pkg_resources.html

The doc doesn't provide an example for retrieving all installed packages.

By searching in the source code, distributions returns the installed Distributions.

def distributions(**kwargs) -> Iterable[Distribution]:
"""Get all ``Distribution`` instances in the current environment.
:return: An iterable of ``Distribution`` instances.
"""
return Distribution.discover(**kwargs)

I think it's a useful function and should be added to the document.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      TMZ Celebrity News – Breaking Stories, Videos & Gossip

      Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

      Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

      🎥 Watch TMZ Live

      TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.