entrypoints API¶
High-level API¶
-
entrypoints.
get_single
(group, name, path=None)¶ Find a single entry point.
Returns an
EntryPoint
object, or raisesNoSuchEntryPoint
if no match is found.
-
entrypoints.
get_group_named
(group, path=None)¶ Find a group of entry points with unique names.
Returns a dictionary of names to
EntryPoint
objects.
-
entrypoints.
get_group_all
(group, path=None)¶ Find all entry points in a group.
Returns a list of
EntryPoint
objects.
These functions will all use sys.path
by default if you don’t specify the
path parameter. This is normally what you want, so you shouldn’t need to
pass path.
EntryPoint objects¶
-
class
entrypoints.
EntryPoint
(name, module_name, object_name, extras=None, distro=None)¶ -
name
¶ The name identifying this entry point
-
module_name
¶ The name of an importable module to which it refers
-
object_name
¶ The dotted object name within the module, or None if the entry point refers to a module itself.
-
extras
¶ Extra setuptools features related to this entry point as a list, or None
-
distro
¶ The distribution which advertised this entry point - a
Distribution
instance or None
-
load
()¶ Load the object to which this entry point refers.
-
classmethod
from_string
(epstr, name, distro=None)¶ Parse an entry point from the syntax in entry_points.txt
Parameters: - epstr (str) – The entry point string (not including ‘name =’)
- name (str) – The name of this entry point
- distro (Distribution) – The distribution in which the entry point was found
Return type: Raises: BadEntryPoint – if epstr can’t be parsed as an entry point.
-
Exceptions¶
-
exception
entrypoints.
BadEntryPoint
(epstr)¶ Raised when an entry point can’t be parsed.
-
exception
entrypoints.
NoSuchEntryPoint
(group, name)¶ Raised by
get_single()
when no matching entry point is found.