Skip to main content

pip-licenses Library

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

If you are looking for a CLI based upon this library which is compatible with pip-licenses, you might want to have a look at pip-licenses-cli.

About

This package is a fork of the great pip-licenses tool, which provides a CLI with similar functionality. For now, pip-licenses itself mostly focuses on the CLI part; while library-based access is possible, some interesting methods for further reuse are nested and therefore hidden inside the corresponding API.

While there have been some attempts to provide similar features in the upstream repository, they are not available inside the official package at the moment, while I needed a short-term solution. Examples:

  • In May 2021, a package structure has been introduced by #88. In August 2023, this is still only available on a dev-4.0.0 branch, while version 4.0.0 has been released in November 2022.
  • In October 2020, the PR #78 for handling multiple license files has been closed to maybe include it in the future, which has not yet happened.

As parsing the license data of packages as provided by the maintainers is at least some first hint regarding the license status, I decided to create this fork with the required modifications and enhancements to suit my current needs.

Differences to pip-licenses

Changes compared to the original version:

  • Use dataclasses.dataclass instead of a dictionary for each package information result.
  • Remove all output/rendering functionality.
  • Move all methods to the top level.
  • Always return all copyright and notice file matches.
  • Always return the system packages as well.
  • Add support for newer standards like PEP 639.
  • Include the license names and distribution object inside the results.
  • Add an option to skip retrieving license and notice files for faster version-only checks.
  • Add an option to normalize returned package names.
  • Enable support for Python < 3.8 by using the importlib_metadata backport.
    • This has been changed in the meantime. Please use piplicenses-lib<=0.4.1 if you need to support Python < 3.9.
  • Do not use abbreviations for naming purposes.
  • Rewrite tests to use plain unittest functionality.

Limitations

  • If you use this package in an environment with setuptools>=71, the results might be inconsistent if setuptools is imported before running pip-licenses-lib. This is due to setuptools modifying sys.path and inserting its vendored package path there. Upstream issue

Installation

You can install this package from PyPI:

python -m pip install pip-licenses-lib

Alternatively, you can use the package from source directly after installing the required dependencies.

Usage

The main entry point is piplicenses_lib.get_packages(), which will yield a list of package data objects.

License

This package is subject to the terms of the MIT license.

Disclaimer

All results are generated automatically from the data supplied by the corresponding package maintainers and provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. No generated content should be considered or used as legal advice. Consult an Attorney for any legal advice.

Metadata

Release files for pip-licenses-lib 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pip-licenses-lib 1.2.2
File Size Uploaded Provenance
pip_licenses_lib-1.2.2.tar.gz 15.9 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pip-licenses-lib 1.2.2
File Interpreter ABI Platform
pip_licenses_lib-1.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 25.9 kB

Release files / pip_licenses_lib-1.2.2.tar.gz

Download URL pip_licenses_lib-1.2.2.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
366e9056fa33a63e725e8f4d49efc33c1e9066c8cc7ed254f0ea46f9c088f389
BLAKE2b-256 checksum
How to use checksums
88a54956b104bdede0e7bb5cdb12d065b651de25e41a76c106035b8db9a2d80d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2026.

Transparency log

Release files / pip_licenses_lib-1.2.2-py3-none-any.whl

Download URL pip_licenses_lib-1.2.2-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31f6d4e1cd9fe10eb92782e2c086483a179ae696c7d3e46744d12c9a02fc8c3a
BLAKE2b-256 checksum
How to use checksums
0235a383a57b8a6e43f2bef28f8d4de4e832f0e11ac3eea3360bea0f9a1ce56f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2026.

Transparency log

Security for pip-licenses-lib 1.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pip_licenses_lib-1.2.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page