Skip to content

Commit 8226591

Browse files
committed
Update PURLdb RTD #249
Reference: aboutcode-org/purldb#249 Signed-off-by: John M. Horan <[email protected]>
1 parent 1996c4f commit 8226591

File tree

1 file changed

+43
-96
lines changed

1 file changed

+43
-96
lines changed

README.rst

+43-96
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,48 @@ purldb-toolkit
44
.. contents:: :local:
55
:depth: 3
66

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.
108

119
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.
1311

1412

1513
Installation
1614
------------
1715

16+
.. code-block:: console
17+
1818
pip install purldb-toolkit
1919
2020
2121
Usage
2222
-----
2323

24-
Use this command to get basic help::
24+
Use this command to get basic help:
25+
26+
.. code-block:: console
2527
2628
$ purlcli --help
2729
Usage: purlcli [OPTIONS] COMMAND [ARGS]...
2830
29-
Return information from a PURL.
31+
Return information from a PURL.
3032
3133
Options:
32-
--help Show this message and exit.
34+
--help Show this message and exit.
3335
3436
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...
3941
4042
4143
And the following subcommands:
4244

43-
'validate' -- validate a PURL
45+
``validate``: validate a PURL
4446
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4547

46-
.. code-block:: none
48+
.. code-block:: console
4749
4850
$ purlcli validate --help
4951
Usage: purlcli validate [OPTIONS]
@@ -61,13 +63,13 @@ Examples
6163

6264
**Submit multiple PURLs using the command line:**
6365

64-
.. code-block:: none
66+
.. code-block:: console
6567
6668
purlcli validate --purl pkg:npm/[email protected] --purl pkg:nginx/[email protected] --output <path/to/output.json>
6769
6870
*Sample output:*
6971

70-
.. code-block:: console
72+
.. code-block:: json
7173
7274
{
7375
"headers": [
@@ -108,31 +110,33 @@ Examples
108110
109111
**Submit multiple PURLs using a .txt file:**
110112

111-
.. code-block:: none
113+
.. code-block:: console
112114
113115
purlcli validate --file <path/to/output.txt> --output <path/to/output.json>
114116
115117
*Sample input.txt:*
116118

117-
.. code-block:: console
119+
.. code-block:: text
118120
119121
120122
121123
122124
123-
Notes
125+
Details
124126
#######
125127

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.
127131

128132

129133
----
130134

131135

132-
'versions' -- collect package versions for a PURL
136+
``versions``: collect package versions for a PURL
133137
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
134138

135-
.. code-block:: none
139+
.. code-block:: console
136140
137141
$ purlcli versions --help
138142
Usage: purlcli versions [OPTIONS]
@@ -150,13 +154,13 @@ Examples
150154

151155
**Submit multiple PURLs using the command line:**
152156

153-
.. code-block:: none
157+
.. code-block:: console
154158
155159
purlcli versions --purl pkg:npm/canonical-path --purl pkg:nginx/nginx --output <path/to/output.json>
156160
157161
*Sample output:*
158162

159-
.. code-block:: console
163+
.. code-block:: json
160164
161165
{
162166
"headers": [
@@ -198,18 +202,18 @@ Examples
198202
}
199203
200204
201-
Notes
205+
Details
202206
#######
203207

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`.
205209

206210
Version information is not needed in submitted PURLs and, if included, will be removed before processing.
207211

208212

209213
----
210214

211215

212-
'metadata' -- collect package metadata for a PURL
216+
``metadata``: collect package metadata for a PURL
213217
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
214218

215219
.. code-block:: console
@@ -231,13 +235,13 @@ Examples
231235

232236
**Submit multiple PURLs using the command line:**
233237

234-
.. code-block:: none
238+
.. code-block:: console
235239
236240
purlcli metadata --purl pkg:openssl/[email protected] --purl pkg:nginx/[email protected] --purl pkg:gnu/[email protected] --output <path/to/output.json>
237241
238242
*Sample output:*
239243

240-
.. code-block:: console
244+
.. code-block:: json
241245
242246
{
243247
"headers": [
@@ -339,23 +343,23 @@ Examples
339343
}
340344
341345
342-
Notes
346+
Details
343347
#######
344348

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`.
346350

347351
The intended output for each PURL type supported by the ``metadata`` command is
348352

349353
- 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
351355

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.
353357

354358

355359
----
356360

357361

358-
'urls' -- collect package URLs for a PURL
362+
``urls``: collect package URLs for a PURL
359363
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
360364

361365
.. code-block:: console
@@ -378,13 +382,13 @@ Examples
378382

379383
**Submit multiple PURLs using the command line:**
380384

381-
.. code-block:: none
385+
.. code-block:: console
382386
383387
purlcli urls --purl pkg:npm/[email protected] --purl pkg:nginx/[email protected] --purl pkg:rubygems/[email protected] --output <path/to/output.json>
384388
385389
*Sample output:*
386390

387-
.. code-block:: console
391+
.. code-block:: json
388392
389393
{
390394
"headers": [
@@ -437,13 +441,13 @@ Examples
437441

438442
``--head``
439443

440-
.. code-block:: none
444+
.. code-block:: console
441445
442446
purlcli urls --purl pkg:npm/[email protected] --purl pkg:nginx/[email protected] --purl pkg:rubygems/[email protected] --output <path/to/output.json> --head
443447
444448
*Sample output:*
445449

446-
.. code-block:: console
450+
.. code-block:: json
447451
448452
{
449453
"headers": [
@@ -533,64 +537,7 @@ Examples
533537
}
534538
535539
536-
Notes
540+
Details
537541
#######
538542

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

Comments
 (0)