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.4.tar.gz (24.9 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.4-cp312-cp312-win_amd64.whl (733.1 kB view details)

Uploaded CPython 3.12Windows x86-64

py_a2lfile-0.0.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (937.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

py_a2lfile-0.0.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (876.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

File details

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

File metadata

  • Download URL: py_a2lfile-0.0.4.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","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.4.tar.gz
Algorithm Hash digest
SHA256 e0fa5de48b68c0b39959909a3baae18798bd450e783c3482b8aac07c655d55d1
MD5 037483b0bb996c10f2d6d9abfb46145c
BLAKE2b-256 1622aa00b4e476fd93a08b306e4800be4d754afc184d08317f489a467f165dff

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_a2lfile-0.0.4-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 733.1 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","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.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3adbeec28c6fe8997f1357a195a5ddf429b929fe1f86a985bcf285c7e56069d5
MD5 1184e54e8a883cce98ef33e35b105c11
BLAKE2b-256 2e2de47dc8211aa68caaab2053e3b76682d5754b0aa8c3bb12d11b718c8a8c2e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_a2lfile-0.0.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 937.0 kB
  • Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","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.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 773f5f64eaee795e486e6832396bc3de74dc0ceaa6e6f8fadf82325cf146e53d
MD5 50606216744f788305f7c384972de292
BLAKE2b-256 c853c5df845e1f36bdd34d568d38d8e5a90a3e2a3f20eb9bd81af5774c6989d9

See more details on using hashes here.

File details

Details for the file py_a2lfile-0.0.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

  • Download URL: py_a2lfile-0.0.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 876.3 kB
  • Tags: CPython 3.12, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","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.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6ef12cc68d00adf0d4f2ab1b817aa729c89fc66b6260792e84a4eec64d128584
MD5 566b9d8044cc6dd563889ac8c64c1bfe
BLAKE2b-256 dd0a0e43484d0b884d93b18b33be5fd21cb4767107997a593b2cfa016e5ddf1b

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