Skip to main content

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

Release files for pyspdx 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyspdx 1.2.0
File Size Uploaded
pyspdx-1.2.0.tar.gz 12.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyspdx 1.2.0
File Interpreter ABI Platform
pyspdx-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.4 kB

Release files / pyspdx-1.2.0.tar.gz

Download URL pyspdx-1.2.0.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
83515cbc384786f8c5fc56a4b903d985fde1d5fd127492d014209b3b726f1636
BLAKE2b-256 checksum
How to use checksums
6975e5b29500833a36ed369909f9e6a0dd448132e2460ca60faf7a32cd81c965
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.12.1 Linux/6.8.0-51-generic

Release files / pyspdx-1.2.0-py3-none-any.whl

Download URL pyspdx-1.2.0-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
88d360cee40539c36d175d70c855c2a38bed86f77e758d3eda8c7db38629fe3f
BLAKE2b-256 checksum
How to use checksums
0456941523d99804067bbfc9a04d0b5807ade0e12b9cce9631a17aa9d6022d8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.12.1 Linux/6.8.0-51-generic

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page