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.8

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.8
File Size Uploaded
py_a2lfile-0.0.8.tar.gz 27.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for py-a2lfile 0.0.8
File Interpreter ABI Platform
py_a2lfile-0.0.8-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
py_a2lfile-0.0.8-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.8-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.8.tar.gz

Download URL py_a2lfile-0.0.8.tar.gz
Size 27.8 kB
Tags Source
SHA-256 checksum
How to use checksums
996afb3a0ae848bd8f0a6f4bc316d5b6664fd06581da76c450ecdf515057efe6
BLAKE2b-256 checksum
How to use checksums
7e437fcf58b193fa6d8ad1b0e12e2b47a53de956bd0612bd7c1a33200a948ee1
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.8-cp312-cp312-win_amd64.whl

Download URL py_a2lfile-0.0.8-cp312-cp312-win_amd64.whl
Size 624.4 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
35671ef4dd6d3541043432a68c0fd5edf4ddc1d50d93bf6dc2859927d67a0ee7
BLAKE2b-256 checksum
How to use checksums
02eaf822f29106678958cd7175bea63a387da123063d55393badac3d0d3d7e28
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.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL py_a2lfile-0.0.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 810.5 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c2344b91f13106d7f5bafd15ce0240390a2bccf5c98cf311fddf833c4ed15934
BLAKE2b-256 checksum
How to use checksums
79e2b3e237d11f7e0296449558b933e1c2bc1e46622e66a4629f29c8b3cee06b
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.8-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL py_a2lfile-0.0.8-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 761.3 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
1ea844560db645168a994697e4fb059736a9223dd3b82c9bea44af46f2f8de3c
BLAKE2b-256 checksum
How to use checksums
a34b86d42a3532e8a53ab8a80f5a2d2e9853d08d033b5709e7a6e324a05dd383
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

This release

0.0.8 This release

4 release files

0.0.7

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