importlib-metadata
Read metadata from Python packages
This package has a good security score with no known vulnerabilities.
Community Reviews
Straightforward metadata access with clear API, but error handling needs care
The main gotcha is error handling: `PackageNotFoundError` gets raised when a package isn't found, which you'll need to catch explicitly in production code. The exception message is clear, but it's easy to forget this isn't optional error handling. Entry points can be tricky since the API changed between versions - the newer `entry_points(group='...')` interface is much cleaner than the old dict-like access.
Documentation is solid with practical examples for common use cases like reading versions and discovering plugins via entry points. The backport nature means it mirrors stdlib behavior closely, so if you know Python 3.10+ importlib.metadata, you already know this package.
Best for: Reading package versions, accessing package metadata, or building plugin systems via entry points in Python < 3.10 or needing newer features.
Avoid if: You're on Python 3.10+ and only need basic features available in stdlib importlib.metadata.
Reliable metadata access with minimal overhead, some edge case friction
The library handles missing packages gracefully with PackageNotFoundError, making error paths predictable. Entry points discovery is particularly solid for building extensible applications. However, you'll hit edge cases with namespace packages or non-standard installations where metadata isn't where expected. The backport nature means you need to remember Python 3.8+ has this built-in as importlib.metadata, so managing the conditional import can be annoying.
No connection pooling or retry logic needed here—it's pure filesystem access. Logging is minimal (basically none), which is fine for this use case. The main operational consideration is ensuring your deployment process preserves .dist-info directories, or you'll get runtime failures that are confusing to debug in containerized environments.
Best for: Reading package versions, discovering entry points, and building plugin systems where metadata introspection is needed.
Avoid if: You need complex package dependency resolution or are working exclusively with Python 3.8+ where stdlib version suffices.
Clean API for package metadata, but error handling needs attention
The type hints are decent and IDE autocomplete works well for the primary functions. However, error handling can be frustrating - `PackageNotFoundError` is the main exception you'll encounter, but distinguishing between a truly missing package versus namespace/import issues isn't always clear from error messages. The documentation is functional but sparse; you'll often need to reference PEP 566 and stdlib docs to understand metadata field semantics.
For plugin systems using entry points, the API changed significantly between versions 3.x and 5.x, which caused migration pain. The newer `entry_points()` returning a dict-like object is cleaner, but older tutorials still reference the deprecated API, creating confusion for newcomers.
Best for: Libraries needing cross-version compatibility for package introspection, version checking, and plugin systems via entry points.
Avoid if: You only target Python 3.8+ and can use the stdlib importlib.metadata directly without backport compatibility.
Sign in to write a review
Sign In