Skip to main content

SPDX Model Python Bindings

Project description

spdx-python-model

Generated Python code for SPDX Spec version 3

All bindings in this repository are generated using shacl2code at the time the package is built.

NOTE: The bindings are pretty low level, intended for more directly manipulating SPDX files. While they are fully functions, they lack higher level helper functions that may be useful for creating SPDX documents. If you want a higher level approach, please see the SPDX Python Tools (however this repo doesn't yet support SPDX 3)

Installation (PyPi)

python3 -m pip install spdx-python-model

Installation (Git)

If you would like to pull the bindings directly from Git instead of using a released version from PyPi, the following command can be used:

python3 -m pip install git+https://github.com/spdx/spdx-python-model.git@main

Note that this will pull the latest version from the main branch. If you want a specific commit, replace main with the git commit SHA

Usage

Each version of the SPDX spec has a module named v{MAJOR}_{MINOR}_{MICRO} that contains the bindings for that version under the spdx_python_model top level. For example:

import spdx_python_model

p = spdx_python_model.v3_0_1.Person()

Alternatively, if a shorter name is desired, a specific version can be imported with another name:

from spdx_python_model import v3_0_1 as spdx_3_0

p = spdx_3_0.Person()

Testing

This repository has support for running tests against the bindings using pytest. To run the tests, first setup a virtual environment and install the development variant of the package in editable mode:

python3 -m venv .venv
. .venv/bin/activate
pip install -e '.[dev]'

Then the tests can be run with:

pytest -vx

Making a new release

To make a new release of this repository, bump the version number found in src/spdx_python_model/version.py, and merge it into the repo. After this, make a new release in GitHub with the name v + VERSION, where VERSION matches the version number specified in version.py (e.g. v1.0.0).

After this, GitHub actions will do the rest to build the package and publish it to PyPi

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

spdx_python_model-0.0.3.tar.gz (52.8 kB view details)

Uploaded Source

Built Distribution

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

spdx_python_model-0.0.3-py3-none-any.whl (51.5 kB view details)

Uploaded Python 3

File details

Details for the file spdx_python_model-0.0.3.tar.gz.

File metadata

  • Download URL: spdx_python_model-0.0.3.tar.gz
  • Upload date:
  • Size: 52.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for spdx_python_model-0.0.3.tar.gz
Algorithm Hash digest
SHA256 1a10e476d9b1ffac5363586a20e653dd71d9ff2bb9d4534462fb1208e978035d
MD5 593d5c3d1918474bcba794f2859d615e
BLAKE2b-256 bdd71806750dbcc2b11f04f863ec6be52a7e2a2ff7b6a572e4dbb4cae8ffdc1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for spdx_python_model-0.0.3.tar.gz:

Publisher: publish.yaml on spdx/spdx-python-model

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spdx_python_model-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for spdx_python_model-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6b16283a05ba3f2fa76d24fe9d4042e86d47b3d829256dc7012abb4b8559f91d
MD5 7d6d8b7b25755353797932ecf08c5134
BLAKE2b-256 10dc61965fd7391b31c0c0eaefa1f393d56d64e7c2c7d770de964275cde58dba

See more details on using hashes here.

Provenance

The following attestation bundles were made for spdx_python_model-0.0.3-py3-none-any.whl:

Publisher: publish.yaml on spdx/spdx-python-model

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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