dist_meta.entry_points
¶
Parser and emitter for entry_points.txt
.
Note
The functions in this module will only parse well-formed entry_points.txt
files,
and may return unexpected values if passed malformed input.
Functions:
|
Parse the entry points from the given file lazily. |
|
Parse the entry points from the given text lazily. |
|
Parse the entry points from the given file. |
|
Parse the entry points from the given text. |
|
Construct an |
|
Construct an |
|
Returns an iterator over |
|
Returns a mapping of entry point groups to entry points for all installed distributions. |
Classes:
|
Represents a single entry point. |
-
load
(filename)[source]¶ Parse the entry points from the given file.
- Parameters
- Return type
- Returns
A mapping of entry point groups to entry points.
Entry points in each group are contained in a dictionary mapping entry point names to objects.
dist_meta.entry_points.EntryPoint
objects can be constructed as follows:for name, epstr in distro.get_entry_points().get("console_scripts", {}).items(): EntryPoint(name, epstr)
-
loads
(rawtext)[source]¶ Parse the entry points from the given text.
- Parameters
rawtext (
str
)- Return type
- Returns
A mapping of entry point groups to entry points.
Entry points in each group are contained in a dictionary mapping entry point names to objects.
dist_meta.entry_points.EntryPoint
objects can be constructed as follows:for name, epstr in distro.get_entry_points().get("console_scripts", {}).items(): EntryPoint(name, epstr)
-
dump
(entry_points, filename)[source]¶ Construct an
entry_points.txt
file for the given grouped entry points, and write it tofilename
.
-
get_entry_points
(group, path=None)[source]¶ Returns an iterator over
entrypoints.EntryPoint
objects in the given group.
-
get_all_entry_points
(path=None)[source]¶ Returns a mapping of entry point groups to entry points for all installed distributions.
-
namedtuple
EntryPoint
(name, value, group=None, distro=None)[source]¶ Bases:
NamedTuple
Represents a single entry point.
- Fields
-
load
()[source]¶ Load the object referred to by this entry point.
If only a module is indicated by the value, return that module. Otherwise, return the named object.
- Return type
-
property
module
¶ The module component of
self.value
.- Return type
-
property
attr
¶ The object/attribute component of
self.value
.- Return type
-
classmethod
from_mapping
(mapping, *, group=None, distro=None)[source]¶ Returns a list of
EntryPoint
objects constructed from values inmapping
.- Parameters
- Return type
-
__repr__
()¶ Return a nicely formatted representation string