Parse Apple BOM files using the Rust apple-bom parser
Project description
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 toolchain (stable)
pip
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.
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%.
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. - 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
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 Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyapplebom-0.1.1.tar.gz.
File metadata
- Download URL: pyapplebom-0.1.1.tar.gz
- Upload date:
- Size: 33.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c572abaf21444b0eafdb0ddd86b0362b26d88d14e5b1c2b82535ec9e25f8262
|
|
| MD5 |
1aa16585d96ff7b670384ed53e555c02
|
|
| BLAKE2b-256 |
ab36993bc8db450cfde34f92921e77b0e2efc23f4a673175b75d34455e440d53
|
Provenance
The following attestation bundles were made for pyapplebom-0.1.1.tar.gz:
Publisher:
release.yml on bwhitn/pyapplebom
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyapplebom-0.1.1.tar.gz -
Subject digest:
6c572abaf21444b0eafdb0ddd86b0362b26d88d14e5b1c2b82535ec9e25f8262 - Sigstore transparency entry: 2195711701
- Sigstore integration time:
-
Permalink:
bwhitn/pyapplebom@fa047a67a0ed0af00d85a4fc79d59d78f8b5c90a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/bwhitn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fa047a67a0ed0af00d85a4fc79d59d78f8b5c90a -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyapplebom-0.1.1-cp38-abi3-win_arm64.whl.
File metadata
- Download URL: pyapplebom-0.1.1-cp38-abi3-win_arm64.whl
- Upload date:
- Size: 157.9 kB
- Tags: CPython 3.8+, Windows ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
191b6fa2d42e5e78e0d2427a2d099b140a6cae895edcf004bc8f887c63a5f1d3
|
|
| MD5 |
19cc220b52b786d4af28ca5b8d4b9ed1
|
|
| BLAKE2b-256 |
461cee96430c1b0df4749f8d937bd444fcae0fffbb7b2981063f909b4d504a85
|
Provenance
The following attestation bundles were made for pyapplebom-0.1.1-cp38-abi3-win_arm64.whl:
Publisher:
release.yml on bwhitn/pyapplebom
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyapplebom-0.1.1-cp38-abi3-win_arm64.whl -
Subject digest:
191b6fa2d42e5e78e0d2427a2d099b140a6cae895edcf004bc8f887c63a5f1d3 - Sigstore transparency entry: 2195711708
- Sigstore integration time:
-
Permalink:
bwhitn/pyapplebom@fa047a67a0ed0af00d85a4fc79d59d78f8b5c90a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/bwhitn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fa047a67a0ed0af00d85a4fc79d59d78f8b5c90a -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyapplebom-0.1.1-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: pyapplebom-0.1.1-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 163.4 kB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52d00ce5aacc3b79da910ec09f0e3edbfd539347c61625c4eabd4de801d9cc82
|
|
| MD5 |
5699c2ef8a63c24636306e95e4341c80
|
|
| BLAKE2b-256 |
70cdc1aa0d1098c4f57bae25fcf39bd000cf0559083b172997478103f664234d
|
Provenance
The following attestation bundles were made for pyapplebom-0.1.1-cp38-abi3-win_amd64.whl:
Publisher:
release.yml on bwhitn/pyapplebom
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyapplebom-0.1.1-cp38-abi3-win_amd64.whl -
Subject digest:
52d00ce5aacc3b79da910ec09f0e3edbfd539347c61625c4eabd4de801d9cc82 - Sigstore transparency entry: 2195711724
- Sigstore integration time:
-
Permalink:
bwhitn/pyapplebom@fa047a67a0ed0af00d85a4fc79d59d78f8b5c90a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/bwhitn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fa047a67a0ed0af00d85a4fc79d59d78f8b5c90a -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyapplebom-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pyapplebom-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 249.4 kB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7e4651875d6f6ccd2b044edc986da5bc22bdb232a627e4ae896592a9d3d0096
|
|
| MD5 |
3b129a4bcce9d065ce6f81f3fb2c33a7
|
|
| BLAKE2b-256 |
579354e5e4aee4a8509b0ffb7dc5c0e327998e898518dd484325c15476e9a3d2
|
Provenance
The following attestation bundles were made for pyapplebom-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on bwhitn/pyapplebom
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyapplebom-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
f7e4651875d6f6ccd2b044edc986da5bc22bdb232a627e4ae896592a9d3d0096 - Sigstore transparency entry: 2195711718
- Sigstore integration time:
-
Permalink:
bwhitn/pyapplebom@fa047a67a0ed0af00d85a4fc79d59d78f8b5c90a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/bwhitn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fa047a67a0ed0af00d85a4fc79d59d78f8b5c90a -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyapplebom-0.1.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: pyapplebom-0.1.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 237.6 kB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ab3db485018fc7e84e5e07471ff044f24ab52c53f5d3f46f57d75b5830dce25
|
|
| MD5 |
d77c4219314b5b1a547712bdf368d130
|
|
| BLAKE2b-256 |
e1c387d4abd50c5ab33babdece14bda30d731158f321825447a14ac4af372606
|
Provenance
The following attestation bundles were made for pyapplebom-0.1.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on bwhitn/pyapplebom
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyapplebom-0.1.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
9ab3db485018fc7e84e5e07471ff044f24ab52c53f5d3f46f57d75b5830dce25 - Sigstore transparency entry: 2195711729
- Sigstore integration time:
-
Permalink:
bwhitn/pyapplebom@fa047a67a0ed0af00d85a4fc79d59d78f8b5c90a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/bwhitn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fa047a67a0ed0af00d85a4fc79d59d78f8b5c90a -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyapplebom-0.1.1-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyapplebom-0.1.1-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 226.8 kB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8adea2b714f8a9f34987a237ad6e5adc4e2817a3790b124539f97abfe812818
|
|
| MD5 |
b25f88f36875dbd38607c111981d8722
|
|
| BLAKE2b-256 |
4801463d76ea9658613114a77737a759e3f93adf3d576acdd04f00b9cd813cfe
|
Provenance
The following attestation bundles were made for pyapplebom-0.1.1-cp38-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on bwhitn/pyapplebom
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyapplebom-0.1.1-cp38-abi3-macosx_11_0_arm64.whl -
Subject digest:
f8adea2b714f8a9f34987a237ad6e5adc4e2817a3790b124539f97abfe812818 - Sigstore transparency entry: 2195711737
- Sigstore integration time:
-
Permalink:
bwhitn/pyapplebom@fa047a67a0ed0af00d85a4fc79d59d78f8b5c90a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/bwhitn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fa047a67a0ed0af00d85a4fc79d59d78f8b5c90a -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyapplebom-0.1.1-cp38-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: pyapplebom-0.1.1-cp38-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 235.7 kB
- Tags: CPython 3.8+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aff7b75822efc37d8685f21abef5e9f485351d447011a1008f8af412f1d9b91c
|
|
| MD5 |
1f1c94b00f5b190df737f1ccc1d678fc
|
|
| BLAKE2b-256 |
ce2d34b5dd2d25196bfeed07569d61a19bdd85f7ca18db56f488a6ca394488be
|
Provenance
The following attestation bundles were made for pyapplebom-0.1.1-cp38-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on bwhitn/pyapplebom
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyapplebom-0.1.1-cp38-abi3-macosx_10_12_x86_64.whl -
Subject digest:
aff7b75822efc37d8685f21abef5e9f485351d447011a1008f8af412f1d9b91c - Sigstore transparency entry: 2195711744
- Sigstore integration time:
-
Permalink:
bwhitn/pyapplebom@fa047a67a0ed0af00d85a4fc79d59d78f8b5c90a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/bwhitn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fa047a67a0ed0af00d85a4fc79d59d78f8b5c90a -
Trigger Event:
push
-
Statement type: