Skip to main content

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:

Metadata

Release files for py-a2lfile 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-a2lfile 0.0.7
File Size Uploaded
py_a2lfile-0.0.7.tar.gz 27.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for py-a2lfile 0.0.7
File Interpreter ABI Platform
py_a2lfile-0.0.7-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
py_a2lfile-0.0.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
py_a2lfile-0.0.7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details

Total release size: 2.2 MB

Release files / py_a2lfile-0.0.7.tar.gz

Download URL py_a2lfile-0.0.7.tar.gz
Size 27.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f9755cc4eee3ee1f3d0cbd5c1c27fe9afea327f698e32a6223639a98883b4647
BLAKE2b-256 checksum
How to use checksums
30800c3e94b4a17312094937011570c8075c4551ebb17cee59cbd86cefd60d6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.2 {"installer":{"name":"uv","version":"0.12.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}

Release files / py_a2lfile-0.0.7-cp312-cp312-win_amd64.whl

Download URL py_a2lfile-0.0.7-cp312-cp312-win_amd64.whl
Size 625.3 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
20f4366a58f9f5bdbf252e408b76dd3e15907584a9f92fdc9aa43ced2859ac3b
BLAKE2b-256 checksum
How to use checksums
4b968dc7d4b5d5a52b866c92c66c8cb72cd4eb73f264d8f2b8611e7357a2ccdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.2 {"installer":{"name":"uv","version":"0.12.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}

Release files / py_a2lfile-0.0.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL py_a2lfile-0.0.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 811.2 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c328149c504b7fb2c845d93e3cbb39c28b065bffa1c9a36011564bad7b3c7966
BLAKE2b-256 checksum
How to use checksums
4acbb04f66737500eda471a8dfab84e155e7f61666f8a5aa8ad894ec46ea45a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.2 {"installer":{"name":"uv","version":"0.12.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}

Release files / py_a2lfile-0.0.7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL py_a2lfile-0.0.7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 761.4 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
7e1cdc5b77efd6791d09a0b14d351bbceb47d3fe8bed0a53ef32c819520c423f
BLAKE2b-256 checksum
How to use checksums
5863fd90c4f039c31f46af4ed33fbf1baf4e23fec4a7395540fdfed43810465b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.2 {"installer":{"name":"uv","version":"0.12.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}

Release history Release notifications | RSS feed

0.0.9

4 release files

0.0.8

4 release files

This release

0.0.7 This release

4 release files

0.0.6

4 release files

0.0.5

4 release files

0.0.4

4 release files

0.0.3

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page