pilosus / pip-license-checker

Check license types for third-party dependencies: permissive, copyleft, proprietory, etc.
https://blog.pilosus.org/posts/2021/09/07/pip-license-checker/
Other
68 stars 3 forks source link

Fallback to license from github repo #7

Closed pilosus closed 3 years ago

pilosus commented 3 years ago

Prioroties for getting license name: 1) Trove classifiers 2) "license" field

Some packages ignore both of these. In this case we should try to find github repository of the project in one of the following fields:

  "home_page": "https://github.com/aio-libs/aiohttp",
  "project_url": "https://pypi.org/project/aiohttp/",
  "project_urls": {
    "CI: Azure Pipelines": "https://dev.azure.com/aio-libs/aiohttp/_build",
    "Chat: Gitter": "https://gitter.im/aio-libs/Lobby",
    "Coverage: codecov": "https://codecov.io/github/aio-libs/aiohttp",
    "Docs: RTD": "https://docs.aiohttp.org",
    "GitHub: issues": "https://github.com/aio-libs/aiohttp/issues",
    "GitHub: repo": "https://github.com/aio-libs/aiohttp",
    "Homepage": "https://github.com/aio-libs/aiohttp"
  },

then try to get the license via github api: https://docs.github.com/en/free-pro-team@latest/rest/reference/licenses#get-the-license-for-a-repository

pilosus commented 3 years ago

Done in #15