The `entrypoints` library facilitates the discovery and loading of entry points advertised by installed Python packages. It offers a lightweight and faster alternative to `pkg_resources` for this specific functionality, avoiding the full package scans that can slow down `pkg_resources` at import time. The current version is 0.4. The package is in maintenance-only mode, with new code advised to use the `importlib.metadata` module from the Python standard library for entry point management.
pip install entrypointsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to find and load entry points, specifically 'console_scripts'. It iterates through found entry points, prints their details, and attempts to load the associated Python object.
Migrate to `importlib.metadata` for new implementations: `from importlib.metadata import entry_points` (or `from importlib_metadata import entry_points` for older Python).
Ensure a clean and controlled Python environment, ideally using virtual environments, where only the desired version of a package is available. Rely on `pip` to manage package installations to avoid multiple `.dist-info` or `.egg-info` directories for the same package.
Always use standard package managers like `pip` for installation. Avoid manual manipulation of `site-packages` or `dist-info`/`egg-info` directories. If issues arise, a clean reinstallation in a fresh virtual environment is recommended.
Pin your `importlib-metadata` package to version 4.13.0 or earlier (`pip install 'importlib-metadata<5'`). Alternatively, if using `importlib.metadata` directly, adopt the modern `select()` method to retrieve entry points by group or name, rather than dictionary-like access.
Ensure your package has `__init__.py` files in all its directories to be recognized as a package. Verify the module path specified in your `console_scripts` entry point (e.g., `my_script=my_package.module:function`) is correct and that the package is installed in the active Python environment (use `pip install -e .` for development installs).
Refactor your code to use the `select()` method on the `EntryPoints` object to filter by group or name. For example, instead of `entry_points()['my_group']`, use `entry_points(group='my_group')` or `entry_points().select(group='my_group')`.
No dependency data recorded yet.