# importlib_metadata - pydoc - phpman

Help on package importlib_metadata:

## NAME
    importlib_metadata

## PACKAGE CONTENTS
    _adapters
    _collections
    _compat
    _functools
    _itertools
    _meta
    _text

## CLASSES
    builtins.ModuleNotFoundError(builtins.ImportError)
        PackageNotFoundError
    builtins.object
        Distribution
    importlib.abc.MetaPathFinder(builtins.object)
        DistributionFinder
    typing.Protocol(typing.Generic)
        importlib_metadata._meta.PackageMetadata

### class Distribution
     |  A Python distribution package.
     |
     |  Methods defined here:
     |
     |  locate_file(self, path)
     |      Given a path to a file in this distribution, return a path
     |      to it.
     |
     |  read_text(self, filename)
     |      Attempt to load metadata file given by the name.
     |
     |      :param filename: The name of the file in the distribution info.
     |      :return: The text if found, otherwise None.
     |
     |  ----------------------------------------------------------------------
     |  Class methods defined here:
     |
     |  discover(**kwargs) from builtins.type
     |      Return an iterable of Distribution objects for all packages.
     |
     |      Pass a ``context`` or pass keyword arguments for constructing
     |      a context.
     |
     |      :context: A ``DistributionFinder.Context`` object.
     |      :return: Iterable of Distribution objects for all packages.
     |
     |  [from_name(name)](https://www.chedong.com/phpMan.php/man/fromname/name/markdown) from builtins.type
     |      Return the Distribution for the given package name.
     |
     |      :param name: The name of the distribution package to search for.
     |      :return: The Distribution instance (or subclass thereof) for the named
     |          package, if found.
     |      :raises PackageNotFoundError: When the named package's distribution
     |          metadata cannot be found.
     |
     |  ----------------------------------------------------------------------
     |  Static methods defined here:
     |
     |  at(path)
     |      Return a Distribution for the indicated metadata path
     |
     |      :param path: a string or path-like object
     |      :return: a concrete Distribution instance for the path
     |
     |  ----------------------------------------------------------------------
     |  Readonly properties defined here:
     |
     |  entry_points
     |
     |  files
     |      Files in this distribution.
     |
     |      :return: List of PackagePath for this distribution or None
     |
     |      Result is `None` if the metadata file that enumerates files
     |      (i.e. RECORD for dist-info or SOURCES.txt for egg-info) is
     |      missing.
     |      Result may be empty if the metadata exists but is empty.
     |
     |  metadata
     |      Return the parsed metadata for this Distribution.
     |
     |      The returned object will have keys that name the various bits of
     |      metadata.  See PEP 566 for details.
     |
     |  name
     |      Return the 'Name' metadata for the distribution package.
     |
     |  requires
     |      Generated requirements specified for this Distribution
     |
     |  version
     |      Return the 'Version' metadata for the distribution package.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)

### class DistributionFinder
     |  A MetaPathFinder capable of discovering installed distributions.
     |
     |  Method resolution order:
     |      DistributionFinder
     |      importlib.abc.MetaPathFinder
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  find_distributions(self, context=<importlib_metadata.DistributionFinder.Context object at 0x7f1fc4199540>)
     |      Find distributions.
     |
     |      Return an iterable of all Distribution instances capable of
     |      loading the metadata for packages matching the ``context``,
     |      a DistributionFinder.Context instance.
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  Context = <class 'importlib_metadata.DistributionFinder.Context'>
     |      Keyword arguments presented by the caller to
     |      ``distributions()`` or ``Distribution.discover()``
     |      to narrow the scope of a search for distributions
     |      in all DistributionFinders.
     |
     |      Each DistributionFinder may expect any parameters
     |      and should attempt to honor the canonical
     |      parameters defined below when appropriate.
     |
     |
     |  __abstractmethods__ = frozenset({'find_distributions'})
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from importlib.abc.MetaPathFinder:
     |
     |  find_module(self, fullname, path)
     |      Return a loader for the module.
     |
     |      If no module is found, return None.  The fullname is a str and
     |      the path is a list of strings or None.
     |
     |      This method is deprecated since Python 3.4 in favor of
     |      finder.find_spec(). If find_spec() exists then backwards-compatible
     |      functionality is provided for this method.
     |
     |  invalidate_caches(self)
     |      An optional method for clearing the finder's cache, if any.
     |      This method is used by importlib.invalidate_caches().
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from importlib.abc.MetaPathFinder:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)

### class PackageMetadata
     |  PackageMetadata(*args, **kwargs)
     |
     |  Method resolution order:
     |      PackageMetadata
     |      typing.Protocol
     |      typing.Generic
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __contains__(self, item: str) -> bool
     |
     |  __getitem__(self, key: str) -> str
     |
     |  __init__ = _no_init_or_replace_init(self, *args, **kwargs)
     |
     |  __iter__(self) -> Iterator[str]
     |
     |  __len__(self) -> int
     |
     |  __subclasshook__ = _proto_hook(other)
     |      # Set (or override) the protocol subclass hook.
     |
     |  get_all(self, name: str, failobj: ~_T = Ellipsis) -> Union[List[Any], ~_T]
     |      Return all values associated with a possibly multi-valued key.
     |
     |  ----------------------------------------------------------------------
     |  Readonly properties defined here:
     |
     |  json
     |      A JSON-compatible form of the metadata.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  __abstractmethods__ = frozenset()
     |
     |  __parameters__ = ()
     |
     |  ----------------------------------------------------------------------
     |  Class methods inherited from typing.Protocol:
     |
     |  __init_subclass__(*args, **kwargs) from typing._ProtocolMeta
     |      This method is called when a class is subclassed.
     |
     |      The default implementation does nothing. It may be
     |      overridden to extend subclasses.
     |
     |  ----------------------------------------------------------------------
     |  Class methods inherited from typing.Generic:
     |
     |  __class_getitem__(params) from typing._ProtocolMeta

### class PackageNotFoundError
     |  The package was not found.
     |
     |  Method resolution order:
     |      PackageNotFoundError
     |      builtins.ModuleNotFoundError
     |      builtins.ImportError
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __str__(self)
     |      Return str(self).
     |
     |  ----------------------------------------------------------------------
     |  Readonly properties defined here:
     |
     |  name
     |      module name
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.ModuleNotFoundError:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.ImportError:
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.ImportError:
     |
     |  msg
     |      exception message
     |
     |  path
     |      module path
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

## FUNCTIONS
### distribution
        Get the ``Distribution`` instance for the named package.

        :param distribution_name: The name of the distribution package as a string.
        :return: A ``Distribution`` instance (or subclass thereof).

### distributions
        Get all ``Distribution`` instances in the current environment.

        :return: An iterable of ``Distribution`` instances.

### entry_points
        Return EntryPoint objects for all installed packages.

        Pass selection parameters (group or name) to filter the
        result to entry points matching those properties (see
        EntryPoints.select()).

        For compatibility, returns ``SelectableGroups`` object unless
        selection parameters are supplied. In the future, this function
        will return ``EntryPoints`` instead of ``SelectableGroups``
        even when no selection parameters are supplied.

        For maximum future compatibility, pass selection parameters
        or invoke ``.select`` with parameters on the result.

        :return: EntryPoints or SelectableGroups for all installed packages.

### files
        Return a list of files for the named package.

        :param distribution_name: The name of the distribution package to query.
        :return: List of files composing the distribution.

### metadata
        Get the metadata for the named package.

        :param distribution_name: The name of the distribution package to query.
        :return: A PackageMetadata containing the parsed metadata.

### packages_distributions
        Return a mapping of top-level packages to their
        distributions.

        >>> import collections.abc
        >>> pkgs = packages_distributions()
        >>> all(isinstance(dist, collections.abc.Sequence) for dist in pkgs.values())
        True

### requires
        Return a list of requirements for the named package.

        :return: An iterator of requirements, suitable for
            packaging.requirement.Requirement.

### version
        Get the version string for the named package.

        :param distribution_name: The name of the distribution package to query.
        :return: The version string for the package as defined in the package's
            "Version" metadata key.

## DATA
    __all__ = ['Distribution', 'DistributionFinder', 'PackageMetadata', 'P...

## FILE
    /usr/lib/python3/dist-packages/importlib_metadata/__init__.py


