Commit 76504a5f authored by Michael Thies's avatar Michael Thies
Browse files

Merge branch doc/rich_readme with refs/heads/master into refs/merge-requests/18/train

parents aecc2b3c a0f4f568
Pipeline #259913 passed with stage
in 3 minutes and 5 seconds
# PyI40AAS – Python Industry 4.0 Asset Administration Shell
The PyI40AAS project aims to provide an implementation of the Asset Administration Shell for Industry 4.0 Systems, compliant
The PyI40AAS project aims to provide an implementation of the Asset Administration Shell (AAS) for Industry 4.0 Systems, compliant
with the meta model and interface specification provided in
[the document “Details of the Asset Administration Shell” (v2.0)](
The implementation will include the data model as well as interface adapters for serving, retreiving, importing and
exporting Asset Administration Shells.
## Features
* Modelling of AASs as Python objects (according to DotAAS sec. 4)
* (De-)serialization of AAS objects into/from JSON and XML (according to DotAAS sec. 5)
* Reading and writing of AASX package files (according to DotAAS sec. 7)
* Storing of AAS objects in CouchDB
* Compliance checking of AAS XML and JSON files
### Project Structure
The PyI40AAS project provides the `aas` Python package with 5 submodules:
* `aas.model`: The AAS metamodel implemented in python
* `aas.adapter`: Adapters for various file formats and storage backends
* `aas.compliance_tools`: Compliance checker for AAS files
* `aas.util`: Provides utilities
* `aas.examples`: Example data and tutorials
## License
......@@ -13,4 +31,114 @@ exporting Asset Administration Shells.
The PyI40AAS project is provided under the terms of the Apache License (Version 2.0).
For more information, especially considering the licenses of included third-party works, please consult the `NOTICE`
## Dependencies
PyI40AAS requires the following Python packages to be installed for production usage:
* `python-dateutil` (BSD 3-clause License)
* `lxml` (BSD 3-clause License, using `libxml2` under MIT License)
* `pyecma376-2` (Apache License v2.0)
## Getting Started
### Installation
For most users, the recommended method to install is from PyPI:
pip install pyi40aas
### Example
The following code example shows how to create a `Submodel` with a `Property` serialize it into an XML file using PyI40AAS:
Create a `Submodel`:
from aas import model # Import all PYI40AAS classes from the model package
identifier = model.Identifier('', model.IdentifierType.IRI)
submodel = model.Submodel(identification=identifier)
Create a `Property` and add it to the `Submodel`:
# create a global reference to a semantic description of the property
semantic_reference = model.Reference(
property = model.Property(
id_short='ExampleProperty', # Identifying string of the element within the submodel namespace
value_type=model.datatypes.String, # Data type of the value
value='exampleValue', # Value of the property
semantic_id=semantic_reference # set the semantic reference
Serialize the `Submodel` to XML:
import aas.adapter.xml.xml_serialization
data: model.DictObjectStore[model.Identifiable] = model.DictObjectStore()
with open('Simple_Submodel.xml', 'w', encoding='utf-8') as f:
aas.adapter.xml.xml_serialization.write_aas_xml_file(file=f, data=data)
### Examples and Tutorials
For further examples and tutorials, check out the `aas.examples`-package. Here is a quick overview:
* `examples.tutorial_create_simple_aas`: Create an Asset Administration Shell, containing an asset reference and a
submodel reference
* `examples.tutorial_serialization_deserialization_json`: Tutorial for the serialization and deserialization of asset
administration shells, submodels and assets
* `examples.tutorial_storage`: Tutorial for storing asset administration shells, submodels and assets
## Contributing
If you plan contributing code to the PyI40AAS project, please get in touch with us via E-Mail first:
### Codestyle and Testing
Our code follows the [PEP 8 -- Style Guide for Python Code](
Additionally, we use [PEP 484 -- Type Hints]( throughout the code to enable type checking the code.
Before submitting any changes, make sure to let `mypy` and `pycodestyle` check your code and run the unit tests with
Python's builtin `unittest`. To install the required tools, use:
pip install mypy pycodestyle
Running all checks:
mypy aas test
python -m pycodestyle --max-line-length 120 aas test
python -m unittest
We aim to cover our code with test by at least 80%. To check test coverage, you can use `coverage`:
pip install coverage
coverage run --source aas --branch -m unittest
coverage report -m
### Contribute Code/Patches
......@@ -12,7 +12,7 @@
import setuptools
with open("", "r") as fh:
with open("", "r", encoding='utf-8') as fh:
long_description =
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment