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.5.tar.gz (138.4 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.5-py3-none-any.whl (74.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for spdx_python_model-0.0.5.tar.gz
Algorithm Hash digest
SHA256 4bcf7c6e5e2e8f0b787ed4eb8fb519e2ed776e820cb6d9eb93e44e98eb92ca2d
MD5 dc596613ce2972d34071c6b48374a811
BLAKE2b-256 735982a21ae7ccb8f136279e409119ef5299d7e0b18f2fb06f684ad1e99a27aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for spdx_python_model-0.0.5.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.5-py3-none-any.whl.

File metadata

File hashes

Hashes for spdx_python_model-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a92fcec60ca766522f9de726013609cf76297d2a43c927aacf24ec915c927c9a
MD5 d5111801db338caebb69d8fe98330542
BLAKE2b-256 faac9f59885b64c896d089737a387b28d5b1a64bf5c6e8fbc37a337e8d36dc70

See more details on using hashes here.

Provenance

The following attestation bundles were made for spdx_python_model-0.0.5-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