Skip to main content

license_scanner

Downloads

Find all licenses needed by the package in your python environment. It will sort all package by license.

Install by pip

pip install license_scanner

Usage

license_scanner

Check within you pipeline

You can make your pipeline fail if a project does not have the correct licenses. To do so create a pyproject.toml and add underneath tool.license_scanner two lists allowed-licenses and allowed-packages. If a package does not have license in allowed-licenses AND it is not in allowed-packages it will throw an error.

[tool.license_scanner]
allowed-licenses = [
  "MIT",
  "apache software license",
  "apache software license v2",
  "apache software license v3",
  "BSD license",
  "BSD 3-clause license",
  'GNU lesser general public license',
  'GNU lesser general public license v2',
  'GNU lesser general public license v3',
  'Python software foundation license',
  'Mozilla public license 2.0 (mpl 2.0)',
  'mozilla',
]
allowed-packages = ["license_scanner"]

To run the license scanner make sure you are in the same directory as pyproject.toml and run license_scanner -m whitelist or python -m license_scanner -m whitelist. It will now throw you an error if your environment has an package with a license you did not approve of.

Example: Github actions

This github actions triggers every time you make a PR to the main branch. With pip install . it installs the current project, next it installs license_scanner, and lastly it runs the check.

Be aware, if you want to do unittest make sure you install pytest AFTER you run license_scanner. Otherwise pytest is in your environment when you check for unwanted licenses.

name: Licenses check

on:
  pull_request:
    branches:
      - main

permissions:
  contents: read

jobs:
  deploy:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
    - name: Set up Python
      uses: actions/setup-python@v3
      with:
        python-version: '3.x'
    - name: Check for licenses
      run: |
        python -m pip install --upgrade pip
        pip install .
        pip install license_scanner
        python -m license_scanner -m whitelist

Supported licenses

  • Apache license
  • Apache license 1.0
  • Apache license 2.0
  • Azure License
  • BSD license
  • BSD 0-clause license
  • BSD 2-clause license
  • BSD 3-clause license
  • BSD 4-clause license
  • Creative Commons Zero, CC-0
  • Eclipse public license 1.0 (epl-1.0)
  • Eclipse public license 2.0 (epl-2.0)
  • GNU Affero general public license (apl)
  • GNU Affero general public license v3 (aplv3)
  • GNU lesser general public license
  • GNU lesser general public license v2 (lgplv2)
  • GNU lesser general public license v3 (lgplv3)
  • GNU general public license
  • GNU general public license v2 (gplv2)
  • GNU general public license v3 (gplv3)
  • Historical Permission Notice and Disclaimer (HPND)
  • ISC license (iscl)
  • MIT license
  • MIT-CMU License (MIT-CMU)
  • MIT No Attribution
  • Mozilla public license (mpl)
  • Mozilla public license 2.0 (mpl 2.0)
  • Public domain
  • Python software foundation license
  • Python software foundation license v1
  • Python software foundation license v2
  • Repoze public license
  • The Unlicense (Unlicense)
  • DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
  • Zope Public License
  • Zope Public License v1
  • Zope Public License v2

Credits

  • Tom Nijhof

Metadata

Release files for license_scanner 0.2.11

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

Source distribution (sdist)

Source distribution for license_scanner 0.2.11
File Size Uploaded Provenance Actions
license_scanner-0.2.11.tar.gz 8.9 MB Without provenance Details for license_scanner-0.2.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for license_scanner 0.2.11
File Interpreter ABI Platform Actions
license_scanner-0.2.11-py3-none-any.whl Python 3 none any Details for license_scanner-0.2.11-py3-none-any.whl

Total release size: 8.9 MB

Release files / license_scanner-0.2.11.tar.gz

Download URL license_scanner-0.2.11.tar.gz
Size 8.9 MB
Tags Source
SHA-256 checksum
How to use checksums
488e0bb0f1903fdb0bee8f463ac6d4e84e233b26798a123ceec74c85c595ca80
BLAKE2b-256 checksum
How to use checksums
08b63e664be31661c861b98b46f86945b331efd82ec47665746bffc66222ad77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Release files / license_scanner-0.2.11-py3-none-any.whl

Download URL license_scanner-0.2.11-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f771160f0ea2f0c538e85ddf26b1c20d6d6cf9ec3a9f98b661a7dc201aa9b953
BLAKE2b-256 checksum
How to use checksums
8ee0a55eb84fa5dc9d289ce531511253340e2897e33917c3ce4cf5fc9ae3c5a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Security for license_scanner 0.2.11

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.11 This release

2 release files No provenance

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