Skip to main content

No project description provided

Project description

protobom-py

CI Status PyPI - Python Version PyPI - Version

protobom-py is a Python wrapper for bom-squad/protobom that can be used to generate both SPDX and CycloneDX SBOMs from Python code. There are two main parts:

  1. protobom_py.sbom_pb2 provides precompiled Protobuf definitions for the Protobom format.
  2. protobom_py.convert() can be used to render SPDX and CycloneDX SBOMS from the Protobom format.

Usage

import protobom_py

document = protobom_py.sbom_pb2.Document()
spdx = protobom_py.convert(document, "spdx")

proto = b"..."
cyclonedx = protobom_py.convert(proto, "cyclonedx")

See tests/test_protobom.py for more in-depth examples.

Development

Tests

The project maintains a strict 100% test coverage. You can run tests locally as follows:

pdm run test

Code Style

The project enforces a consistent code style using Ruff:

pdm run fmt

Architecture

protobom is written in Go, which makes it tricky to distribute Python bindings. While projects such as gopy make it possible to generate CPython extensions, this approach would require {Windows, Linux, macOS} x {Python 3.10, Python 3.11, Python 3.12, ...} individual wheel distributions, which is not very sustainable. To simplify distribution, protobom_py uses an alternative approach:

  1. ./protobom-writer contains a small Go binary that converts a Protobom file to either SPDX or CycloneDX.
  2. This binary is compiled to Go's WebAssembly/WASI target.
  3. protobom_py uses wasmtime to execute the wasm binary when convert() is called.

The WASM binary works across platforms, so only a single binary distribution is needed.

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

protobom_py-0.1b1.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

protobom_py-0.1b1-py3-none-any.whl (2.7 MB view details)

Uploaded Python 3

File details

Details for the file protobom_py-0.1b1.tar.gz.

File metadata

  • Download URL: protobom_py-0.1b1.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for protobom_py-0.1b1.tar.gz
Algorithm Hash digest
SHA256 2933d60c8984dd8cde403080258bdf85422f1aaee15039d2e9e864565bc63d44
MD5 9bbac5afaba09abb4c6f36c0995622be
BLAKE2b-256 302ec1e3d46edabdb752ea00b758f49c3e9628da2c29c2a291197ad196c1e2ec

See more details on using hashes here.

File details

Details for the file protobom_py-0.1b1-py3-none-any.whl.

File metadata

  • Download URL: protobom_py-0.1b1-py3-none-any.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for protobom_py-0.1b1-py3-none-any.whl
Algorithm Hash digest
SHA256 2e7cbb809e5b62e529096c514542ba940f3a39ef786fd02c06b9f6ad2dc6c217
MD5 7a531bfb73350f267d9351e541a43a19
BLAKE2b-256 79ef78d845822c84b9e6e817c06540d7c8aa7953ff91f67cbc8ad3bdcfd2a82a

See more details on using hashes here.

Supported by

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