importlib_metadata

A backport and reference implementation of Python's importlib.metadata for reading package metadata

Library
PyPI
v9.0.0
141stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
74/100Good
Development Activity56
Maintenance76
Community84
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
73/100Good
Architecture75
Code Quality82
Innovation55
Learning Curve80

importlib_metadata gives Python code a consistent API for reading a package’s metadata — version, entry points, dependencies, top-level modules — without importing that package. It is both the reference implementation used to develop new features for the standard library’s importlib.metadata module and a standalone backport, so projects supporting older Python versions (or wanting the latest metadata-reading features before they land upstream) can pip install it directly.

Because so much of Python’s packaging ecosystem (entry-point discovery, plugin systems, pip show-style introspection) depends on reading installed-package metadata, this library sits quietly underneath a large share of the tooling ecosystem, including being vendored into setuptools and used by countless plugin-loading frameworks.

What You Get

  • version(), metadata(), and distribution() APIs for reading installed package metadata
  • Entry-point discovery (entry_points()) used to power plugin systems across the ecosystem
  • Support for reading dependencies/requirements declared by a distribution
  • A backport that tracks and previews new features before they land in the standard library
  • Compatibility across older supported Python versions that lack the newest stdlib features

Common Use Cases

  • Building plugin systems that discover installed plugins via entry points
  • Introspecting a package’s version or metadata at runtime without importing it
  • Backporting the newest importlib.metadata capabilities to projects on older Python versions
  • Powering package-management tooling that needs to enumerate installed distributions

Under The Hood

Architecture - importlib_metadata/__init__.py implements Distribution/PackagePath abstractions with pluggable finders that locate installed package metadata (.dist-info/.egg-info) on sys.path, backed by helper modules for adapting raw email-style metadata (_adapters.py), text parsing (_text.py), and collection utilities (_collections.py, _itertools.py, _functools.py) kept intentionally dependency-free for early-bootstrap use. Tech Stack - Pure Python with minimal dependencies (zipp for zip-file path support pre-3.12), packaged with modern PEP 621 pyproject.toml metadata, tested via tox/pytest across supported CPython versions, and typed-checked with mypy. Code Quality - A large tests/ suite (test_api.py, test_integration.py, test_zip.py, test_main.py) plus fixture helpers reflects the project’s role as a reference implementation feeding directly into CPython, where correctness bugs would break the standard library itself. API Design - The API mirrors what later becomes stdlib importlib.metadata, so the learning curve is minimal for anyone who has used the standard library version; version('pkgname') and entry_points(group=...) cover the vast majority of real usage in one call.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search