Skip to main content

dep_license

CI PyPI version

dep_license (deplic): a simple utility to report licenses information for dependencies in use by a Python project.

deplic supports reporting dependencies from local project directories, local / remote git repos, or selected virtual environment paths.

Supported dependency files:

  • setup.py
  • setup.cfg
  • requirements.txt
  • pyproject.toml
  • Pipfile
  • Pipfile.lock
  • conda.yaml
  • poetry.lock

Installation

$ pip install dep_license

Command-Line Options

usage: deplic [-h] [-w WORKERS] [-f FORMAT] [-o OUTPUT] [-d] [-n NAME]
              [-c CHECK] [-e] [-v]
              PROJECT [PROJECT ...]

positional arguments:
  PROJECT               path to project or its GIT repo

optional arguments:
  -h, --help            show this help message and exit
  -w WORKERS, --workers WORKERS
                        number of workers to run in parallel (default: 5)
  -f FORMAT, --format FORMAT
                        define how result is formatted (default: github)
  -o OUTPUT, --output OUTPUT
                        path for output file (default: None)
  -d, --dev             include dev packages from Pipfile (default: False)
  -n NAME, --name NAME  name for dependency file (default: None)
  -c CHECK, --check CHECK
                        path to a configuration file to check against banned
                        licenses (default: None)
  -e, --env             check against selected python executable (default:
                        False)
  -v, --version         show program's version number and exit

Usage

Report a list of dependency licenses used in a local project:

$ deplic /path/to/python/project
Found dependencies: 3

| Name       | Meta   | Classifier                                       |
|------------|--------|--------------------------------------------------|
| pandas     | BSD    |                                                  |
| matplotlib | PSF    | OSI Approved::Python Software Foundation License |
| numpy      | BSD    | OSI Approved                                     |

Specify the file to be parsed:

$ deplic /path/to/python/project/requirements.txt
Found dependencies: 1

| Name   | Meta   | Classifier   |
|--------|--------|--------------|
| numpy  | BSD    | OSI Approved |

Support for Pipfile:

$ deplic /path/to/python/project/Pipfile
Found dependencies: 3

| Name       | Meta   | Classifier                                       |
|------------|--------|--------------------------------------------------|
| numpy      | BSD    | OSI Approved                                     |
| pandas     | BSD    |                                                  |
| matplotlib | PSF    | OSI Approved::Python Software Foundation License |

Report from selected virtualenv path:

deplic $VIRTUAL_ENV/bin/python --env
Found dependencies: 3

| Name               | Meta                                 | Classifier                                       |
|--------------------|--------------------------------------|--------------------------------------------------|
| smmap              | BSD                                  | OSI Approved::BSD License                        |
| tabulate           | MIT                                  | OSI Approved::MIT License                        |
| six                | MIT                                  | OSI Approved::MIT License                        |

Format and store output as JSON file:

deplic /path/to/python/project -f json -o dep-licenses.json
Found dependencies: 3

[
    {
        "Name": "matplotlib",
        "Meta": "PSF",
        "Classifier": "OSI Approved::Python Software Foundation License"
    },
    {
        "Name": "pandas",
        "Meta": "BSD",
        "Classifier": ""
    },
    {
        "Name": "numpy",
        "Meta": "BSD",
        "Classifier": "OSI Approved"
    }
]

Get the list dev-packages from the project's GIT repo:

$ deplic https://github.com/kennethreitz/requests -p 16 -d -f md
Found dependencies: 16
Running with 16 processes...

Name             Meta                                                          Classifier
---------------  ------------------------------------------------------------  -------------------------------------
pytest           MIT license                                                   OSI Approved::MIT License
codecov          http://www.apache.org/licenses/LICENSE-2.0                    OSI Approved::Apache Software License
pytest-mock      MIT                                                           OSI Approved::MIT License
sphinx           BSD                                                           OSI Approved::BSD License
tox              MIT                                                           OSI Approved::MIT License
pytest-httpbin   MIT                                                           OSI Approved::MIT License
docutils         public domain, Python, 2-Clause BSD, GPL 3 (see COPYING.txt)  Public Domain
pytest-cov       MIT                                                           OSI Approved::BSD License
pytest-xdist     MIT                                                           OSI Approved::MIT License
pysocks          BSD
httpbin          MIT                                                           OSI Approved::MIT License
alabaster                                                                      OSI Approved::BSD License
readme-renderer  Apache License, Version 2.0                                   OSI Approved::Apache Software License
detox            MIT                                                           OSI Approved::MIT License

Specify which requirements file to parse:

$ deplic https://github.com/pandas-dev/pandas -n requirements-dev.txt -f csv -p 16 -o pandas_dev.csv

Run a check against banned licenses listed in a configuration file:

$ more deplic.cfg
[deplic]
banned = AGPL-3.0
# or multi-lines
# banned =
#     AGPL-3.0,
#     ...
$ deplic --check ./deplic.cfg /path/to/working/project

BANNED: edx-opaque-keys :: AGPL-3.0 - OSI Approved::GNU Affero General Public License v3
BANNED: edx-rbac :: AGPL 3.0 - OSI Approved::GNU Affero General Public License v3 or later (AGPLv3+)
BANNED: edx-django-utils :: AGPL 3.0 - OSI Approved::GNU Affero General Public License v3 or later (AGPLv3+)
BANNED: django-config-models :: AGPL 3.0 - OSI Approved::GNU Affero General Public License v3 or later (AGPLv3+)

Using dep-license in Docker

$ docker run -t -v $PWD:/stage abduh/dep-license deplic /stage
Found dependencies: 1

| Name         | Meta   | Classifier                |
|--------------|--------|---------------------------|
| editdistance |        | OSI Approved::MIT License |

Output Formats:

Supported table formats are (thanks to python-tabulate package):

  • "plain"
  • "simple"
  • "github"
  • "grid"
  • "fancy_grid"
  • "pipe"
  • "orgtbl"
  • "jira"
  • "presto"
  • "psql"
  • "rst"
  • "mediawiki"
  • "moinmoin"
  • "youtrack"
  • "html"
  • "latex"
  • "latex_raw"
  • "latex_booktabs"
  • "textile"
  • "csv"

Metadata

Release files for dep-license 2.5.0

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

Source distribution (sdist)

Source distribution for dep-license 2.5.0
File Size Uploaded
dep_license-2.5.0.tar.gz 10.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dep-license 2.5.0
File Interpreter ABI Platform
dep_license-2.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.8 kB

Release files / dep_license-2.5.0.tar.gz

Download URL dep_license-2.5.0.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
aff6d37d480fb717006e8d14778ee050f03db8c8d959607fab4070e837d4ebf0
BLAKE2b-256 checksum
How to use checksums
22d4c1cf6f6c6b16f00aa298827aca422ea7a658cdb65c4067259f27ad3acd5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.13

Release files / dep_license-2.5.0-py3-none-any.whl

Download URL dep_license-2.5.0-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab4ceaddaad112dff37fd53b4cf6b98affbf5fe865f05c86f847717947c22efd
BLAKE2b-256 checksum
How to use checksums
0efc8ab864d297743aec0e31a667e49a172fa06d4377f2853f4ac03187ebad33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.13

Release history Release notifications | RSS feed

This release

2.5.0 This release

2 release files

2.4.2

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

0.3.2

2 release files

0.2.4

1 release file

0.2.3

2 release files

0.2.0

2 release files

0.1

2 release files

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