Skip to main content

No project description provided

Project description

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 No Attribution
  • Mozilla public license (mpl)
  • Mozilla public license 2.0 (mpl 2.0)
  • Public domain
  • Python software foundation license
  • 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

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

license_scanner-0.2.7.tar.gz (8.9 MB view details)

Uploaded Source

Built Distribution

license_scanner-0.2.7-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file license_scanner-0.2.7.tar.gz.

File metadata

  • Download URL: license_scanner-0.2.7.tar.gz
  • Upload date:
  • Size: 8.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for license_scanner-0.2.7.tar.gz
Algorithm Hash digest
SHA256 978744a1024b19cd6a6eb23c2d6dc371bd3d46e38f2067622c2b985bea3187b6
MD5 666be10813f510c6c11bbe67f736f228
BLAKE2b-256 0d63093a49cead1a5310b222cd4c45c42de609f50c80eece4f1842b4f2d9dbdc

See more details on using hashes here.

File details

Details for the file license_scanner-0.2.7-py3-none-any.whl.

File metadata

File hashes

Hashes for license_scanner-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5fa57a85a11a2232eb6f96c308ab0bc98e4bc86e039fded39a40c28a94b07227
MD5 0532bb89b677554eb30b4fee2626f4f2
BLAKE2b-256 21f40d46bb710e8ff26dd7373188ef1c3bec8ba317b84883a675af004c08e272

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page