Skip to main content

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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyspdx-1.2.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

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

Hashes for pyspdx-1.2.0.tar.gz
Algorithm Hash digest
SHA256 83515cbc384786f8c5fc56a4b903d985fde1d5fd127492d014209b3b726f1636
MD5 c04c772d5883a09acda2edcfcb092948
BLAKE2b-256 6975e5b29500833a36ed369909f9e6a0dd448132e2460ca60faf7a32cd81c965

See more details on using hashes here.

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

Hashes for pyspdx-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 88d360cee40539c36d175d70c855c2a38bed86f77e758d3eda8c7db38629fe3f
MD5 3557c5cd7d4efbc0bfcb0771cd31368b
BLAKE2b-256 0456941523d99804067bbfc9a04d0b5807ade0e12b9cce9631a17aa9d6022d8a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page