Skip to main content

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)

Parse BOM content from bytes-like input.

parse_bom_bytes(data, *, include_blocks=True, include_raw_block_bytes=False)

Alias of parse_bom.

parse_bom_file(path, *, include_blocks=True, include_raw_block_bytes=False)

Parse BOM content from a file path.

Exceptions

  • pyapplebom.BomParseError: Raised for BOM parsing errors.

Return Structure

Each parse call returns a dictionary with these keys:

  • format: Always "apple-bom"
  • byte_length: Input size in bytes
  • source_path: Included for parse_bom_file
  • header: BOM header metadata
  • blocks_index: Index metadata (count and block entries)
  • variables: BOM variables (BomInfo, Paths, HLIndex, VIndex, Size64 when present)
  • bom_info: Parsed BomInfo metadata, or None
  • paths: Parsed paths list, or None
  • hl_index: Parsed hard link index paths, or None
  • size64: Parsed Size64 paths, or None
  • vindex: Parsed VIndex paths, or None
  • blocks: Parsed block list (typed metadata) when include_blocks=True, else None
  • parse_errors: Optional parse errors for non-fatal sections, or None

Path entry fields

Path entries in paths/hl_index/size64/vindex include:

  • path, path_type, path_type_raw
  • file_mode, symbolic_mode
  • user_id, group_id
  • mtime, mtime_iso8601
  • size, crc32, link_name

Testing

Run tests:

python -m venv .venv
source .venv/bin/activate
pip install -e .[test]
pytest -q

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

Artifacts are placed in target/wheels/.

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_64 and aarch64
    • Windows x86_64 and aarch64
    • macOS universal2 (single wheel supporting x86_64 and arm64)
  • builds an sdist
  • verifies the tag version matches both pyproject.toml and Cargo.toml
  • publishes to PyPI on tags matching v* (for example v0.1.0)

Compatibility Notes

  • Uses pyo3 with abi3 (abi3-py38) for broad CPython binary compatibility.
  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyapplebom-0.1.0.tar.gz (20.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyapplebom-0.1.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (213.9 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

pyapplebom-0.1.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (214.3 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

pyapplebom-0.1.0-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (214.3 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

pyapplebom-0.1.0-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (215.7 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

pyapplebom-0.1.0-cp38-abi3-win_arm64.whl (136.9 kB view details)

Uploaded CPython 3.8+Windows ARM64

pyapplebom-0.1.0-cp38-abi3-win_amd64.whl (144.6 kB view details)

Uploaded CPython 3.8+Windows x86-64

pyapplebom-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (222.9 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

pyapplebom-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (214.4 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

pyapplebom-0.1.0-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (411.7 kB view details)

Uploaded CPython 3.8+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file pyapplebom-0.1.0.tar.gz.

File metadata

  • Download URL: pyapplebom-0.1.0.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyapplebom-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1911e26081d1955765c1185864bf5bea920d25c05b4701d7858465348ebe92b4
MD5 44f079ee94d3ca51e0d0c303ddf20542
BLAKE2b-256 6e8dc6013685ad6b6f4ff117214c61b5ace1249a78bf52901018185d17727fcd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyapplebom-0.1.0.tar.gz:

Publisher: release.yml on bwhitn/pyapplebom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyapplebom-0.1.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyapplebom-0.1.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 45a5087a8529b08ecdc9dd8836fc9bfb3446018e6e6216106eef3253492c8680
MD5 d64dddace93c7cf161e1d51c52c673f1
BLAKE2b-256 d35890258b5f1281c2506334146ca986551bedf379389db6520980fdba1d0bec

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyapplebom-0.1.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on bwhitn/pyapplebom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyapplebom-0.1.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyapplebom-0.1.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 26cd9d329b298a0c868c5127de36930b750f7c94d0e9f353a865a40406d67433
MD5 f9fedd5d485fefa3335c2d8f9fa49344
BLAKE2b-256 db697c9ac7f9196914c667fcb5ec42473dd8df1f1a4f641f9ed7bbed054b19d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyapplebom-0.1.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on bwhitn/pyapplebom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyapplebom-0.1.0-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyapplebom-0.1.0-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e5856027d9a2cb394204584b167dfd1ba1597849cd83e4be5f27020cc444fa19
MD5 acf13e32146732fae3857b2baf8a0a39
BLAKE2b-256 7a6189be003bb04baf472f37ef5789215d5858f319732c629f030f4e5ed55bc2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyapplebom-0.1.0-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on bwhitn/pyapplebom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyapplebom-0.1.0-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyapplebom-0.1.0-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3bc3b69ab9c2eee2a50d1d66e04cd32d5577f71b29d16b6af8f8dd1701db270d
MD5 07aa7e2fd9f2f2e4af1882fffbfa826d
BLAKE2b-256 8afcadc85fd5697bebd38a8edb07bfc956d195e02da5eb33b2bf29b7474d74fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyapplebom-0.1.0-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on bwhitn/pyapplebom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyapplebom-0.1.0-cp38-abi3-win_arm64.whl.

File metadata

  • Download URL: pyapplebom-0.1.0-cp38-abi3-win_arm64.whl
  • Upload date:
  • Size: 136.9 kB
  • Tags: CPython 3.8+, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyapplebom-0.1.0-cp38-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 40728ca8b6c115e80fa303dc865d62a695bf23c6780d688b21abba25826bd1d7
MD5 723152340eba909fa45442ddb851df62
BLAKE2b-256 8876f29f64c0b4462b180fccd001ee9a03d5e93d6868f502bd2781fb2e2f2003

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyapplebom-0.1.0-cp38-abi3-win_arm64.whl:

Publisher: release.yml on bwhitn/pyapplebom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyapplebom-0.1.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: pyapplebom-0.1.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 144.6 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyapplebom-0.1.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b22e30592131669c986b4d18d5e8c9d7b5128d4d6f811953a119ab40c7ad3d86
MD5 87e2d961cbf09cb27c0b07f6467d2301
BLAKE2b-256 0cfc941306992b8a8a705625a104bf59b4bf5278dd408c515f4759510dadeff8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyapplebom-0.1.0-cp38-abi3-win_amd64.whl:

Publisher: release.yml on bwhitn/pyapplebom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyapplebom-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyapplebom-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4e3ddc0da3f9cd27aabe9069a299699b7348eb7acbd1f1b183b1bac7a1ed0933
MD5 755a88a891ebf5a2b55cde8c76f111ff
BLAKE2b-256 0e4d76ff3664ad54f9611f6c3d07dd8bcb7473c4b0ec1a0010976bd4b589b995

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyapplebom-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on bwhitn/pyapplebom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyapplebom-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyapplebom-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e7dbe4419313c2941b18b4e63a9b380fc7ec682fd7151d38d17d49d07ce35a12
MD5 c466add7f7f37eab983f8aa768c945be
BLAKE2b-256 e5f0359d7eba0ab9c31ac0d20d6af9e3ef56664be988d133194ac827b4c7114d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyapplebom-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on bwhitn/pyapplebom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyapplebom-0.1.0-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for pyapplebom-0.1.0-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 b402bbcd1400a6cbe0298facc455a2869fe4bb0507a7528adbede86549114454
MD5 c0cae9da4fe3aa1dbd13e221d0791d4f
BLAKE2b-256 2baa9b50ea4dcd62f1284e6d35163f81d5262f36b7cbba8b27049e3727a48313

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyapplebom-0.1.0-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: release.yml on bwhitn/pyapplebom

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