third-party-license-file-generator


Namethird-party-license-file-generator JSON
Version 2024.8.23 PyPI version JSON
download
home_pagehttps://github.com/ftpsolutions/python-third-party-license-file-generator
SummaryThe Python third_party_license_file_generator is aimed at distilling down the appropriate license for one or many pip "requirements" files into a single file; it supports Python2.7 and Python3.
upload_time2024-08-23 04:44:34
maintainerNone
docs_urlNone
authorEdward Beech
requires_pythonNone
licenseMIT
keywords sample setuptools development
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python third_party_license_file_generator

The Python third_party_license_file_generator is aimed at distilling down the appropriate license for one or many pip "requirements" files into a single file; it supports Python2.7 and Python3.

## How do I install it?

    $ pip install third-party-license-file-generator

## How do I use it?

    $ python -m third_party_license_file_generator -h

## How does it work?

With no arguments (other than a pip "requirements" file and a Python executable path that has those requirements installed), the process is as follows:

- walk the given Python executable's site-packages folder and build up package metadata (and license files, if present)
- filter down by packages that are listed in the pip "requirements" file (and those packages dependencies, and their dependencies, and their dependencies... you get the gist)
    - note: it follows "-r some_file.txt" references found in the pip "requirements" files
- if a license name could not be secured for a package, try to gather that from the package's PyPI web page
    - if a license name has still not been secured and the package lists a GitHub home page, try to find a license from there
        - otherwise, assume the package to be commercially licensed (as it is legally understood that is the case)
- if a license file could not be secured for a package and the package lists a GitHub home page, try to find a license from there
    - otherwise, create a license (for the known license name) from a local collection of licenses (within the Python Third Party License Generator)
- show a summary of packages against licenses to the user
- build a THIRDPARTYLICENSES file in the current folder
- give a return code of zero for success or non-zero for failures (e.g. GPL-licensed packages detected when specified to not permit GPL)

It's worth noting that information learned about packages is cached- so if you have to build one third party licenses file for a large project that has many components with many dependencies (but some overlap) then it's best to specify all those pip "requirements" files and Python executable paths in a single call to the Python third_party_license_file_generator as it will take less time overall.

You can specify a number of command line options (check syntax with -h) to do things like the following:

- handle multiple pip "requirements" files
- handle multiple Python executable paths
- whether or not to permit GPL-licensed packages (default no)
- specific GPL-licensed package exceptions (e.g. if a package lists exceptions to the GPL that may suit your needs but is still GPL-licensed)
- whether or not to permit comercially-licensed packages (default no)
- specific comercially-licensed package exceptions (e.g. if you have a license for a package or if you own a package)
- a "skip prefix" (e.g. if you want to skip all packages starting with a certain string)
- disable internet lookups (if you don't want to pull data from PyPI and GitHub)
- disable skipping of not required packages (packages that are not requirements of other packages are skipped by default during license file generation)

## Examples

Two different pip "requirements" files, two different Python paths (Virtualenvs) and a skip prefix:

    python -m third_party_license_file_generator \
        -r requirements-py.txt \
        -p ~/.virtualenvs/backend_py/bin/python \
        -r requirements-pypy.txt \
        -p ~/.virtualenvs/backend_pypy/bin/python \
        -s ims-

Please note that pip "requirements" files and Python executable paths are paired together in the order they're specified.

Three different pip "requirements" files, two different Python paths (need to repeat), a GPL exception and a custom output file:

    python -m third_party_license_file_generator \
        -r requirements.txt \
        -p ~/.virtualenvs/api_pypy/bin/python \
        -r pypy_requirements.txt \
        -p ~/.virtualenvs/api_pypy/bin/python \
        -r cpython_requirements.txt \
        -p ~/.virtualenvs/api_py/bin/python \
        -x uWSGI \ 
        -o ThirdPartyLicenses.txt

Three different pip "requirements" files, two different Python paths (need to repeat), a GPL exception, a custom output file and a license override file:

    # contents of license_override_file.yml
    uWSGI: 
        license_name: GPL-2.0 w/ linking exception
        license_file: https://raw.githubusercontent.com/unbit/uwsgi/master/LICENSE

    python -m third_party_license_file_generator \
        -r requirements.txt \
        -p ~/.virtualenvs/api_pypy/bin/python \
        -r pypy_requirements.txt \
        -p ~/.virtualenvs/api_pypy/bin/python \
        -r cpython_requirements.txt \
        -p ~/.virtualenvs/api_py/bin/python \
        -x uWSGI \ 
        -o ThirdPartyLicenses.txt \
        -l license_override_file.yml

An example of the structure of the generated third party license file is as follows:

    Start of 'ThirdPartyLicenses.txt' generated by Python third_party_license_generator at 2018-04-19 12:36:58.627421

    ----------------------------------------

    Package: Django
    License: BSD-3-clause
    Requires: pytz
    Author: Django Software Foundation <foundation@djangoproject.com>
    Home page: https://www.djangoproject.com/

    (license content appears here in full)

    ----------------------------------------

    End of 'ThirdPartyLicenses.txt' generated by Python third_party_license_generator at 2018-04-19 12:36:58.627825

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ftpsolutions/python-third-party-license-file-generator",
    "name": "third-party-license-file-generator",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "sample setuptools development",
    "author": "Edward Beech",
    "author_email": "edward.beech@ftpsolutions.com.au",
    "download_url": "https://files.pythonhosted.org/packages/cb/e5/fffc187a5107237ab775a2459890dca86d376208d0220cce1db50c1f06e4/third_party_license_file_generator-2024.8.23.tar.gz",
    "platform": null,
    "description": "# Python third_party_license_file_generator\n\nThe Python third_party_license_file_generator is aimed at distilling down the appropriate license for one or many pip \"requirements\" files into a single file; it supports Python2.7 and Python3.\n\n## How do I install it?\n\n    $ pip install third-party-license-file-generator\n\n## How do I use it?\n\n    $ python -m third_party_license_file_generator -h\n\n## How does it work?\n\nWith no arguments (other than a pip \"requirements\" file and a Python executable path that has those requirements installed), the process is as follows:\n\n- walk the given Python executable's site-packages folder and build up package metadata (and license files, if present)\n- filter down by packages that are listed in the pip \"requirements\" file (and those packages dependencies, and their dependencies, and their dependencies... you get the gist)\n    - note: it follows \"-r some_file.txt\" references found in the pip \"requirements\" files\n- if a license name could not be secured for a package, try to gather that from the package's PyPI web page\n    - if a license name has still not been secured and the package lists a GitHub home page, try to find a license from there\n        - otherwise, assume the package to be commercially licensed (as it is legally understood that is the case)\n- if a license file could not be secured for a package and the package lists a GitHub home page, try to find a license from there\n    - otherwise, create a license (for the known license name) from a local collection of licenses (within the Python Third Party License Generator)\n- show a summary of packages against licenses to the user\n- build a THIRDPARTYLICENSES file in the current folder\n- give a return code of zero for success or non-zero for failures (e.g. GPL-licensed packages detected when specified to not permit GPL)\n\nIt's worth noting that information learned about packages is cached- so if you have to build one third party licenses file for a large project that has many components with many dependencies (but some overlap) then it's best to specify all those pip \"requirements\" files and Python executable paths in a single call to the Python third_party_license_file_generator as it will take less time overall.\n\nYou can specify a number of command line options (check syntax with -h) to do things like the following:\n\n- handle multiple pip \"requirements\" files\n- handle multiple Python executable paths\n- whether or not to permit GPL-licensed packages (default no)\n- specific GPL-licensed package exceptions (e.g. if a package lists exceptions to the GPL that may suit your needs but is still GPL-licensed)\n- whether or not to permit comercially-licensed packages (default no)\n- specific comercially-licensed package exceptions (e.g. if you have a license for a package or if you own a package)\n- a \"skip prefix\" (e.g. if you want to skip all packages starting with a certain string)\n- disable internet lookups (if you don't want to pull data from PyPI and GitHub)\n- disable skipping of not required packages (packages that are not requirements of other packages are skipped by default during license file generation)\n\n## Examples\n\nTwo different pip \"requirements\" files, two different Python paths (Virtualenvs) and a skip prefix:\n\n    python -m third_party_license_file_generator \\\n        -r requirements-py.txt \\\n        -p ~/.virtualenvs/backend_py/bin/python \\\n        -r requirements-pypy.txt \\\n        -p ~/.virtualenvs/backend_pypy/bin/python \\\n        -s ims-\n\nPlease note that pip \"requirements\" files and Python executable paths are paired together in the order they're specified.\n\nThree different pip \"requirements\" files, two different Python paths (need to repeat), a GPL exception and a custom output file:\n\n    python -m third_party_license_file_generator \\\n        -r requirements.txt \\\n        -p ~/.virtualenvs/api_pypy/bin/python \\\n        -r pypy_requirements.txt \\\n        -p ~/.virtualenvs/api_pypy/bin/python \\\n        -r cpython_requirements.txt \\\n        -p ~/.virtualenvs/api_py/bin/python \\\n        -x uWSGI \\ \n        -o ThirdPartyLicenses.txt\n\nThree different pip \"requirements\" files, two different Python paths (need to repeat), a GPL exception, a custom output file and a license override file:\n\n    # contents of license_override_file.yml\n    uWSGI: \n        license_name: GPL-2.0 w/ linking exception\n        license_file: https://raw.githubusercontent.com/unbit/uwsgi/master/LICENSE\n\n    python -m third_party_license_file_generator \\\n        -r requirements.txt \\\n        -p ~/.virtualenvs/api_pypy/bin/python \\\n        -r pypy_requirements.txt \\\n        -p ~/.virtualenvs/api_pypy/bin/python \\\n        -r cpython_requirements.txt \\\n        -p ~/.virtualenvs/api_py/bin/python \\\n        -x uWSGI \\ \n        -o ThirdPartyLicenses.txt \\\n        -l license_override_file.yml\n\nAn example of the structure of the generated third party license file is as follows:\n\n    Start of 'ThirdPartyLicenses.txt' generated by Python third_party_license_generator at 2018-04-19 12:36:58.627421\n\n    ----------------------------------------\n\n    Package: Django\n    License: BSD-3-clause\n    Requires: pytz\n    Author: Django Software Foundation <foundation@djangoproject.com>\n    Home page: https://www.djangoproject.com/\n\n    (license content appears here in full)\n\n    ----------------------------------------\n\n    End of 'ThirdPartyLicenses.txt' generated by Python third_party_license_generator at 2018-04-19 12:36:58.627825\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "The Python third_party_license_file_generator is aimed at distilling down the appropriate license for one or many pip \"requirements\" files into a single file; it supports Python2.7 and Python3.",
    "version": "2024.8.23",
    "project_urls": {
        "Homepage": "https://github.com/ftpsolutions/python-third-party-license-file-generator"
    },
    "split_keywords": [
        "sample",
        "setuptools",
        "development"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cbe5fffc187a5107237ab775a2459890dca86d376208d0220cce1db50c1f06e4",
                "md5": "a87b3bfa21e5d96b86bcee79c0c9ffb8",
                "sha256": "d64a1a77b23c71acce69c71934b53edf1eb56b8983e209704fc227c4cc6688d2"
            },
            "downloads": -1,
            "filename": "third_party_license_file_generator-2024.8.23.tar.gz",
            "has_sig": false,
            "md5_digest": "a87b3bfa21e5d96b86bcee79c0c9ffb8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 58061,
            "upload_time": "2024-08-23T04:44:34",
            "upload_time_iso_8601": "2024-08-23T04:44:34.653653Z",
            "url": "https://files.pythonhosted.org/packages/cb/e5/fffc187a5107237ab775a2459890dca86d376208d0220cce1db50c1f06e4/third_party_license_file_generator-2024.8.23.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-23 04:44:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ftpsolutions",
    "github_project": "python-third-party-license-file-generator",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "third-party-license-file-generator"
}
        
Elapsed time: 0.61710s