Lookup License
Python tool to identify license from license text or license names.
With lookup-license you can lookup licenses from:
-
text (e.g. an incorrect name such as "BSD3" or an entire license text)
-
file (e.g. "src/LICENSE.txt")
-
url (e.g. "https://github.com/hesa/lookup-license/blob/main/LICENSE")
-
repositories
-
package names
-
purls
The first lookup takes a bit of time, due to initialization, so if you want to do a number of lookups you might want to use the interactive shell.
Using lookup-license
Lookup license without argument
If you do not provide an argument lookup-license assumes you want to copy/paste license information interactively. Let's say we want to lookup the license mit.
$ lookup-license
Enter license text and press Control-d.
>>> mit
MIT
In the example above:
-
Enter license text and press Control-d.is usage information -
>>>is thelookup-licenseprompt -
mitis the input the user provided -
MITis the result fromlookup-license
Lookup license passed as an argument
You want to lookup the license "MIT AND BSD3":
$ lookup-license "MIT AND BSD3"
MIT AND BSD-3-Clause
Lookup license information in a file
If you pass a file name without the --file option the file name is treated as an argument containing license text. So the following will not lookup the license text in LICENSE.TXT.
$ lookup-license "LICENSE.TXT"
If you want lookup-license to read the content and try to identify the license based on that, then you need to use the --file option.
Interactively provide the file name
$ lookup-license --file
Enter license file name and press enter.
>>> LICENSE.txt
CC-BY-4.0
Provide the file name as an argument
$ lookup-license --file LICENSE.txt
CC-BY-4.0
Lookup license information form a URL
Same as described earlier with file names, if you pass a URL to lookup-license it will be treated as license information. If you want to lookup the URL content you need to use the --url option.
Interactively provide the URL
$ lookup-license --url
Enter license URL name and press enter.
>>> https://github.com/psf/requests/blob/main/LICENSE
Apache-2.0
Provide the URL as an argument
$ lookup-license --url https://github.com/psf/requests/blob/main/LICENSE
Apache-2.0
interactive shell
Here is an example session for looking up the text mit followed the URL https://github.com/psf/requests/blob/main/LICENSE:
$ lookup-license --shell
Welcome to the LookupLicense shell. Type help or ? to list commands.
>>> text
Enter license text and press Control-d.
>>> mit
['MIT']
>>> url
Enter license URL name and press enter.
>>> https://github.com/psf/requests/blob/main/LICENSE
['Apache-2.0']
Looking up locense for packages and repositories
With lookup-license you can lookup the license for packages and repositories using:
-
Purls (Gem, github, Pypi, Swift)
-
Gitrepo (github, gitlab, freedesktop)
-
Package names (Gem, github, Pypi, Swift)
See Purl and package managers for more information.
Acknowledgements
Lookup license is a tiny wrapper on top of the following python modules:
-
scancode and ScanCode LicenseDB used to when looking up license text. Big thanks to Nexb.
-
foss-licenses, used when looking up license identifiers.
Metadata
Release files for lookup-license 0.1.31
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lookup_license-0.1.31.tar.gz | 42.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lookup_license-0.1.31-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 96.4 kB
Release files / lookup_license-0.1.31.tar.gz
| Download URL | lookup_license-0.1.31.tar.gz |
|---|---|
| Size | 42.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a25a57ce34024657f5a7501ecef7ef48ec84f1deea954a758b907d39a71b132d
|
|
BLAKE2b-256 checksum How to use checksums |
a8e3de0b857540234e452aca79872dccbb5d3ae9440e0145fafc7886f2b3b288
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / lookup_license-0.1.31-py2.py3-none-any.whl
| Download URL | lookup_license-0.1.31-py2.py3-none-any.whl |
|---|---|
| Size | 53.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
fa2d575e6d2b79b5639e0119a004fe04ea18165b6135a7205ff3a236df9aa7d2
|
|
BLAKE2b-256 checksum How to use checksums |
02c1d7030e0c568c3f23fc7b8262caa66b22f4e41134b664ef320a4f9ed95bf2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|