skillfed

pip-licenses-lib

Retrieve the software license list of Python packages installed with pip.

pip-licenses-lib v1.2.2 114.8K downloads/30d#12,281 on PyPI5
Permissive license MIT Active released

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-lib

uv

uv add pip-licenses-lib

poetry

poetry add pip-licenses-lib

Installing 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

Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyTopic :: Software DevelopmentTopic :: UtilitiesTyping :: Typed

Tags

python package license detectioninspect installed package licensesget pip package license infolicense compliance checkingpackage metadata retrievalsoftware license inventorydependency license audit
license-compliancedependency-auditmetadata-extraction

More Software Development packages