Skip to content

Commit

Permalink
Merge branch 'eclipse-basyx:main' into add_compliance-tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Frosty2500 authored Nov 5, 2024
2 parents 14d520b + 6d696bf commit 5fb5286
Show file tree
Hide file tree
Showing 124 changed files with 191 additions and 145 deletions.
25 changes: 20 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ env:
X_PYTHON_VERSION: "3.12"

jobs:
test:
sdk-test:
# This job runs the unittests on the python versions specified down at the matrix
runs-on: ubuntu-latest
strategy:
Expand All @@ -28,6 +28,9 @@ jobs:
env:
COUCHDB_USER: "admin"
COUCHDB_PASSWORD: ${{ env.COUCHDB_ADMIN_PASSWORD }}
defaults:
run:
working-directory: ./sdk
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -54,9 +57,12 @@ jobs:
run: |
coverage report -m
static-analysis:
sdk-static-analysis:
# This job runs static code analysis, namely pycodestyle and mypy
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./sdk
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.X_PYTHON_VERSION }}
Expand All @@ -74,9 +80,12 @@ jobs:
run: |
pycodestyle --count --max-line-length 120 basyx test
readme-codeblocks:
sdk-readme-codeblocks:
# This job runs the same static code analysis (mypy and pycodestyle) on the codeblocks in our docstrings.
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./sdk
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.X_PYTHON_VERSION }}
Expand All @@ -97,9 +106,12 @@ jobs:
run: |
codeblocks python README.md | python
docs:
sdk-docs:
# This job checks, if the automatically generated documentation using sphinx can be compiled
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./sdk
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.X_PYTHON_VERSION }}
Expand All @@ -115,9 +127,12 @@ jobs:
run: |
SPHINXOPTS="-a -E -n -W --keep-going" make -C docs html
package:
sdk-package:
# This job checks if we can build our SDK package
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./sdk
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.X_PYTHON_VERSION }}
Expand Down
26 changes: 13 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@
/.mypy_cache/

# Typical virtualenv dir
/venv/
venv/

# IDE settings
/.idea/
.idea/

# Python distribution artifacts
/build/
/dist/
/*.egg-info/
/docs/build/
build/
dist/
*.egg-info/
docs/build/

# Coverage artifacts
/.coverage
/htmlcov/
/docs/build/
/.hypothesis/
.coverage
htmlcov/
docs/build/
.hypothesis/

# customized config files
/test/test_config.ini
sdk/test/test_config.ini
# Schema files needed for testing
/test/adapter/schemas
sdk/test/adapter/schemas

# Ignore dynamically generated version file
basyx/version.py
sdk/basyx/version.py
146 changes: 20 additions & 126 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,28 @@ The Eclipse BaSyx Python project focuses on providing a Python implementation of
for Industry 4.0 Systems.
These are the currently implemented specifications:

| Specification | Version |
|---------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Part 1: Metamodel | [v3.0 (01001-3-0)](https://industrialdigitaltwin.org/wp-content/uploads/2023/06/IDTA-01001-3-0_SpecificationAssetAdministrationShell_Part1_Metamodel.pdf) |
| Part 2: API | not implemented yet |
| Specification | Version |
|---------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Part 1: Metamodel | [v3.0 (01001-3-0)](https://industrialdigitaltwin.org/wp-content/uploads/2023/06/IDTA-01001-3-0_SpecificationAssetAdministrationShell_Part1_Metamodel.pdf) |
| Part 2: API | [v3.0 (01002-3-0)](https://industrialdigitaltwin.org/en/wp-content/uploads/sites/2/2023/06/IDTA-01002-3-0_SpecificationAssetAdministrationShell_Part2_API_.pdf) |
| Part 3a: Data Specification IEC 61360 | [v3.0 (01003-a-3-0)](https://industrialdigitaltwin.org/wp-content/uploads/2023/04/IDTA-01003-a-3-0_SpecificationAssetAdministrationShell_Part3a_DataSpecification_IEC61360.pdf) |
| Part 5: Package File Format (AASX) | [v3.0 (01005-3-0)](https://industrialdigitaltwin.org/wp-content/uploads/2023/04/IDTA-01005-3-0_SpecificationAssetAdministrationShell_Part5_AASXPackageFileFormat.pdf) |
| Part 5: Package File Format (AASX) | [v3.0 (01005-3-0)](https://industrialdigitaltwin.org/wp-content/uploads/2023/04/IDTA-01005-3-0_SpecificationAssetAdministrationShell_Part5_AASXPackageFileFormat.pdf) |

## 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 python
* `basyx.aas.adapter`: Adapters for various file formats
* `basyx.aas.backend`: Backend infrastructure for storing and retrieving AAS objects
* `basyx.aas.util`: Provides utilities
* `basyx.aas.examples`: Example data and tutorials

This repository is structured into separate packages.
The `sdk` directory provides the AAS metamodel as Python objects and fundamental functionalities to handle AAS.
The `server` is to be determined.
The `compliance_tool` is to be determined.

* SDK
* 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
* Server (tbd)
* Compliance Tool (tbd)

## License

Expand All @@ -52,110 +47,9 @@ If the changes do not warrant a release, the decision is postponed to the next m

Additionally, security fixes may be released at any point.


## Dependencies

The BaSyx Python SDK requires the following Python packages to be installed for production usage. These dependencies are listed in
`setup.py` to be fetched automatically when installing with `pip`:
* `lxml` (BSD 3-clause License, using `libxml2` under MIT License)
* `python-dateutil` (BSD 3-clause License)
* `pyecma376-2` (Apache License v2.0)
* `urllib3` (MIT License)
* `Werkzeug` (BSD 3-clause License)

Optional production usage dependencies:
* For using the Compliance Tool to validate JSON files against the JSON Schema: `jsonschema` and its
dependencies (MIT License, Apache License, PSF License)

Development/testing/documentation/example dependencies (see `requirements.txt`):
* `jsonschema` and its dependencies (MIT License, Apache License, PSF License)

Dependencies for building the documentation (see `docs/add-requirements.txt`):
* `Sphinx` and its dependencies (BSD 2-clause License, MIT License, Apache License)
* `sphinx-rtd-theme` and 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:
```bash
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:
```bash
pip install git+https://github.com/eclipse-basyx/basyx-python-sdk.git@main
```

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`:
```python
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`:
```python
# 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:
```python
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`](./basyx/aas/examples/tutorial_create_simple_aas.py): Create an Asset Administration Shell, including an Asset object and a Submodel
* [`tutorial_storage`](./basyx/aas/examples/tutorial_storage.py): Manage a larger number of Asset Administration Shells in an ObjectStore and resolve references
* [`tutorial_serialization_deserialization`](./basyx/aas/examples/tutorial_serialization_deserialization.py): Use the JSON and XML serialization/deserialization for single objects or full standard-compliant files
* [`tutorial_aasx`](./basyx/aas/examples/tutorial_aasx.py): Export Asset Administration Shells with related objects and auxiliary files to AASX package files
* [`tutorial_backend_couchdb`](./basyx/aas/examples/tutorial_backend_couchdb.py): Use the *Backends* interface (`update()/commit()` methods) 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

### Compliance Tool

The compliance tool functionality moved to [github.com/rwth-iat/aas-compliance-tool](https://github.com/rwth-iat/aas-compliance-tool).

## Contributing

For contributing with issues and code, please see our [Contribution Guideline](CONTRIBUTING.md).
For contributing with issues and code, please see our [Contribution Guideline](../CONTRIBUTING.md).

### Eclipse Contributor Agreement

Expand Down
File renamed without changes.
Loading

0 comments on commit 5fb5286

Please sign in to comment.