No project description provided
Project description
protobom-py
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:
- protobom_py.sbom_pb2 provides precompiled Protobuf definitions for the Protobom format.
- 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:
./protobom-writer
contains a small Go binary that converts a Protobom file to either SPDX or CycloneDX.- This binary is compiled to Go's WebAssembly/WASI target.
protobom_py
useswasmtime
to execute the wasm binary whenconvert()
is called.
The WASM binary works across platforms, so only a single binary distribution is needed.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2933d60c8984dd8cde403080258bdf85422f1aaee15039d2e9e864565bc63d44 |
|
MD5 | 9bbac5afaba09abb4c6f36c0995622be |
|
BLAKE2b-256 | 302ec1e3d46edabdb752ea00b758f49c3e9628da2c29c2a291197ad196c1e2ec |
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e7cbb809e5b62e529096c514542ba940f3a39ef786fd02c06b9f6ad2dc6c217 |
|
MD5 | 7a531bfb73350f267d9351e541a43a19 |
|
BLAKE2b-256 | 79ef78d845822c84b9e6e817c06540d7c8aa7953ff91f67cbc8ad3bdcfd2a82a |