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.5.tar.gz (25.4 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.5-cp312-cp312-win_amd64.whl (616.8 kB view details)

Uploaded CPython 3.12Windows x86-64

py_a2lfile-0.0.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (812.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

py_a2lfile-0.0.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (763.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

File details

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

File metadata

  • Download URL: py_a2lfile-0.0.5.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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.5.tar.gz
Algorithm Hash digest
SHA256 c60e2d5953fa77fdfe9c02f0a06b8294bcecde95616dc6d43ea7d192809747bf
MD5 2bd2e57edd2cd5c8b0cd00344e6b0aab
BLAKE2b-256 b45fe33acbb831e0a9860e2398fe7386d1497cb87ef69b1ca2970d6f2935e3e9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_a2lfile-0.0.5-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 616.8 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a1bbbafc9d4302e68a3fd9b53614c2e362df7457e5db0931c1e034d0770690ad
MD5 6bb7c6527f03cd61294cd1c86387dac8
BLAKE2b-256 0ad50b846fbced6ffded0fdd8c7972fdfcf10ad1e60217b5a9bb5954e901eb67

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_a2lfile-0.0.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 812.3 kB
  • Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cdb5053aa5c6a331f060e29c9b99f6c3e948190711f41e2702a6ca291908cfcd
MD5 90bb9d1ff15ae89c82fec72584313ca7
BLAKE2b-256 ae7769fee0803e0507a29cae411c30b2e9f9ba05972ee2eed2eb99aa7337049e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_a2lfile-0.0.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 763.6 kB
  • Tags: CPython 3.12, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b9419c9b8db48ad9b297e2a0ab6bba9429a6665911ad9d95c85d3efc475751db
MD5 0171b97fe704f92508b99ae18afbd191
BLAKE2b-256 f5c71732ad3cfeac2e1eb6a2399b8b08d34e7fe6cb0eaa17fb62c12f04d35cb9

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