Skip to main content

Parse-only Python bindings for the a2lfile Rust crate

Project description

py-a2lfile

CI license

py-a2lfile is a Python wrapper around the Rust crate a2lfile. It provides a small, read-only API for loading and inspecting A2L files from Python while relying on the upstream Rust implementation for parsing performance and stability.

Current Capabilities

  • Parse A2L content from a file path with a2lfile.load(...)
  • Parse A2L content directly from a string with a2lfile.load_from_string(...)
  • Inspect modules and measurements through a small, read-only Python API
  • Access conversion metadata including COMPU_METHOD, COMPU_TAB, COMPU_VTAB, and COMPU_VTAB_RANGE
  • Resolve references from measurements to conversion tables and engineering units
  • Inspect module-level metadata such as MOD_COMMON, MOD_PAR, and unit definitions
  • Traverse generic IF_DATA, including tagged structures used for XCP-oriented extraction
  • Access detailed measurement metadata such as annotations, bit operations, addresses, refresh information, symbol links, and virtual channels
  • Stable and fast parsing backed by the Rust a2lfile library
  • Typed distribution with _a2lfile.pyi and py.typed
  • Intended for CPython 3.12

Limitations

  • Parse-only API; this package does not currently provide editing or write-back support
  • Intentionally small wrapper surface focused on inspection rather than full ASAP2 authoring workflows
  • Currently targeted at CPython 3.12 rather than a broad ABI-compatible interpreter matrix

Installation

pip install py-a2lfile

The package is installed from PyPI as py-a2lfile, but imported in Python as a2lfile.

Example

import a2lfile

a2l = a2lfile.load("example.a2l")

for module in a2l.modules:
    print(module.name)
    for measurement in module.measurements:
        print(" ", measurement.name, measurement.conversion)

Development

uv sync --dev --python python3.12
uv run maturin develop --uv
uv run pytest

Acknowledgements

This package is a Python wrapper around the Rust crate a2lfile.

Credit for the underlying A2L parsing implementation belongs to the a2lfile authors and maintainers. This wrapper exists to make that parser available from Python, because a2lfile was the most capable and well-maintained A2L parser identified for this use case.

License

Licensed under either of:

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

py_a2lfile-0.0.3.tar.gz (24.8 kB view details)

Uploaded Source

Built Distributions

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

py_a2lfile-0.0.3-cp312-cp312-win_amd64.whl (732.4 kB view details)

Uploaded CPython 3.12Windows x86-64

py_a2lfile-0.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (936.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

File details

Details for the file py_a2lfile-0.0.3.tar.gz.

File metadata

  • Download URL: py_a2lfile-0.0.3.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for py_a2lfile-0.0.3.tar.gz
Algorithm Hash digest
SHA256 8e0b526072c50cc73dd0571d59a48494af6dc768bc9eae9737070c64c53eeb6b
MD5 3734046dcd3fe45063e6a19688183e96
BLAKE2b-256 62c178dc38b386560ab925dfd89999be3a31dbe46a534fb160475d57a7871bcb

See more details on using hashes here.

File details

Details for the file py_a2lfile-0.0.3-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: py_a2lfile-0.0.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 732.4 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for py_a2lfile-0.0.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 12ebcbe7e09304a3144daf2d3a93a59d4f2f83f0634d78b3f1d180b61f2f8f08
MD5 8cd9eca56da24277066edb7bf139e641
BLAKE2b-256 4496f12327e4759b2256d205c170e52e7ee699591935c84d9b338496539849af

See more details on using hashes here.

File details

Details for the file py_a2lfile-0.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: py_a2lfile-0.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 936.5 kB
  • Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for py_a2lfile-0.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c8da213e5e4a10ff610ca4b0fdcf60defb1afb6488662294bafa55b308246488
MD5 9f8ec7338b4e4aa1cf32f893c2e41357
BLAKE2b-256 a66f34a8c958bbe43ae1971d2d64e71d82be3b4e7342a576899d96a3884ba408

See more details on using hashes here.

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