entrypoints
A lightweight way to discover and load entry points advertised by installed Python packages, without the import-time cost of pkg_resources.
Repository Health
Technical Analysis
entrypoints is a small, focused Python library for finding and loading entry points — the mechanism packages use to advertise objects (console scripts, plugin hooks, format handlers) that other code can discover at runtime. Where pkg_resources scans every installed package’s metadata the moment it is imported, entrypoints does no work until you actually ask for a group, making it noticeably faster in environments with many installed packages.
The library reads entry_points.txt from .dist-info, .egg-info, and even zipped wheels/eggs, parsing entries into simple EntryPoint objects that can be loaded on demand with .load(). It has been in maintenance-only mode since Python’s standard library gained importlib.metadata, but it remains a dependency of long-lived tools such as Jupyter and nbconvert, so it continues to receive compatibility fixes for new Python releases.
What You Get
get_group_all()/get_group_named()to enumerate every entry point in a named group (e.g.console_scripts)get_single()to fetch one specific entry point by group and name, raisingNoSuchEntryPointif missing- An
EntryPoint.load()method that imports the target module and resolves the referenced object on demand - Support for reading entry point metadata from regular installs,
.eggdirectories, and zipped wheels/eggs - A
Distributionhelper that parses the owning package’s name and version from its metadata directory
Common Use Cases
- Building a plugin system where third-party packages register handlers under a custom entry point group
- Discovering
console_scriptsentries to build command dispatch without invoking setuptools - Loading pytest, Jupyter, or nbconvert-style extensions that are registered via entry points
- Auditing which distributions on
sys.pathexpose a given entry point group before importing them
Under The Hood
Architecture
The library is a single flat module (entrypoints.py) with no internal layering: a handful of public functions (get_single, get_group_named, get_group_all) sit on top of one private generator, iter_files_distros, which walks sys.path and yields (ConfigParser, Distribution) pairs for every distribution it finds. Entry point strings are parsed into plain EntryPoint objects through a regex-based from_string classmethod, and loading is deferred to an explicit .load() call rather than happening at discovery time. There’s no dependency injection or internal plugin system — the actual “extension point” is a file system convention (entry_points.txt inside .dist-info/.egg-info), not the code itself, so the interesting complexity lives in iter_files_distros’s branching logic for plain directories, .egg directories, and zipped wheels/eggs.
Tech Stack
Runtime dependencies are limited to the Python standard library — configparser, zipfile, glob, os.path, re, and importlib — so installing the package pulls in nothing else. It’s built with flit_core as its build backend per pyproject.toml, ships no CLI or entry point of its own, and its CI matrix tests against Python 3.8 through 3.15-dev, reflecting its role as a long-lived compatibility shim rather than an actively evolving project.
Code Quality
Tests live in tests/test_entrypoints.py under pytest, backed by a tests/samples/ fixture tree of hand-built dist-info/egg-info directories plus a synthesized zip wheel, exercising edge cases like case-sensitive names, dotted-prefix entry point names, malformed entries surfaced through BadEntryPoint, and duplicate-distribution shadowing. There are no type hints or static type checking. GitHub Actions runs the suite on every push and pull request across the full supported Python range.
API Design
The public surface is intentionally small — three lookup functions plus a single .load() method — with predictable, parallel naming (get_single, get_group_named, get_group_all) and one dedicated exception, NoSuchEntryPoint, for the not-found case. Malformed entries can be downgraded from a raised BadEntryPoint to a warning via the err_to_warnings() context manager. Docstrings are present but minimal, and getting productive with the library requires understanding the underlying entry_points.txt/dist-info metadata convention, not just reading the function signatures.
Used by 2 apps in this directory
argilla
AI Development · Data Engineering
Collaborate on high-quality AI training data with a self-hosted annotation platform built for LLMs, NLP, and multimodal models.
MLflow
AI Development · Monitoring
The open source AI engineering platform for debugging, evaluating, monitoring, and optimizing production LLMs and agents at scale.