Skip to content

Commit 7881f7e

Browse files
include basic documentation on the SPDX 3 part of the library
Signed-off-by: Armin Tänzer <armin.taenzer@tngtech.com>
1 parent f2d9291 commit 7881f7e

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,14 @@ This library implements SPDX parsers, convertors, validators and handlers in Pyt
4444
* visualize the structure of a SPDX document by creating an `AGraph`. Note: This is an optional feature and requires
4545
additional installation of optional dependencies
4646

47-
# Planned features
47+
## Experimental support for SPDX 3.0
48+
* Create v3.0 elements and payloads
49+
* Convert v2.2/v2.3 documents to v3.0
50+
* Serialize to JSON-LD
51+
52+
See [Quickstart to SPDX 3.0](#quickstart-to-spdx-30) below.
53+
The implementation is based on the descriptive markdown files in the repository https://github.com/spdx/spdx-3-model (latest commit: ea2e1446ae937c6722b3f599f95813f8747d54b4).
4854

49-
* up-to-date support of SPDX v3.0 as soon as it is released
5055

5156
# Installation
5257

@@ -163,6 +168,20 @@ if not validation_messages:
163168
write_file(document, "new_spdx_document.rdf", validate=False)
164169
```
165170

171+
# Quickstart to SPDX 3.0
172+
In contrast to SPDX v2, all elements are now subclasses of the central `Element` class.
173+
This includes packages, files, snippets, relationships, annotations, but also SBOMs, SpdxDocuments, and more.
174+
For serialization purposes, all Elements that are to be serialized into the same file are collected in a `Payload`.
175+
This is just a dictionary that maps each Element's SpdxId to itself.
176+
Use the `write_payload()` functions to serialize a payload.
177+
There currently are two options:
178+
* The `spdx_tools.spdx3.writer.json_ld.json_ld_writer` module generates a JSON-LD file of the payload.
179+
* The `spdx_tools.spdx3.writer.console.payload_writer` module prints a debug output to console. Note that this is not an official part of the SPDX specification and will probably be dropped as soon as a better standard emerges.
180+
181+
You can convert an SPDX v2 document to v3 via the `spdx_tools.spdx3.bump_from_spdx2.spdx_document` module.
182+
The `bump_spdx_document()` function will return a payload containing an `SpdxDocument` Element and one Element for each package, file, snippet, relationship, or annotation contained in the v2 document.
183+
184+
166185
# Dependencies
167186

168187
* PyYAML: https://pypi.org/project/PyYAML/ for handling YAML.

src/spdx_tools/spdx3/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)