license-scanner


Namelicense-scanner JSON
Version 0.2.5 PyPI version JSON
download
home_page
Summary
upload_time2023-08-15 09:42:15
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT
keywords checker license scanner
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # license_scanner

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

Install by pip

```cmd
pip install license_scanner
```

Usage

```cmd
license_scanner
```

![](readme_files/demo.gif)

## 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.

```toml
[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.

```yaml
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

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "license-scanner",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "checker,license,scanner",
    "author": "",
    "author_email": "Tom Nijhof <tomsspamadress@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/32/a9/7d33b9510e0b692528cc6a9229a2c5d7eea19e5ed0ff6664e0b346ee5381/license_scanner-0.2.5.tar.gz",
    "platform": null,
    "description": "# license_scanner\n\nFind all licenses needed by the package in your python environment.\nIt will sort all package by license.\n\nInstall by pip\n\n```cmd\npip install license_scanner\n```\n\nUsage\n\n```cmd\nlicense_scanner\n```\n\n![](readme_files/demo.gif)\n\n## Check within you pipeline\n\nYou can make your pipeline fail if a project does not have the correct licenses.\nTo do so create a `pyproject.toml` and add underneath `tool.license_scanner` two lists `allowed-licenses` and `allowed-packages`.\nIf a package does not have license in `allowed-licenses` AND it is not in `allowed-packages` it will throw an error.\n\n```toml\n[tool.license_scanner]\nallowed-licenses = [\n  \"MIT\",\n  \"apache software license\",\n  \"apache software license v2\",\n  \"apache software license v3\",\n  \"BSD license\",\n  \"BSD 3-clause license\",\n  'GNU lesser general public license',\n  'GNU lesser general public license v2',\n  'GNU lesser general public license v3',\n  'Python software foundation license',\n  'Mozilla public license 2.0 (mpl 2.0)',\n  'mozilla',\n]\nallowed-packages = [\"license_scanner\"]\n```\n\nTo 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`. \nIt will now throw you an error if your environment has an package with a license you did not approve of.\n\n### Example: Github actions\n\nThis 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.\n\nBe 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.\n\n```yaml\nname: Licenses check\n\non:\n  pull_request:\n    branches:\n      - main\n\npermissions:\n  contents: read\n\njobs:\n  deploy:\n\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: actions/checkout@v3\n    - name: Set up Python\n      uses: actions/setup-python@v3\n      with:\n        python-version: '3.x'\n    - name: Check for licenses\n      run: |\n        python -m pip install --upgrade pip\n        pip install .\n        pip install license_scanner\n        python -m license_scanner -m whitelist\n\n```\n\n## Supported licenses\n\n- Apache license\n- Apache license 1.0\n- Apache license 2.0\n- Azure License\n- BSD license\n- BSD 0-clause license\n- BSD 2-clause license\n- BSD 3-clause license\n- BSD 4-clause license\n- Creative Commons Zero, CC-0\n- Eclipse public license 1.0 (epl-1.0)\n- Eclipse public license 2.0 (epl-2.0)\n- GNU Affero general public license (apl)\n- GNU Affero general public license v3 (aplv3)\n- GNU lesser general public license\n- GNU lesser general public license v2 (lgplv2)\n- GNU lesser general public license v3 (lgplv3)\n- GNU general public license\n- GNU general public license v2 (gplv2)\n- GNU general public license v3 (gplv3)\n- Historical Permission Notice and Disclaimer (HPND)\n- ISC license (iscl)\n- MIT license\n- MIT No Attribution\n- Mozilla public license (mpl)\n- Mozilla public license 2.0 (mpl 2.0)\n- Public domain\n- Python software foundation license\n- Repoze public license\n- The Unlicense (Unlicense)\n- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE\n- Zope Public License\n- Zope Public License v1\n- Zope Public License v2\n# Credits\n\n- Tom Nijhof\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "",
    "version": "0.2.5",
    "project_urls": null,
    "split_keywords": [
        "checker",
        "license",
        "scanner"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5537f7828967ddf5abc8b3416c5d91df46b6e14f6d039b4386d6629b4a45e2d0",
                "md5": "3b46a6c1a376ce34298cf8ff25e557e9",
                "sha256": "0675ac5849c02366d1d013f5f119f3e6caefb76b62c93199776d1b794860c15a"
            },
            "downloads": -1,
            "filename": "license_scanner-0.2.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3b46a6c1a376ce34298cf8ff25e557e9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 8923,
            "upload_time": "2023-08-15T09:42:13",
            "upload_time_iso_8601": "2023-08-15T09:42:13.091530Z",
            "url": "https://files.pythonhosted.org/packages/55/37/f7828967ddf5abc8b3416c5d91df46b6e14f6d039b4386d6629b4a45e2d0/license_scanner-0.2.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "32a97d33b9510e0b692528cc6a9229a2c5d7eea19e5ed0ff6664e0b346ee5381",
                "md5": "d6f53c3bb5c63971799a9a0c0bab1854",
                "sha256": "d02089ece66703a5c7206f3fa480dfc842936746b6ac423f7cc83f85a7faf099"
            },
            "downloads": -1,
            "filename": "license_scanner-0.2.5.tar.gz",
            "has_sig": false,
            "md5_digest": "d6f53c3bb5c63971799a9a0c0bab1854",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8897837,
            "upload_time": "2023-08-15T09:42:15",
            "upload_time_iso_8601": "2023-08-15T09:42:15.613824Z",
            "url": "https://files.pythonhosted.org/packages/32/a9/7d33b9510e0b692528cc6a9229a2c5d7eea19e5ed0ff6664e0b346ee5381/license_scanner-0.2.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-15 09:42:15",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "license-scanner"
}
        
Elapsed time: 0.10291s