SPDX 3 Validation Tool
Validates SPDX 3 documents
While standalone tools like pyshacl and check-jsonschema can be used to
validate SPDX 3 documents, there are a few context-aware checks that can be
useful. This includes:
- Ignored SHACL errors for missing
spdxIds if they are defined in anExternalMap - Validation that any
spdxIddefined in anExternalMapare not present in the document - SHACL Validation of merged documents (in this way, if you reference an
spdxIdfrom anExternalMapand then pass the document that provides thatspdxId, the type can be validated) - (Hopefully) More useful JSON schema error output
Installation
spdx3-validate can be installed using pip:
python3 -m pip install spdx3-validate
Using as a library
spdx3-validate can also be used programmatically.
validate() takes a single source or an iterable of sources
(a path or a URL) and returns a ValidationResult:
import spdx3_validate
result = spdx3_validate.validate("doc.spdx3.json")
if not result:
print(result) # prints the errors, one per line
# Or inspect the individual findings:
for error in result.errors:
print(error)
- The SPDX version is detected from each document's
@context; passversion="X.Y"to force one. - Set
check_merged=Trueto also validate the merged graph of several documents together. - A document that cannot be loaded (missing
@context, unknown version, incompatible versions) raisesspdx3_validate.SpdxValidateError.
Developing
Developing on spdx3-validate is best done using a virtual environment. You
can configure one and install spdx3-validate in editable mode with all
necessary development dependencies by running:
python3 -m venv .venv
. .venv/bin/activate
pip install -e ".[dev]"
TODO
- Option to automatically download dependencies based on
locationHint - Offline validation?
- Cache downloaded context
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spdx3_validate-0.0.7.tar.gz.
File metadata
- Download URL: spdx3_validate-0.0.7.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
167d4f18ecd643af80290d8b3edde16e9142f528a013b7e45be712e539b5b93a
|
|
| MD5 |
98c3d84b8ee239e1665f7b12cd7c9d55
|
|
| BLAKE2b-256 |
5297ddfbdf43953f7f284ce4b1b495b86091e1c30253fe5218297d934070e4de
|
Provenance
The following attestation bundles were made for spdx3_validate-0.0.7.tar.gz:
Publisher:
publish.yaml on JPEWdev/spdx3-validate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spdx3_validate-0.0.7.tar.gz -
Subject digest:
167d4f18ecd643af80290d8b3edde16e9142f528a013b7e45be712e539b5b93a - Sigstore transparency entry: 2409300515
- Sigstore integration time:
-
Permalink:
JPEWdev/spdx3-validate@1a167d0ff50b38c55aed9e802c02012696830107 -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/JPEWdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@1a167d0ff50b38c55aed9e802c02012696830107 -
Trigger Event:
release
-
Statement type:
File details
Details for the file spdx3_validate-0.0.7-py3-none-any.whl.
File metadata
- Download URL: spdx3_validate-0.0.7-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
722759285636c8e73e6485d5789128e7af1911c0586d7a1bd07c42f8644d091f
|
|
| MD5 |
81b06c393d756d9c7e3a545006a6fafc
|
|
| BLAKE2b-256 |
3d5c8d091c82061bd96d5bcc3b47edb98810ee9c6adde95910a7f6cb86a233b0
|
Provenance
The following attestation bundles were made for spdx3_validate-0.0.7-py3-none-any.whl:
Publisher:
publish.yaml on JPEWdev/spdx3-validate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spdx3_validate-0.0.7-py3-none-any.whl -
Subject digest:
722759285636c8e73e6485d5789128e7af1911c0586d7a1bd07c42f8644d091f - Sigstore transparency entry: 2409300764
- Sigstore integration time:
-
Permalink:
JPEWdev/spdx3-validate@1a167d0ff50b38c55aed9e802c02012696830107 -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/JPEWdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@1a167d0ff50b38c55aed9e802c02012696830107 -
Trigger Event:
release
-
Statement type: