Parse-only Python bindings for the a2lfile Rust crate
Project description
py-a2lfile
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, andCOMPU_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
a2lfilelibrary - Typed distribution with
_a2lfile.pyiandpy.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:
- Apache License, Version 2.0 (
LICENSE-APACHEor http://www.apache.org/licenses/LICENSE-2.0) - MIT license (
LICENSE-MITor http://opensource.org/licenses/MIT)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e0b526072c50cc73dd0571d59a48494af6dc768bc9eae9737070c64c53eeb6b
|
|
| MD5 |
3734046dcd3fe45063e6a19688183e96
|
|
| BLAKE2b-256 |
62c178dc38b386560ab925dfd89999be3a31dbe46a534fb160475d57a7871bcb
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12ebcbe7e09304a3144daf2d3a93a59d4f2f83f0634d78b3f1d180b61f2f8f08
|
|
| MD5 |
8cd9eca56da24277066edb7bf139e641
|
|
| BLAKE2b-256 |
4496f12327e4759b2256d205c170e52e7ee699591935c84d9b338496539849af
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8da213e5e4a10ff610ca4b0fdcf60defb1afb6488662294bafa55b308246488
|
|
| MD5 |
9f8ec7338b4e4aa1cf32f893c2e41357
|
|
| BLAKE2b-256 |
a66f34a8c958bbe43ae1971d2d64e71d82be3b4e7342a576899d96a3884ba408
|