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.
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 original version:
- Use
dataclasses.dataclass
instead of a dictionary for each package information result. - Enable support for Python < 3.8 by using the
importlib_metadata
backport and dropping support for the new annotations behaviour for now. - 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.
- Include the license names and distribution object inside the results.
- Do not use abbreviations for naming purposes.
- Rewrite tests to use plain unittest functionality.
- Add option to skip retrieving license and notice files for faster version-only checks.
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
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
File details
Details for the file pip_licenses_lib-0.4.1.tar.gz
.
File metadata
- Download URL: pip_licenses_lib-0.4.1.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 136a6cce80ba93f6bfceb5bce56d673d01ae6f99b6d4446055db1b9f4eb7e8e1 |
|
MD5 | 4c3866f1aa462fded4d24459e4a89a1a |
|
BLAKE2b-256 | 271770dceaeb8896b08cd42814743b5f79b437f160cf7426499b13118c9e50c4 |
File details
Details for the file pip_licenses_lib-0.4.1-py3-none-any.whl
.
File metadata
- Download URL: pip_licenses_lib-0.4.1-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7126d7062730f479ea808929879c25e8eb72cf802b199ab366f46c9857e66a5 |
|
MD5 | 8e9c3ee62b90bb5bd1296d632adde1db |
|
BLAKE2b-256 | c87259a2ca6c7137e759fd22ede1761e20dace669833e2e95e721fc9d009ac6b |