Registry / serialization / autosar-data

autosar-data

JSON →
library0.15.0pypypi✓ verified 83d ago

The `autosar-data` library provides tools to read, write, and modify AUTOSAR ARXML data using Python. It offers an object-oriented API for interacting with AUTOSAR workspaces, packages, and elements, simplifying development with ARXML files. The current version is 0.15.0, and it follows an infrequent but impactful release cadence, often introducing breaking changes related to API and Python version support between minor versions.

pip install autosar-data
INSTALL
IMPORT
SIG · AUTOSAR-DATA
A
autosar-data
serializationpythonv0.15.0
Install
2.2s avg
Import
Disk
31MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.12.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 32.1MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.2s · import 0.000s · 32MB
31MB installed
● package 31MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ArxmlFile
from autosar_data import ArxmlFile
from autosar_data import Workspace
AutosarModel
from autosar_data import AutosarModel
from autosar_data import Workspace
Element
from autosar_data import Element
from autosar_data import Workspace

This quickstart demonstrates how to create an empty AUTOSAR workspace, add a package structure, create container and text elements, and then print the resulting ARXML content to a string. It also includes an example of how to load an ARXML file and access its content, highlighting the return value change for loading methods.

from autosar_data import Workspace from autosar_data.element import create_container import os # Create an empty workspace workspace = Workspace.create_empty() # Add a package structure packages = workspace.find_or_create_package('/MyProject/Packages') # Add a container element to the package container = create_container('ECU_CONFIGURATION', parent=packages) container.create_text_element('SHORT-NAME', 'MyEcuConfig') container.create_text_element('TYPE', 'ECU_EXTRACT') # Add a sub-element to the container sub_element = create_container('PARAMETERS', parent=container) sub_element.create_text_element('VALUE', '123') # Print the ARXML content to console arxml_string = workspace.to_string() print("Generated ARXML content:") print(arxml_string) # Example of loading from a file (requires a dummy file for execution) # Create a dummy ARXML file for demonstration dummy_arxml_path = 'dummy_example.arxml' with open(dummy_arxml_path, 'w') as f: f.write(arxml_string) try: # Load the workspace from the dummy file # Note: Workspace.from_file returns (workspace, errors) since v0.11.0 loaded_workspace, errors = Workspace.from_file(dummy_arxml_path) if errors: print(f"\nErrors found during loading: {errors}") else: print(f"\nSuccessfully loaded workspace from {dummy_arxml_path}.") # Access a value from the loaded workspace loaded_value_element = loaded_workspace.find('/MyProject/Packages/ECU_CONFIGURATION/PARAMETERS/VALUE') if loaded_value_element: print(f"Loaded value: {loaded_value_element.text_content}") except FileNotFoundError: print(f"Error: File not found at {dummy_arxml_path}") finally: # Clean up the dummy file if os.path.exists(dummy_arxml_path): os.remove(dummy_arxml_path)
Debug
Known issues
breakingStarting with version 0.15.0, `autosar-data` dropped support for Python 3.9 and 3.10. It now requires Python 3.11 or newer.
fix
Upgrade your Python environment to version 3.11 or higher. If you need to use Python 3.9/3.10, pin `autosar-data` to a version older than 0.15.0 (e.g., `pip install autosar-data<0.15`).
affects: >=0.15.0
breakingSince version 0.11.0, the methods `Workspace.from_file()` and `Workspace.from_string()` return a tuple `(workspace, errors)` instead of just the `workspace` object. Old code expecting only the workspace will raise a `TypeError`.
fix
Update your code to unpack the returned tuple: `workspace, errors = Workspace.from_file('file.arxml')`. Remember to check the `errors` list for parsing issues.
affects: >=0.11.0
breakingIn version 0.14.0, the method `AutosarData.parse_string()` was renamed to `AutosarData.from_string()`. Using the old name will result in an `AttributeError`.
fix
Replace `AutosarData.parse_string(...)` with `AutosarData.from_string(...)`. Note that `from_string` also returns a `(workspace, errors)` tuple.
affects: >=0.14.0
gotchaThe library can be strict with ARXML file structure and content according to the AUTOSAR standard. Malformed or non-compliant ARXML files may lead to parsing errors or unexpected behavior during loading.
fix
Always ensure your input ARXML files are well-formed XML and conform to the expected AUTOSAR schema. Use XML validation tools if encountering persistent parsing issues.
affects: all
Upgrade
Version history
0.15.0latest on PyPI · released Dec 13, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
42 hits · last 30 days
node
38
OpenAI (training)
1
Resources
autosar-data — pip install autosar-data · libregistry