Validate SPDX expressions
Project description
pyspdx
Short library to validate SPDX expressions. I have not found any working implementation in python and I wanted to mess around with pyparsing anyways.
I meanwhile found a similar library https://pypi.org/project/license-expression/.
API / Usage
This lib only exposes two functions:
from pyspdx import validate, tokenize
validate("MIT") # Valid, does nothing
validate("NotValid") # Throws ValueError
validate("(Apache-2.0 OR MIT) AND BSD-3-Clause") # Valid
validate("(DocumentRef-spdx-tool-1.2:LicenseRef-MIT-Style-2 OR (Apache-2.0 AND PostgreSQL OR OpenSSL)) AND (BSD-3-Clause OR Apache-2.0 WITH 389-exception)") # Valid
assert tokenize("MIT") == ["MIT"]
Used Sources
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyspdx-1.2.0.tar.gz
(12.0 kB
view details)
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
pyspdx-1.2.0-py3-none-any.whl
(13.4 kB
view details)
File details
Details for the file pyspdx-1.2.0.tar.gz.
File metadata
- Download URL: pyspdx-1.2.0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.12.1 Linux/6.8.0-51-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83515cbc384786f8c5fc56a4b903d985fde1d5fd127492d014209b3b726f1636
|
|
| MD5 |
c04c772d5883a09acda2edcfcb092948
|
|
| BLAKE2b-256 |
6975e5b29500833a36ed369909f9e6a0dd448132e2460ca60faf7a32cd81c965
|
File details
Details for the file pyspdx-1.2.0-py3-none-any.whl.
File metadata
- Download URL: pyspdx-1.2.0-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.12.1 Linux/6.8.0-51-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88d360cee40539c36d175d70c855c2a38bed86f77e758d3eda8c7db38629fe3f
|
|
| MD5 |
3557c5cd7d4efbc0bfcb0771cd31368b
|
|
| BLAKE2b-256 |
0456941523d99804067bbfc9a04d0b5807ade0e12b9cce9631a17aa9d6022d8a
|