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.2.tar.gz (49.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.2-py3-none-any.whl (48.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spdx_python_model-0.0.2.tar.gz
  • Upload date:
  • Size: 49.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.2.tar.gz
Algorithm Hash digest
SHA256 11a420961c7fbf75462b8ee141e8eef6730014f3942838ddb7ec2903087d7f03
MD5 d23ace79eb9dfab0fc56b751accc4e94
BLAKE2b-256 8f268e03e813b445b8d10bfd629d52e63bf3d2875b954e4801cfe39d038e0a01

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for spdx_python_model-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 80b99ed32a15375522dd54ad78c5f11a4e3c5d999f421f4b58089ae1eb5dc4c6
MD5 ab9866eb832d41fa7a96c51be4bb1f5f
BLAKE2b-256 eb6c90eca9a867efd1302d718f72f40f31933b3d5a87e0f1e3bd339c8ea93390

See more details on using hashes here.

Provenance

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