{
    "mode": "pydoc",
    "parameter": "importlib_metadata",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/importlib_metadata/json",
    "generated": "2026-06-02T15:52:07Z",
    "sections": {
        "NAME": {
            "content": "importlibmetadata\n",
            "subsections": []
        },
        "PACKAGE CONTENTS": {
            "content": "adapters\ncollections\ncompat\nfunctools\nitertools\nmeta\ntext\n",
            "subsections": []
        },
        "CLASSES": {
            "content": "builtins.ModuleNotFoundError(builtins.ImportError)\nPackageNotFoundError\nbuiltins.object\nDistribution\nimportlib.abc.MetaPathFinder(builtins.object)\nDistributionFinder\ntyping.Protocol(typing.Generic)\nimportlibmetadata.meta.PackageMetadata\n",
            "subsections": [
                {
                    "name": "class Distribution",
                    "content": "|  A Python distribution package.\n|\n|  Methods defined here:\n|\n|  locatefile(self, path)\n|      Given a path to a file in this distribution, return a path\n|      to it.\n|\n|  readtext(self, filename)\n|      Attempt to load metadata file given by the name.\n|\n|      :param filename: The name of the file in the distribution info.\n|      :return: The text if found, otherwise None.\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  discover(kwargs) from builtins.type\n|      Return an iterable of Distribution objects for all packages.\n|\n|      Pass a ``context`` or pass keyword arguments for constructing\n|      a context.\n|\n|      :context: A ``DistributionFinder.Context`` object.\n|      :return: Iterable of Distribution objects for all packages.\n|\n|  fromname(name) from builtins.type\n|      Return the Distribution for the given package name.\n|\n|      :param name: The name of the distribution package to search for.\n|      :return: The Distribution instance (or subclass thereof) for the named\n|          package, if found.\n|      :raises PackageNotFoundError: When the named package's distribution\n|          metadata cannot be found.\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  at(path)\n|      Return a Distribution for the indicated metadata path\n|\n|      :param path: a string or path-like object\n|      :return: a concrete Distribution instance for the path\n|\n|  ----------------------------------------------------------------------\n|  Readonly properties defined here:\n|\n|  entrypoints\n|\n|  files\n|      Files in this distribution.\n|\n|      :return: List of PackagePath for this distribution or None\n|\n|      Result is `None` if the metadata file that enumerates files\n|      (i.e. RECORD for dist-info or SOURCES.txt for egg-info) is\n|      missing.\n|      Result may be empty if the metadata exists but is empty.\n|\n|  metadata\n|      Return the parsed metadata for this Distribution.\n|\n|      The returned object will have keys that name the various bits of\n|      metadata.  See PEP 566 for details.\n|\n|  name\n|      Return the 'Name' metadata for the distribution package.\n|\n|  requires\n|      Generated requirements specified for this Distribution\n|\n|  version\n|      Return the 'Version' metadata for the distribution package.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n"
                },
                {
                    "name": "class DistributionFinder",
                    "content": "|  A MetaPathFinder capable of discovering installed distributions.\n|\n|  Method resolution order:\n|      DistributionFinder\n|      importlib.abc.MetaPathFinder\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  finddistributions(self, context=<importlibmetadata.DistributionFinder.Context object at 0x7f984bd0d540>)\n|      Find distributions.\n|\n|      Return an iterable of all Distribution instances capable of\n|      loading the metadata for packages matching the ``context``,\n|      a DistributionFinder.Context instance.\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  Context = <class 'importlibmetadata.DistributionFinder.Context'>\n|      Keyword arguments presented by the caller to\n|      ``distributions()`` or ``Distribution.discover()``\n|      to narrow the scope of a search for distributions\n|      in all DistributionFinders.\n|\n|      Each DistributionFinder may expect any parameters\n|      and should attempt to honor the canonical\n|      parameters defined below when appropriate.\n|\n|\n|  abstractmethods = frozenset({'finddistributions'})\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from importlib.abc.MetaPathFinder:\n|\n|  findmodule(self, fullname, path)\n|      Return a loader for the module.\n|\n|      If no module is found, return None.  The fullname is a str and\n|      the path is a list of strings or None.\n|\n|      This method is deprecated since Python 3.4 in favor of\n|      finder.findspec(). If findspec() exists then backwards-compatible\n|      functionality is provided for this method.\n|\n|  invalidatecaches(self)\n|      An optional method for clearing the finder's cache, if any.\n|      This method is used by importlib.invalidatecaches().\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from importlib.abc.MetaPathFinder:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n"
                },
                {
                    "name": "class PackageMetadata",
                    "content": "|  PackageMetadata(*args, kwargs)\n|\n|  Method resolution order:\n|      PackageMetadata\n|      typing.Protocol\n|      typing.Generic\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  contains(self, item: str) -> bool\n|\n|  getitem(self, key: str) -> str\n|\n|  init = noinitorreplaceinit(self, *args, kwargs)\n|\n|  iter(self) -> Iterator[str]\n|\n|  len(self) -> int\n|\n|  subclasshook = protohook(other)\n|      # Set (or override) the protocol subclass hook.\n|\n|  getall(self, name: str, failobj: ~T = Ellipsis) -> Union[List[Any], ~T]\n|      Return all values associated with a possibly multi-valued key.\n|\n|  ----------------------------------------------------------------------\n|  Readonly properties defined here:\n|\n|  json\n|      A JSON-compatible form of the metadata.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  abstractmethods = frozenset()\n|\n|  parameters = ()\n|\n|  ----------------------------------------------------------------------\n|  Class methods inherited from typing.Protocol:\n|\n|  initsubclass(*args, kwargs) from typing.ProtocolMeta\n|      This method is called when a class is subclassed.\n|\n|      The default implementation does nothing. It may be\n|      overridden to extend subclasses.\n|\n|  ----------------------------------------------------------------------\n|  Class methods inherited from typing.Generic:\n|\n|  classgetitem(params) from typing.ProtocolMeta\n"
                },
                {
                    "name": "class PackageNotFoundError",
                    "content": "|  The package was not found.\n|\n|  Method resolution order:\n|      PackageNotFoundError\n|      builtins.ModuleNotFoundError\n|      builtins.ImportError\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  str(self)\n|      Return str(self).\n|\n|  ----------------------------------------------------------------------\n|  Readonly properties defined here:\n|\n|  name\n|      module name\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.ModuleNotFoundError:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.ImportError:\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.ImportError:\n|\n|  msg\n|      exception message\n|\n|  path\n|      module path\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.Exception:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                }
            ]
        },
        "FUNCTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "distribution",
                    "content": "Get the ``Distribution`` instance for the named package.\n\n:param distributionname: The name of the distribution package as a string.\n:return: A ``Distribution`` instance (or subclass thereof).\n"
                },
                {
                    "name": "distributions",
                    "content": "Get all ``Distribution`` instances in the current environment.\n\n:return: An iterable of ``Distribution`` instances.\n"
                },
                {
                    "name": "entry_points",
                    "content": "Return EntryPoint objects for all installed packages.\n\nPass selection parameters (group or name) to filter the\nresult to entry points matching those properties (see\nEntryPoints.select()).\n\nFor compatibility, returns ``SelectableGroups`` object unless\nselection parameters are supplied. In the future, this function\nwill return ``EntryPoints`` instead of ``SelectableGroups``\neven when no selection parameters are supplied.\n\nFor maximum future compatibility, pass selection parameters\nor invoke ``.select`` with parameters on the result.\n\n:return: EntryPoints or SelectableGroups for all installed packages.\n"
                },
                {
                    "name": "files",
                    "content": "Return a list of files for the named package.\n\n:param distributionname: The name of the distribution package to query.\n:return: List of files composing the distribution.\n"
                },
                {
                    "name": "metadata",
                    "content": "Get the metadata for the named package.\n\n:param distributionname: The name of the distribution package to query.\n:return: A PackageMetadata containing the parsed metadata.\n"
                },
                {
                    "name": "packages_distributions",
                    "content": "Return a mapping of top-level packages to their\ndistributions.\n\n>>> import collections.abc\n>>> pkgs = packagesdistributions()\n>>> all(isinstance(dist, collections.abc.Sequence) for dist in pkgs.values())\nTrue\n"
                },
                {
                    "name": "requires",
                    "content": "Return a list of requirements for the named package.\n\n:return: An iterator of requirements, suitable for\npackaging.requirement.Requirement.\n"
                },
                {
                    "name": "version",
                    "content": "Get the version string for the named package.\n\n:param distributionname: The name of the distribution package to query.\n:return: The version string for the package as defined in the package's\n\"Version\" metadata key.\n"
                }
            ]
        },
        "DATA": {
            "content": "all = ['Distribution', 'DistributionFinder', 'PackageMetadata', 'P...\n",
            "subsections": []
        },
        "FILE": {
            "content": "/usr/lib/python3/dist-packages/importlibmetadata/init.py\n\n",
            "subsections": []
        }
    },
    "summary": "importlibmetadata",
    "flags": [],
    "examples": [],
    "see_also": []
}