Registry / devops / entrypoints

entrypoints

JSON →
library0.4pypypi✓ verified 35d ago

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.

devops
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

from entrypoints import get_group_all
from entrypoints import get_group_named
from entrypoints import EntryPoint

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.

from entrypoints import get_group_all # Example: Find all 'console_scripts' entry points console_scripts = get_group_all('console_scripts') print(f"Found {len(console_scripts)} console scripts:") for ep in console_scripts: print(f" - {ep.name}: {ep.module}.{ep.attr}") try: # Load the entry point (e.g., a function) loaded_object = ep.load() # You can then call the loaded_object if it's a function # print(f" Loaded object: {loaded_object}") except Exception as e: print(f" Could not load {ep.name}: {e}")
Debug
Known footguns
breakingThe `entrypoints` package is in maintenance-only mode. New code should use `importlib.metadata` (part of the Python standard library since 3.8, non-provisional since 3.10) for discovering and loading entry points. For Python versions older than 3.8, consider using the `importlib_metadata` backport.
gotchaWhen multiple versions of the same distribution are present in different directories on `sys.path`, `entrypoints` follows a 'first one wins' rule. This typically aligns with Python's import logic, but can lead to unexpected behavior if specific versions are expected.
gotcha`entrypoints` relies on `pip` (or similar tools) to ensure only one `.dist-info` or `.egg-info` directory exists for each installed package. If this assumption is violated, there's no reliable way to pick the correct metadata, which can lead to incorrect entry point resolution.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources