pyapplebom
pyapplebom is a Python library for parsing Apple Bill of Materials (BOM) files (commonly found inside .pkg installers).
It uses the Rust crate apple-bom for parsing and exposes rich metadata to Python.
Features
- Full BOM file parsing through Rust
apple-bom - High-level path metadata (
paths,hl_index,size64,vindex) - Low-level metadata:
- BOM header
- blocks index
- variables index
- typed block decoding (
BomInfo,Tree,Paths,PathRecord, etc.)
- Optional raw block bytes (hex encoded)
- Tested interface with a real BOM fixture
- Cross-platform design for Linux, macOS, and Windows
Installation
From PyPI
pip install pyapplebom
From source
Prerequisites:
- Python 3.8+
- Rust 1.98.1 (pinned by
rust-toolchain.toml) pip
Rust 1.83 is the separately tested minimum supported Rust version (MSRV). Release artifacts and the primary development/CI checks use Rust 1.98.1; changing the MSRV does not change the release toolchain.
Install:
python -m venv .venv
source .venv/bin/activate
pip install maturin
pip install -e .
On Windows PowerShell, activate with .venv\\Scripts\\Activate.ps1.
Quick Start
from pathlib import Path
import pyapplebom
bom = pyapplebom.parse_bom_file("/path/to/Bom")
print(bom["header"]["magic"]) # BOMStore
print(len(bom["paths"])) # Number of parsed paths in the Paths tree
print(bom["paths"][0]["path"]) # e.g. "."
print(bom["paths"][0]["symbolic_mode"]) # e.g. drwxr-xr-x
API
parse_bom(data, *, include_blocks=True, include_raw_block_bytes=False, max_input_bytes=134217728, max_paths=250000)
Parse BOM content from bytes-like input.
parse_bom_bytes(data, *, include_blocks=True, include_raw_block_bytes=False, max_input_bytes=134217728, max_paths=250000)
Alias of parse_bom.
parse_bom_file(path, *, include_blocks=True, include_raw_block_bytes=False, max_input_bytes=134217728, max_paths=250000)
Parse BOM content from a file path.
All parsing functions also accept these keyword-only resource limits:
max_input_bytes=134217728: maximum input size (128 MiB)max_paths=250000: maximum declared or traversed paths per optional path section
The defaults are exported as pyapplebom.DEFAULT_MAX_INPUT_BYTES and pyapplebom.DEFAULT_MAX_PATHS. Increase them explicitly only when parsing a trusted BOM that legitimately exceeds a default.
Exceptions
pyapplebom.BomParseError: Raised for BOM parsing errors.
Security Model
BOM files are treated as untrusted binary input. Before invoking the upstream parser, pyapplebom validates the file magic, index and block ranges, count-to-size relationships, path references, traversal cycles, expanded path data, and configured resource limits. Unexpected upstream Rust panics are contained and converted into parse errors.
Validated path plans are materialized directly in one linear pass, so path strings are not rebuilt for every ancestor and repeated references to the same path tree reuse the native result. Each Python section still receives a distinct list, and all prevalidation and resource limits remain in force.
Invalid top-level layout and resource amplification raise BomParseError. An invalid optional section such as Paths is returned as None with details in parse_errors, allowing safe metadata from other sections to remain available. Resource limits bound in-process work; they are not an operating-system sandbox for adversarial parsing.
Return Structure
Each parse call returns a dictionary with these keys:
format: Always"apple-bom"byte_length: Input size in bytessource_path: Included forparse_bom_fileheader: BOM header metadatablocks_index: Index metadata (countand block entries)variables: BOM variables (BomInfo,Paths,HLIndex,VIndex,Size64when present)bom_info: Parsed BomInfo metadata, orNonepaths: Parsed paths list, orNonehl_index: Parsed hard link index paths, orNonesize64: Parsed Size64 paths, orNonevindex: Parsed VIndex paths, orNoneblocks: Parsed block list (typed metadata) wheninclude_blocks=True, elseNoneparse_errors: Optional parse errors for non-fatal sections, orNone
Path entry fields
Path entries in paths/hl_index/size64/vindex include:
path,path_type,path_type_rawfile_mode,symbolic_modeuser_id,group_idmtime,mtime_iso8601size,crc32,link_name
Testing
Run tests:
python -m venv .venv
source .venv/bin/activate
python -m pip install -e '.[dev]'
python -m pytest --cov=pyapplebom --cov-report=term-missing
Run the full local quality and security suite:
cargo fmt --all -- --check
cargo clippy --all-targets --all-features --locked -- -D warnings
cargo test --all-targets --all-features --locked
python -m ruff check .
python -m ruff format --check .
python -m mypy
zizmor --offline --strict-collection --min-severity=medium .
python -m pip_audit --requirement <(python -m pip freeze --all --exclude-editable) --no-deps --strict --progress-spinner=off
cargo audit --deny warnings --file Cargo.lock
CI additionally measures src/validation.rs with cargo-llvm-cov and requires at least 80% line coverage. Python branch coverage is required to remain at 100%.
Verify the declared MSRV separately:
RUSTUP_TOOLCHAIN=1.83.0 cargo check --all-targets --all-features --locked
Run the deterministic release-mode performance suite after maturin develop --release --locked:
python benchmarks/benchmark.py --label local --output /tmp/pyapplebom-benchmark.json
The benchmark methodology and recorded Rust 1.98.1 comparison are in
benchmarks/README.md and
benchmarks/results/2026-09-21-rust-1.98.1.md.
Build and Publish (manual PyPI workflow)
Build wheels and source distribution:
python -m venv .venv
source .venv/bin/activate
pip install maturin
maturin build --release --locked --out dist
maturin sdist --out dist
Artifacts are placed in dist/.
Publish manually with your preferred process (for example twine upload) after validating test/build outputs.
GitHub Tag Release Automation
This repo includes a release workflow at .github/workflows/release.yml that:
- builds wheels for:
- Linux
x86_64andaarch64 - Windows
x86_64andaarch64 - macOS
x86_64andaarch64
- Linux
- builds an sdist
- verifies the tag version matches both
pyproject.tomlandCargo.toml - publishes to PyPI on tags matching
v*(for examplev0.1.0)
Compatibility Notes
- Uses
pyo3withabi3(abi3-py38) for broad CPython binary compatibility. - Uses Rust 1.98.1 for primary CI and release builds, with Rust 1.83 checked as the Cargo MSRV.
- CI runs dependency-free installed-wheel smoke tests on Python 3.8 and the full test suite on a maintained Python release.
- No platform-specific runtime logic is required for parsing.
- Build targets are suitable for Windows, Linux, and macOS when compiled on those platforms.
License
MIT
Metadata
Release files for pyapplebom 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyapplebom-0.1.2.tar.gz | 44.9 kB | With provenance | Details for pyapplebom-0.1.2.tar.gz |
Built distributions (wheels)
Total release size: 1.4 MB
Release files / pyapplebom-0.1.2.tar.gz
| Download URL | pyapplebom-0.1.2.tar.gz |
|---|---|
| Size | 44.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f4eb1a598392f8413df9a8e26668dc3031a0bfc079e3645da3b7f7285a3c7847
|
|
BLAKE2b-256 checksum How to use checksums |
cbcc20db45dd440fe7abe3d32939e29938be6303db8a044a1c91a7989145b058
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logRelease files / pyapplebom-0.1.2-cp38-abi3-win_arm64.whl
| Download URL | pyapplebom-0.1.2-cp38-abi3-win_arm64.whl |
|---|---|
| Size | 163.5 kB |
| Tags | CPython 3.8 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
630246a3fe928c589621586b3887d389bd6828d01c5fc118b7ae9329e9227e15
|
|
BLAKE2b-256 checksum How to use checksums |
acc9a0fac5e6d9f335ca10769c8c1c65e730f0bb4e68af5ce3eb98e6deb71b71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logRelease files / pyapplebom-0.1.2-cp38-abi3-win_amd64.whl
| Download URL | pyapplebom-0.1.2-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 169.1 kB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
4f0b62fe5cd032fa6da5f947784c58542874a5ce1e53ca7dbe906e6e084305f9
|
|
BLAKE2b-256 checksum How to use checksums |
df934bd25cb6e5bd6c9362f99ca2b8642d77a39f4ca13d52093c05414b686dca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logRelease files / pyapplebom-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyapplebom-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 255.9 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e49785fbec7c898652544c3bb799a278bd56a0c6fb75a670c6402ef704e1edad
|
|
BLAKE2b-256 checksum How to use checksums |
efec1fbe6f9309220342b38ee8e29967a67dd8c778bdf7c6f8a39d0bd9fae4ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logRelease files / pyapplebom-0.1.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pyapplebom-0.1.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 245.2 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
a1f7cd8466271c4c3a7da3fea35ef6f6c7d8d952be406167c132dfc18d8621b7
|
|
BLAKE2b-256 checksum How to use checksums |
cb5b1396302a963aefd4b78e8c52e2caa61415b8fcee21c3e99aa4580e521e84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logRelease files / pyapplebom-0.1.2-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | pyapplebom-0.1.2-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 232.3 kB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b47b265d98bdc185fae84aba380fa96060cf2898fcd4ba2bc345c819e1f7875a
|
|
BLAKE2b-256 checksum How to use checksums |
1261359915a8a1609b61b8337ef4fee7f6f35b166f5f4cdd72ef36dd48f8dab6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logRelease files / pyapplebom-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl
| Download URL | pyapplebom-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 242.3 kB |
| Tags | CPython 3.8 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
fcc303a2d2a1251b2235f7c8417e6058b5f84181be2ce0dc83650d28593880f5
|
|
BLAKE2b-256 checksum How to use checksums |
9173f4ea67997fe184dc85299c464c213076fd7d260d19b2096b3b567c7e72c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logSecurity for pyapplebom 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 7 files in this release have been uploaded with provenance metadata.
Attestation for pyapplebom-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.