README.rst
1spdx-lookup
2===========
3
4A tool to query the SPDX license list.
5
6Usage
7-----
8
9API
10~~~
11
12::
13
14 import spdx_lookup as lookup
15
16 # Case-insensitive SPDX id lookup
17 lookup.by_id('gpl-3.0') # -> returns License object or None
18
19 # Case-insensitive SPDX name lookup
20 lookup.by_name('gpl-3.0') # -> returns License object or None
21
22 # Find closest match for provided license content
23 with open('some-license.txt') as f:
24 match = lookup.match(f.read()) # -> returns LicenseMatch or None
25
26 match.confidence # -> a float between 0 and 100
27 match.license # -> a License object
28
29Command-line tool
30~~~~~~~~~~~~~~~~~
31
32::
33
34 usage: spdx-lookup [-h] (-i ID | -n NAME | -d DIR | -f FILE)
35 {template,info} ...
36
37 optional arguments:
38 -h, --help show this help message and exit
39
40 Lookup method:
41 -i ID, --id ID Find license with given identifier
42 -n NAME, --name NAME Find license with given name
43 -d DIR, --dir DIR Search directory for valid license
44 -f FILE, --file FILE Read file to detect license
45
46 Actions:
47 {template,info}
48 template print license template
49 info print metadata about license
50
51License
52-------
53
54BSD 2-clause. See LICENSE.
55