pip-licenses-lib
Retrieve the software license list of Python packages installed with pip.
What it is and what it does
pip-licenses-lib is a programmatic library for querying the licenses of installed Python packages. It's a fork of the pip-licenses tool, refactored to expose license metadata as a library rather than just command-line output. The main entry point yields structured dataclass objects containing package name, version, license information, and copyright/notice file matches.
Unlike the original tool, this library removes all rendering and output formatting, exposes all methods at the top level for easier reuse, and adds support for newer standards like PEP 639. It returns both copyright and notice file matches, includes system packages, and offers options to skip file retrieval for faster version-only checks or to normalize package names. The package has no runtime dependencies and is actively maintained.
Use it for:
- Generate a license inventory of all dependencies in a Python project for compliance auditing
- Automate license compliance checks in CI/CD pipelines to detect incompatible licenses before deployment
- Build internal tools that need programmatic access to installed package license metadata
- Audit which packages in an environment use specific licenses for legal review
- Create reports on copyright and notice files for all installed packages for distribution
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Programmatically retrieve and inspect the software licenses of Python packages installed in your environment, returning structured package metadata including license information.
Yes. Low install friction, no dependencies, active maintenance, and MIT licensing make it safe to add. Useful if you need programmatic license inspection. The setuptools >= 71 interaction is a known gotcha but documented and avoidable.
Install
pip-licenses-lib on PyPI
pip
pip install pip-licenses-libuv
uv add pip-licenses-libpoetry
poetry add pip-licenses-libInstalling pip-licenses-lib
Before you install
Low friction: zero runtime dependencies, pure Python wheel distribution. Active maintenance with recent release (99 days ago) and current commit history. Requires Python 3.10 or later.
License in practice
MIT license permits use, modification, and distribution with minimal restrictions. Permissive treatment means you can freely integrate this into commercial or proprietary projects.
Quickstart
pip install pip-licenses-lib
from pip_licenses_lib import get_packages
packages = get_packages()
for pkg in packages:
print(f"{pkg.name}: {pkg.license}")
Requires Python 3.10 or later. If setuptools >= 71 is imported before this package, results may be inconsistent due to setuptools modifying sys.path.
Verify before relying
- Whether the package handles all modern license metadata standards beyond PEP 639
- Performance characteristics when scanning environments with many installed packages
- Accuracy of license detection for packages using non-standard license declaration methods
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 99 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 114,760/month — #12,281 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pip_licenses_lib-1.2.2-py3-none-any.whl
Keywords: open source, license, package, dependency, licensing
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
pip-licenses-cliA command-line tool that scans installed Python…
permissive · top 15,000 on PyPI
pip-licensesA command-line tool that scans installed Python…
permissive · top 5,000 on PyPI
licensecheckScans a project's dependencies to extract their…
permissive · top 15,000 on PyPI
snowflake-cli-labsThis package has been renamed and is now a…
permissive · top 15,000 on PyPI
pip-auditpip-audit scans Python environments and…
permissive · top 1,000 on PyPI
reusereuse is a command-line tool that validates and…
copyleft · top 15,000 on PyPI
scripttestscripttest runs command-line applications in…
permissive · top 15,000 on PyPI
importlib-metadataProvides third-party access to Python package…
permissive · top 100 on PyPI
pyoneProvides Python bindings to the OpenNebula…
permissive · top 15,000 on PyPI
all-packagesAttempts to install every package from PyPI…
permissive · top 15,000 on PyPI