@@ -4,46 +4,48 @@ purldb-toolkit
4
4
.. contents :: :local:
5
5
:depth: 3
6
6
7
-
8
-
9
- purldb-toolkit is command line utility and library to use the PurlDB, its API and various related libraries.
7
+ purldb-toolkit is a command line utility and library to use the PurlDB, its API and various related libraries.
10
8
11
9
The ``purlcli `` command acts as a client to the PurlDB REST API end point(s) to expose PURL services.
12
- It serves both as a tool, as a library and as an example on how to use the services programmatically.
10
+ It serves as a tool, a library and an example of how to use the services programmatically.
13
11
14
12
15
13
Installation
16
14
------------
17
15
16
+ .. code-block :: console
17
+
18
18
pip install purldb-toolkit
19
19
20
20
21
21
Usage
22
22
-----
23
23
24
- Use this command to get basic help::
24
+ Use this command to get basic help:
25
+
26
+ .. code-block :: console
25
27
26
28
$ purlcli --help
27
29
Usage: purlcli [OPTIONS] COMMAND [ARGS]...
28
30
29
- Return information from a PURL.
31
+ Return information from a PURL.
30
32
31
33
Options:
32
- --help Show this message and exit.
34
+ --help Show this message and exit.
33
35
34
36
Commands:
35
- metadata Given one or more PURLs, for each PURL, return a mapping of...
36
- urls Given one or more PURLs, for each PURL, return a list of all...
37
- validate Check the syntax and upstream repo status of one or more PURLs.
38
- versions Given one or more PURLs, return a list of all known versions...
37
+ metadata Given one or more PURLs, for each PURL, return a mapping of...
38
+ urls Given one or more PURLs, for each PURL, return a list of all...
39
+ validate Check the syntax and upstream repo status of one or more PURLs.
40
+ versions Given one or more PURLs, return a list of all known versions...
39
41
40
42
41
43
And the following subcommands:
42
44
43
- ' validate' -- validate a PURL
45
+ `` validate ``: validate a PURL
44
46
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45
47
46
- .. code-block :: none
48
+ .. code-block :: console
47
49
48
50
$ purlcli validate --help
49
51
Usage: purlcli validate [OPTIONS]
@@ -61,13 +63,13 @@ Examples
61
63
62
64
**Submit multiple PURLs using the command line: **
63
65
64
- .. code-block :: none
66
+ .. code-block :: console
65
67
66
68
purlcli validate --purl pkg:npm/[email protected] --purl pkg:nginx/[email protected] --output <path/to/output.json>
67
69
68
70
*Sample output: *
69
71
70
- .. code-block :: console
72
+ .. code-block :: json
71
73
72
74
{
73
75
"headers" : [
@@ -108,31 +110,33 @@ Examples
108
110
109
111
**Submit multiple PURLs using a .txt file: **
110
112
111
- .. code-block :: none
113
+ .. code-block :: console
112
114
113
115
purlcli validate --file <path/to/output.txt> --output <path/to/output.json>
114
116
115
117
*Sample input.txt: *
116
118
117
- .. code-block :: console
119
+ .. code-block :: text
118
120
119
121
120
122
121
123
122
124
123
- Notes
125
+ Details
124
126
#######
125
127
126
- ``validate `` calls the ``public.purldb.io/api/validate/ `` endpoint.
128
+ ``validate `` calls the ``validate/ `` endpoint of the `purldb API <https://public.purldb.io/api/ >`_.
129
+
130
+ See also https://public.purldb.io/api/docs/#/validate.
127
131
128
132
129
133
----
130
134
131
135
132
- ' versions' -- collect package versions for a PURL
136
+ `` versions ``: collect package versions for a PURL
133
137
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
134
138
135
- .. code-block :: none
139
+ .. code-block :: console
136
140
137
141
$ purlcli versions --help
138
142
Usage: purlcli versions [OPTIONS]
@@ -150,13 +154,13 @@ Examples
150
154
151
155
**Submit multiple PURLs using the command line: **
152
156
153
- .. code-block :: none
157
+ .. code-block :: console
154
158
155
159
purlcli versions --purl pkg:npm/canonical-path --purl pkg:nginx/nginx --output <path/to/output.json>
156
160
157
161
*Sample output: *
158
162
159
- .. code-block :: console
163
+ .. code-block :: json
160
164
161
165
{
162
166
"headers" : [
@@ -198,18 +202,18 @@ Examples
198
202
}
199
203
200
204
201
- Notes
205
+ Details
202
206
#######
203
207
204
- ``versions `` calls ``versions() `` from `fetchcode/package_versions.py < https://github.com/nexB/fetchcode/blob/master/src/fetchcode/package_versions.py >`__ .
208
+ ``versions `` calls ``versions() `` from `fetchcode/package_versions.py ` .
205
209
206
210
Version information is not needed in submitted PURLs and, if included, will be removed before processing.
207
211
208
212
209
213
----
210
214
211
215
212
- ' metadata' -- collect package metadata for a PURL
216
+ `` metadata ``: collect package metadata for a PURL
213
217
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
214
218
215
219
.. code-block :: console
@@ -231,13 +235,13 @@ Examples
231
235
232
236
**Submit multiple PURLs using the command line: **
233
237
234
- .. code-block :: none
238
+ .. code-block :: console
235
239
236
240
purlcli metadata --purl pkg:openssl/[email protected] --purl pkg:nginx/[email protected] --purl pkg:gnu/[email protected] --output <path/to/output.json>
237
241
238
242
*Sample output: *
239
243
240
- .. code-block :: console
244
+ .. code-block :: json
241
245
242
246
{
243
247
"headers" : [
@@ -339,23 +343,23 @@ Examples
339
343
}
340
344
341
345
342
- Notes
346
+ Details
343
347
#######
344
348
345
- ``metadata `` calls ``info() `` from `fetchcode/package.py < https://github.com/nexB/fetchcode/blob/master/src/fetchcode/package.py >`__ .
349
+ ``metadata `` calls ``info() `` from `fetchcode/package.py ` .
346
350
347
351
The intended output for each PURL type supported by the ``metadata `` command is
348
352
349
353
- an input PURL with a version: output the metadata for the input version
350
- - an input PURL with no version: output a list of the metadata for all versions
354
+ - an input PURL without a version: output a list of the metadata for all versions
351
355
352
- The output of the various PURL types currently supported in `fetchcode/package.py < https://github.com/nexB/fetchcode/blob/master/src/fetchcode/package.py >`__ varies from type to type at the moment -- the underlying functions will be updated as needed so that all produce the intended output for input PURLs with and without a version.
356
+ The output of the various PURL types currently supported in `fetchcode/package.py ` varies from type to type at the moment -- the underlying functions will be updated as needed so that all produce the intended output for input PURLs with and without a version.
353
357
354
358
355
359
----
356
360
357
361
358
- ' urls' -- collect package URLs for a PURL
362
+ `` urls ``: collect package URLs for a PURL
359
363
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
360
364
361
365
.. code-block :: console
@@ -378,13 +382,13 @@ Examples
378
382
379
383
**Submit multiple PURLs using the command line: **
380
384
381
- .. code-block :: none
385
+ .. code-block :: console
382
386
383
387
purlcli urls --purl pkg:npm/[email protected] --purl pkg:nginx/[email protected] --purl pkg:rubygems/[email protected] --output <path/to/output.json>
384
388
385
389
*Sample output: *
386
390
387
- .. code-block :: console
391
+ .. code-block :: json
388
392
389
393
{
390
394
"headers" : [
@@ -437,13 +441,13 @@ Examples
437
441
438
442
``--head ``
439
443
440
- .. code-block :: none
444
+ .. code-block :: console
441
445
442
446
purlcli urls --purl pkg:npm/[email protected] --purl pkg:nginx/[email protected] --purl pkg:rubygems/[email protected] --output <path/to/output.json> --head
443
447
444
448
*Sample output: *
445
449
446
- .. code-block :: console
450
+ .. code-block :: json
447
451
448
452
{
449
453
"headers" : [
@@ -533,64 +537,7 @@ Examples
533
537
}
534
538
535
539
536
- Notes
540
+ Details
537
541
#######
538
542
539
- - None atm.
540
-
541
-
542
- Testing
543
- -------
544
-
545
- Run all purldb tests:
546
-
547
- .. code-block :: none
548
-
549
- make test
550
-
551
- Run all purlcli non-live tests (i.e., no live network calls):
552
-
553
- .. code-block :: none
554
-
555
- DJANGO_SETTINGS_MODULE=purldb_project.settings pytest -vvs purldb-toolkit/tests/test_purlcli.py
556
-
557
- Run all purlcli live tests (i.e., check actual API endpoints etc.)
558
-
559
- .. code-block :: none
560
-
561
- DJANGO_SETTINGS_MODULE=purldb_project.settings pytest -vvs purldb-toolkit/tests/test_purlcli_live.py --run_live_fetch
562
-
563
-
564
- Funding
565
- -------
566
-
567
- This project was funded through the NGI Assure Fund https://nlnet.nl/assure, a
568
- fund established by NLnet https://nlnet.nl/ with financial support from the
569
- European Commission's Next Generation Internet programme, under the aegis of DG
570
- Communications Networks, Content and Technology under grant agreement No 957073.
571
-
572
- This project is also funded through grants from the Google Summer of Code
573
- program, continuing support and sponsoring from nexB Inc. and generous
574
- donations from multiple sponsors.
575
-
576
-
577
- License
578
- -------
579
-
580
- Copyright (c) nexB Inc. and others. All rights reserved.
581
-
582
- purldb is a trademark of nexB Inc.
583
-
584
- SPDX-License-Identifier: Apache-2.0 AND CC-BY-SA-4.0
585
-
586
- purldb software is licensed under the Apache License version 2.0.
587
-
588
- purldb data is licensed collectively under CC-BY-SA-4.0.
589
-
590
- See https://www.apache.org/licenses/LICENSE-2.0 for the license text.
591
-
592
- See https://creativecommons.org/licenses/by-sa/4.0/legalcode for the license text.
593
-
594
- See https://github.com/nexB/purldb for support or download.
595
-
596
- See https://aboutcode.org for more information about nexB OSS projects.
543
+ None atm.
0 commit comments