The Eclipse BaSyx Python SDK, an implementation of the Asset Administration Shell for Industry 4.0 systems
Project description
Eclipse BaSyx Python SDK
(formerly known as PyI40AAS – Python Industry 4.0 Asset Administration Shell)
The Eclipse BaSyx Python project focuses on providing a Python implementation of the Asset Administration Shell (AAS) for Industry 4.0 Systems.
Features
- Modelling of AASs as Python objects
- except for: HasDataSpecification
- Reading and writing of AASX package files
- (De-)serialization of AAS objects into/from JSON and XML
- Storing of AAS objects in CouchDB, Backend infrastructure for easy expansion
- Compliance checking of AAS XML and JSON files
Project Structure
The BaSyx Python SDK project provides the basax.aas Python package with 6 submodules:
basyx.aas.model: The AAS metamodel implemented in pythonbasyx.aas.adapter: Adapters for various file formatsbasyx.aas.backend: Backend infrastructure for storing and retrieving AAS objectsbasyx.aas.util: Provides utilitiesbasyx.aas.examples: Example data and tutorials
License
The BaSyx Python SDK project is licensed under the terms of the MIT License.
SPDX-License-Identifier: MIT
For more information, especially considering the licenses of included third-party works, please consult the NOTICE
file.
Dependencies
The BaSyx Python SDK requires the following Python packages to be installed for production usage. These dependencies are listed in
pyproject.toml to be fetched automatically when installing with pip:
lxml(BSD 3-clause License, usinglibxml2under MIT License)python-dateutil(BSD 3-clause License)pyecma376-2(Apache License v2.0)
Development/testing/documentation/example dependencies:
mypy(MIT License)pycodestyle(MIT License)codeblocks(Apache License v2.0)coverage(Apache License v2.0)jsonschema(MIT License, Apache License, PSF License)schemathesis(MIT License)hypothesis(MPL v2.0)lxml-stubs(Apache License)types-python-dateutil(Apache License v2.0)
Dependencies for building the documentation (see docs/add-requirements.txt):
Sphinxand its dependencies (BSD 2-clause License, MIT License, Apache License)sphinx-rtd-themeand its dependencies (MIT License, PSF License)sphinx-argparse(MIT License)
Getting Started
Installation
Eclipse BaSyx Python SDK can be installed from PyPI, the Python Package Index, just as nearly every other Python package:
pip install basyx-python-sdk
For working with the current development version, you can also install the package directly from GitHub, using Pip's Git feature:
pip install --no-cache-dir git+https://github.com/eclipse-basyx/basyx-python-sdk@main#subdirectory=sdk
You may want to use a Python's venv or a similar tool to install BaSyx Python SDK and its dependencies only in a project-specific local environment.
Example
The following code example shows how to create a Submodel with a Property serialize it into an XML file using the
Eclipse BaSyx Python SDK:
Create a Submodel:
from basyx.aas import model # Import all BaSyx Python SDK classes from the model package
identifier = 'https://acplt.org/Simple_Submodel'
submodel = model.Submodel(identifier)
Create a Property and add it to the Submodel:
# create an external reference to a semantic description of the property
semantic_reference = model.ExternalReference(
(model.Key(
type_=model.KeyTypes.GLOBAL_REFERENCE,
value='http://acplt.org/Properties/SimpleProperty'
),)
)
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
)
submodel.submodel_element.add(property)
Serialize the Submodel to XML:
from basyx.aas.adapter.xml import write_aas_xml_file
data: model.DictObjectStore[model.Identifiable] = model.DictObjectStore()
data.add(submodel)
write_aas_xml_file(file='Simple_Submodel.xml', data=data)
Examples and Tutorials
For further examples and tutorials, check out the basyx.aas.examples-package. Here is a quick overview:
tutorial_create_simple_aas: Create an Asset Administration Shell, including an Asset object and a Submodeltutorial_storage: Manage a larger number of Asset Administration Shells in an ObjectStore and resolve referencestutorial_serialization_deserialization: Use the JSON and XML serialization/deserialization for single objects or full standard-compliant filestutorial_aasx: Export Asset Administration Shells with related objects and auxiliary files to AASX package filestutorial_backend_couchdb: Use the CouchDBObjectStore to manage and retrieve AAS objects in a CouchDB document database
Documentation
A detailed, complete API documentation is available on Read the Docs: https://basyx-python-sdk.readthedocs.io
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 basyx_python_sdk-2.0.0.tar.gz.
File metadata
- Download URL: basyx_python_sdk-2.0.0.tar.gz
- Upload date:
- Size: 207.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4512cd39dddd42d9738977cb750d83cc1f97409f74613d712600ef24a06ccbdf
|
|
| MD5 |
937ea46233ee6c9e239f2714400b233a
|
|
| BLAKE2b-256 |
4e693a20b21486d088fd0fba0d8522fea38bec90d562c6eb6752de35c547ac2c
|
File details
Details for the file basyx_python_sdk-2.0.0-py3-none-any.whl.
File metadata
- Download URL: basyx_python_sdk-2.0.0-py3-none-any.whl
- Upload date:
- Size: 161.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db909a3a7c64483269fc4f0dc954f95955dabd0f3a21997857265f94070bcac4
|
|
| MD5 |
389d04bd455c2029f3560a8a3f844237
|
|
| BLAKE2b-256 |
88386e2802e3fc351d869bd59f27b490e812057f31233adc0e1dce57a649a7f0
|