Skip to main content

Python SDK for AIROM — the open-source AI Bill of Materials (AIBOM) scanner

Project description

airom — Python SDK

Python SDK for AIROM, the open-source AI Bill of Materials (AIBOM) scanner. Discover AI assets — models, prompts, datasets, embeddings, vector databases, frameworks, serving infrastructure — across code, containers, and Kubernetes, and get them back as typed Python objects.

pip install airom

Quick start

import airom

inv = airom.fs("./my-app", min_confidence=0.8)

for c in inv.by_kind(airom.ComponentKind.HOSTED_LLM):
    print(c.name, c.provider.or_default("-"), c.confidence)
    for occ in c.evidence.occurrences:
        print(f"   {occ.location.path}:{occ.location.line}  [{occ.detector_id}]")
gpt-4.1 openai 0.87
   src/rag.py:88  [rules/openai/model-literal]
   src/agent.py:12  [rules/openai/sdk-import]

Every component carries the evidence that justifies it — that is the point of AIROM, and the SDK hands you all of it.

Scanning

airom.scan("./app")                       # auto-detect: path, git URL, or image ref
airom.fs("./app")                         # a directory tree
airom.repo("https://github.com/o/r")      # remote (shallow clone) or a local worktree
airom.image(input="img.tar")              # docker save -o img.tar <ref>
airom.k8s(manifests="./deploy")           # offline: enumerate workload images
airom.version()                           # the underlying binary's ToolInfo

Common keyword args mirror the CLI flags: select, rules, ignore, min_confidence, max_file_size, io_budget, parallel, no_cache, cache_dir, offline, stats, plus binary, timeout, and cwd. None leaves the tool's own default in place — the SDK never invents defaults.

min_confidence=0.8 is the practical high-signal filter: on general-purpose directories, extension-only dataset detection and keyword-only generation-param detection emit low-confidence (0.5–0.6) noise. Note the application root always survives the filter — it is the scan target, not a finding.

select tokens are detector IDs or tags, not languages — "-dataset/file", not "python". Run airom detectors list (or airom.raw(["detectors", "list"])) to see them.

Not wired yet: pulling an image from a live registry/daemon, and live-cluster Kubernetes scanning. Both fail with a clear error. Use image(input=...) / an OCI layout and k8s(manifests=...) today.

Tri-state fields

version, provider, download_location and release_time are tri-state, and the SDK preserves the distinction rather than collapsing it into None:

JSON Meaning Opt
key omitted does not apply Presence.ABSENT
null applies, but undetermined (SPDX NOASSERTION) Presence.UNKNOWN
a value known Presence.KNOWN
c.version.known           # bool — only True when a real value is present
c.version.or_none()       # value, or None (collapses absent and unknown)
c.version.or_default("-") # value, or your fallback
c.version.presence        # the full distinction, when you need it

Navigating the graph

inv.components                  # sorted, deterministic
inv.by_kind("vector-db", "framework")
inv.get("airom:1f3a9b2c4d5e6f70")
inv.application                 # the scan-root component
inv.edges_from(c.id)            # typed, evidenced relationships
inv.unknowns                    # "looked relevant, could not process" — honesty channel
inv.stats.files_walked          # requires stats=True
len(inv); [c for c in inv]      # Inventory is sized and iterable

CI gating

A fail_on match is a verdict, not an error — the scan succeeded and the AIBOM is complete, so it is reported rather than raised:

res = airom.execute(
    ["fs", "./app"],
    options=airom.ScanOptions(fail_on="hosted-llm&confidence>=0.9", exit_code=7),
)
if res.policy_matched:
    raise SystemExit(res.exit_code)

Often you don't need fail_on at all — you have the whole graph, so gate in Python:

risky = [c for c in inv if c.model and c.model.pickle_risk]
if risky:
    raise SystemExit(f"unsafe pickle globals in: {[c.name for c in risky]}")

Errors

Exception Raised when
BinaryNotFoundError the airom executable could not be located
ScanError a fatal scan failure (exit 2): unreadable target, clone failure, bad flags
OutputError no parseable AIBOM, or an unsupported schemaVersion

Detector errors are not exceptions: they degrade to inv.unknowns records and the scan still succeeds. That is AIROM's degrade-by-default contract, and the SDK preserves it.

The binary

The SDK shells out to the airom binary and decodes its native JSON — the lossless superset every other format (CycloneDX, SARIF, YAML, table) projects from. Resolution order:

  1. the binary= argument
  2. a copy bundled in the wheel (airom/_bin/airom)
  3. $AIROM_BINARY
  4. airom on PATH

Platform wheels bundle the binary, so pip install airom is self-contained. Installing from an sdist does not — put airom on your PATH (go install github.com/airomhq/airom/cmd/airom@latest) or set $AIROM_BINARY.

Development

cd sdk/python
pip install -e ".[dev]"
pytest            # builds the binary from the checkout and tests against it
mypy && ruff check .

The suite runs against the real binary, not mocks: a wrapper tested only against mocks proves nothing about the contract it wraps.

Building a wheel needs the Go toolchain (the build hook compiles the binary with CGO_ENABLED=0). Set AIROM_SKIP_BUNDLE=1 for a pure-Python wheel.

Publishing

Releases are published by .github/workflows/release-pypi.yml using PyPI Trusted Publishing (OIDC): GitHub Actions authenticates to PyPI directly, so there is no API token stored as a secret, and none to leak or rotate.

One-time setup

On pypi.org/manage/account/publishing, add a pending publisher:

Field Value
PyPI project name airom
Owner airomhq
Repository name airom
Workflow name release-pypi.yml
Environment (leave blank)

That is all — no secret is added to GitHub.

Cutting a release

The workflow runs on every push to main that touches the SDK or the scanner, but publishes only when the version is new: PyPI permanently refuses to re-upload a version (even a deleted one), so the workflow compares __version__ against the index and skips cleanly if it is already there.

So a release is exactly one deliberate act:

# sdk/python/src/airom/__init__.py
__version__ = "0.1.0"     # bump, commit, merge to main -> published

Publishing is irreversible: a version number is burned forever once used, and yanking does not free it. Test the whole path first with the manual workflow_dispatch run against TestPyPI (which needs its own pending publisher at test.pypi.org).

License

Apache-2.0, same as AIROM.

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

airom-0.1.0.tar.gz (19.9 kB view details)

Uploaded Source

Built Distributions

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

airom-0.1.0-py3-none-win_amd64.whl (5.4 MB view details)

Uploaded Python 3Windows x86-64

airom-0.1.0-py3-none-musllinux_1_2_x86_64.whl (5.2 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

airom-0.1.0-py3-none-musllinux_1_2_aarch64.whl (4.7 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

airom-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

airom-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

airom-0.1.0-py3-none-macosx_11_0_arm64.whl (4.8 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

airom-0.1.0-py3-none-macosx_10_9_x86_64.whl (5.3 MB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for airom-0.1.0.tar.gz
Algorithm Hash digest
SHA256 63b21b429afedd0c22add63f796809401bae7593099004370f30b7720e281f87
MD5 10a05576e0af8e4799753c4257c9bb57
BLAKE2b-256 c083b996e1517866c9bb753e85c9026a64caede27e45ad77c064a2f364264ff4

See more details on using hashes here.

Provenance

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

Publisher: release-pypi.yml on airomhq/airom

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

File details

Details for the file airom-0.1.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: airom-0.1.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 5.4 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for airom-0.1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 f78763f88a50bbad056d2e1aa5f6eb7bb24c952c3131f3f63a70beba0333f86a
MD5 886fc3cd745f0e32869c7c5723dd9fd0
BLAKE2b-256 6df8941730c16f045582e3a1fca9029a9623354f90d86b9349f1444746b96b45

See more details on using hashes here.

Provenance

The following attestation bundles were made for airom-0.1.0-py3-none-win_amd64.whl:

Publisher: release-pypi.yml on airomhq/airom

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

File details

Details for the file airom-0.1.0-py3-none-musllinux_1_2_x86_64.whl.

File metadata

  • Download URL: airom-0.1.0-py3-none-musllinux_1_2_x86_64.whl
  • Upload date:
  • Size: 5.2 MB
  • Tags: Python 3, musllinux: musl 1.2+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for airom-0.1.0-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 aca12de3669d60f7a8fad181818a6ded9c324f99339e61c357d82e73fe47a5ca
MD5 e20d9f807e56bb555d822395cb028cb0
BLAKE2b-256 2841d6bf3d41aee38e64ae071f070e29ba99abf990dc7dd7ff3371d3bae097f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for airom-0.1.0-py3-none-musllinux_1_2_x86_64.whl:

Publisher: release-pypi.yml on airomhq/airom

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

File details

Details for the file airom-0.1.0-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for airom-0.1.0-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 74bb52b3754a6b98649e924455ec93f2ddb2147325f89ecd013239af2eaae0a2
MD5 e2b25b58327d1005567f9909ea9fd5f0
BLAKE2b-256 14cf3f055d450845af1ef409cba58c2a215f90edfed47198b5545bf5b9a74b41

See more details on using hashes here.

Provenance

The following attestation bundles were made for airom-0.1.0-py3-none-musllinux_1_2_aarch64.whl:

Publisher: release-pypi.yml on airomhq/airom

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

File details

Details for the file airom-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for airom-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a9c77c4a6bed462cc6592137e7d88398a1d1115cdb4400b13d54219383249d82
MD5 8d5d02978a1fcbe0b4bd361b3cd13059
BLAKE2b-256 d2501e3c8f93690f96af7b088fbc144b7b2150b509a9ffc8335894662020a969

See more details on using hashes here.

Provenance

The following attestation bundles were made for airom-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-pypi.yml on airomhq/airom

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

File details

Details for the file airom-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for airom-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c6a6c54676436d5fb65ee705c0ee4acbeb0ec3f1427896a440ce6a000c1b4335
MD5 09b439cc22f1cfb47b70e9858a6602ec
BLAKE2b-256 4a6e4f05d5960e805ba8e56eccc5bfb7d32090fc4a015c6bf0ca8afb627534f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for airom-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release-pypi.yml on airomhq/airom

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

File details

Details for the file airom-0.1.0-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: airom-0.1.0-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 4.8 MB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for airom-0.1.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4b699e23b97a69f77020f9363d566123ec8bac0657905d68c5190ed61d2a2392
MD5 39639177d5d10ba4e8e3f18889f8e898
BLAKE2b-256 8a8e743269d0a181ad1741760a23277a314875de4bf2bf0b6f4078b516a7f576

See more details on using hashes here.

Provenance

The following attestation bundles were made for airom-0.1.0-py3-none-macosx_11_0_arm64.whl:

Publisher: release-pypi.yml on airomhq/airom

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

File details

Details for the file airom-0.1.0-py3-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for airom-0.1.0-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3d1c9630147018ad6a540121eb1a9219f64f7bac8c8c56ddffa62d18ea3f6741
MD5 33d1908a4a4632b4aa53d91ee8693e2a
BLAKE2b-256 b759ff123f2ad22f06c6c1945c577561604572da146e0b16cc476e3a59d6ad1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for airom-0.1.0-py3-none-macosx_10_9_x86_64.whl:

Publisher: release-pypi.yml on airomhq/airom

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