Retrieve the software license list of Python packages installed with pip.
Project description
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.0branch, 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.dataclassinstead 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_metadatabackport.- This has been changed in the meantime. Please use
piplicenses-lib<=0.4.1if you need to support Python < 3.9.
- This has been changed in the meantime. Please use
- Do not use abbreviations for naming purposes.
- Rewrite tests to use plain unittest functionality.
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pip_licenses_lib-1.1.0.tar.gz.
File metadata
- Download URL: pip_licenses_lib-1.1.0.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d4c8c869ea3e3302af826f163d128ec1ffb29f20d7e83ffb742c2efeedf53ed
|
|
| MD5 |
3468661c29674a7df7528ff64a212ed7
|
|
| BLAKE2b-256 |
5edf58ac443f45b150fb0d7811a3fafc1594b2782e3f2bbd3ebfcfd6bb38c8e0
|
Provenance
The following attestation bundles were made for pip_licenses_lib-1.1.0.tar.gz:
Publisher:
release.yml on stefan6419846/pip-licenses-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pip_licenses_lib-1.1.0.tar.gz -
Subject digest:
6d4c8c869ea3e3302af826f163d128ec1ffb29f20d7e83ffb742c2efeedf53ed - Sigstore transparency entry: 954533921
- Sigstore integration time:
-
Permalink:
stefan6419846/pip-licenses-lib@2b40ba6a0a0e71628d9f270dcbb38ea19bf4c9ed -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/stefan6419846
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2b40ba6a0a0e71628d9f270dcbb38ea19bf4c9ed -
Trigger Event:
release
-
Statement type:
File details
Details for the file pip_licenses_lib-1.1.0-py3-none-any.whl.
File metadata
- Download URL: pip_licenses_lib-1.1.0-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f44e50743202677034f58ec56af1cbd95d9d2aad5a9f20d86004fee8bc1e1e7
|
|
| MD5 |
b28fce41b68fbd052894b7fde20cf766
|
|
| BLAKE2b-256 |
66a08262127c7872e4e950fab53bffa8b4dffa4965f950708d3ba0299a789330
|
Provenance
The following attestation bundles were made for pip_licenses_lib-1.1.0-py3-none-any.whl:
Publisher:
release.yml on stefan6419846/pip-licenses-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pip_licenses_lib-1.1.0-py3-none-any.whl -
Subject digest:
4f44e50743202677034f58ec56af1cbd95d9d2aad5a9f20d86004fee8bc1e1e7 - Sigstore transparency entry: 954533924
- Sigstore integration time:
-
Permalink:
stefan6419846/pip-licenses-lib@2b40ba6a0a0e71628d9f270dcbb38ea19bf4c9ed -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/stefan6419846
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2b40ba6a0a0e71628d9f270dcbb38ea19bf4c9ed -
Trigger Event:
release
-
Statement type: