Skip to main content

SPDX license list query tool

Project description

A tool to query the SPDX license list.

Usage

API

import spdx_lookup as lookup

# Case-insensitive SPDX id lookup
lookup.by_id('gpl-3.0') # -> returns License object or None

# Case-insensitive SPDX name lookup
lookup.by_name('gpl-3.0') # -> returns License object or None

# Find closest match for provided license content
with open('some-license.txt') as f:
    match = lookup.match(f.read()) # -> returns LicenseMatch or None

match.confidence # -> a float between 0 and 100
match.license # -> a License object

Command-line tool

usage: spdx-lookup [-h] (-i ID | -n NAME | -d DIR | -f FILE)
                   {template,info} ...

optional arguments:
  -h, --help            show this help message and exit

Lookup method:
  -i ID, --id ID        Find license with given identifier
  -n NAME, --name NAME  Find license with given name
  -d DIR, --dir DIR     Search directory for valid license
  -f FILE, --file FILE  Read file to detect license

Actions:
  {template,info}
    template            print license template
    info                print metadata about license

License

BSD 2-clause. See LICENSE.

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

spdx-lookup-0.3.3.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

spdx_lookup-0.3.3-py3-none-any.whl (5.5 kB view hashes)

Uploaded Python 3

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