Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
cce3383
fix some typos
Frosty2500 Dec 29, 2024
899f401
fix README.md
Frosty2500 Dec 29, 2024
e3905e3
tutorial_serialization_deserialization: Fix missing import (#363)
Frosty2500 Jan 6, 2025
9cb5b89
README.md: Fix typo in Markdown Link
s-heppner Jan 2, 2025
1ca495f
compliance-tool: Fix compliance tool imports and unitests (#356)
Frosty2500 Jan 15, 2025
933b9fa
aasx.adapter: Fix `semantic_id` type deserialization of `ModelReferen…
JGrothoff Jan 15, 2025
789cb4b
sdk: Update version of pyecma dependency in pyproject.toml
s-heppner Jan 20, 2025
86a8333
sdk: Move testing depencies to dev section in pyproject.toml (#369)
JGrothoff Jan 20, 2025
b178a8c
basyx.provider: Add SetObjectStore to provider (#340)
zrgt Jan 20, 2025
2a94f3e
scripts.set_copyright_year: Add a CI check to ensure the copyright is…
Frosty2500 Feb 17, 2025
d32fd63
sdk/.readthedocs.yaml: Install dependencies from pyproject.toml (#359)
Frosty2500 Feb 21, 2025
dae3354
compliance_tool: add pyproject.toml (#361)
Frosty2500 Feb 21, 2025
8c46dfe
http.py: Fix redirects, bugs, and SDK installation (#362)
Frosty2500 Apr 15, 2025
e83473a
CONTRIBUTING.md: Improve codestyle and testing section (#376)
s-heppner Apr 17, 2025
fc65203
compliance_tool: Remove setup.py (#377)
s-heppner Apr 23, 2025
0ed5e7c
Add CI job to release compliance-tool to PyPI (#382)
s-heppner Apr 23, 2025
5540c3d
adapter.aasx: Allow reading AASX with wrong relationship (#381)
jsejdija May 8, 2025
1d38288
sdk/docs: Bump versions for sphinx dependencies (#387)
s-heppner May 9, 2025
f780c47
Use dir() instead of vars() in `Referable.update_from()` (#338)
zrgt May 26, 2025
1f6336c
sdk/docs: Move documentation dependencies to pyproject.toml (#389)
moritzsommer May 26, 2025
e043960
aasx.py: Add failsafe for writing and reading AASX files (#378)
Frosty2500 May 31, 2025
5043c20
sdk/basyx/aas: Fix type issues under mypy 1.16 (#399)
moritzsommer Jul 2, 2025
8800bff
server/README.md: Clarify Docker build context (#398)
moritzsommer Jul 15, 2025
7438abf
Extract server apps and funcs from `sdk` into `server` (#388)
zrgt Jul 15, 2025
6f5e4b8
Merge branch main into develop (#402)
moritzsommer Jul 30, 2025
2755dd7
server/README.md: Document non-Docker setup (#403)
moritzsommer Aug 19, 2025
128a2ef
sdk\basyx\aas\adapter\xml\xml_serialization.py: Remove code duplicati…
moritzsommer Aug 19, 2025
2a12d13
Small fixes (#408)
zrgt Aug 19, 2025
d4beffa
Update `develop` with state of `main` (#405)
s-heppner Sep 8, 2025
553d87a
Refactor `Backend` concept for data persistence (#370)
s-heppner Sep 15, 2025
863f90f
server: Fix ConceptDescription parsing (#420)
zrgt Oct 9, 2025
f22422c
Update pyecma376-2 and lxml lib versions (#419)
zrgt Oct 9, 2025
457ee51
Add `Referable` Utility Methods and Refactor `Key` Handling (#410)
zrgt Oct 15, 2025
d05eb2a
Refactor server start-up options (#418)
moritzsommer Oct 27, 2025
26b5bc7
Resolve conflicts devlop -> main (#425)
s-heppner Oct 30, 2025
5d63e15
adapter.aasx: Allow reading AASX with wrong relationship (#381)
jsejdija May 8, 2025
291ec1c
sdk/docs: Bump versions for sphinx dependencies (#387)
s-heppner May 9, 2025
16124fc
Use dir() instead of vars() in `Referable.update_from()` (#338)
zrgt May 26, 2025
c362349
sdk/docs: Move documentation dependencies to pyproject.toml (#389)
moritzsommer May 26, 2025
31b3a99
aasx.py: Add failsafe for writing and reading AASX files (#378)
Frosty2500 May 31, 2025
aa07ffb
sdk/basyx/aas: Fix type issues under mypy 1.16 (#399)
moritzsommer Jul 2, 2025
49a3f6b
server/README.md: Clarify Docker build context (#398)
moritzsommer Jul 15, 2025
929be13
Extract server apps and funcs from `sdk` into `server` (#388)
zrgt Jul 15, 2025
b987e39
server/README.md: Document non-Docker setup (#403)
moritzsommer Aug 19, 2025
f281175
sdk\basyx\aas\adapter\xml\xml_serialization.py: Remove code duplicati…
moritzsommer Aug 19, 2025
81737bb
Small fixes (#408)
zrgt Aug 19, 2025
9bbbc36
Refactor `Backend` concept for data persistence (#370)
s-heppner Sep 15, 2025
f4c370c
server: Fix ConceptDescription parsing (#420)
zrgt Oct 9, 2025
96adaba
Update pyecma376-2 and lxml lib versions (#419)
zrgt Oct 9, 2025
3afd783
Add `Referable` Utility Methods and Refactor `Key` Handling (#410)
zrgt Oct 15, 2025
2242668
Refactor server start-up options (#418)
moritzsommer Oct 27, 2025
fe92ad0
Resolve conflicts devlop -> main (#425)
s-heppner Oct 30, 2025
e622edc
Merge remote-tracking branch 'eclipse-basyx/develop' into develop
zrgt Nov 18, 2025
4bd142a
Fix Python 3.9 EOL (#433)
moritzsommer Dec 2, 2025
dcc8d2c
Move documentation of unimplemented routes (#440)
Frosty2500 Dec 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: ci
on: [push, pull_request]

env:
X_PYTHON_MIN_VERSION: "3.9"
X_PYTHON_MIN_VERSION: "3.10"
X_PYTHON_MAX_VERSION: "3.12"

jobs:
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.12"]
python-version: ["3.10", "3.12"]
env:
COUCHDB_ADMIN_PASSWORD: "yo0Quai3"
# (2024-10-11, s-heppner)
Expand Down Expand Up @@ -154,15 +154,14 @@ jobs:
working-directory: ./sdk
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }}
- name: Set up Python ${{ env.X_PYTHON_MAX_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.X_PYTHON_MIN_VERSION }}
python-version: ${{ env.X_PYTHON_MAX_VERSION }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install -r docs/add-requirements.txt
pip install .[docs]
- name: Check documentation for errors
run: |
SPHINXOPTS="-a -E -n -W --keep-going" make -C docs html
Expand Down Expand Up @@ -209,7 +208,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.12"]
python-version: ["3.10", "3.12"]
defaults:
run:
working-directory: ./compliance_tool
Expand Down Expand Up @@ -255,13 +254,13 @@ jobs:
pip install .[dev]
- name: Check typing with MyPy
run: |
mypy ./aas_compliance_tool test
mypy aas_compliance_tool test
- name: Check code style with PyCodestyle
run: |
pycodestyle --count --max-line-length 120 ./aas_compliance_tool test
pycodestyle --count --max-line-length 120 aas_compliance_tool test

compliance-tool-readme-codeblocks:
# This job runs the same static code analysis (mypy and pycodestyle) on the codeblocks in our docstrings.
compliance-tool-package:
# This job checks if we can build our compliance_tool package
runs-on: ubuntu-latest

defaults:
Expand All @@ -273,42 +272,43 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ env.X_PYTHON_MIN_VERSION }}
- name: Install Python dependencies
# install the local sdk in editable mode so it does not get overwritten
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ../sdk[dev]
pip install .[dev]
- name: Check typing with MyPy
run: |
mypy <(codeblocks python README.md)
- name: Check code style with PyCodestyle
run: |
codeblocks --wrap python README.md | pycodestyle --count --max-line-length 120 -
- name: Run readme codeblocks with Python
pip install build
- name: Create source and wheel dist
run: |
codeblocks python README.md | python
python -m build

compliance-tool-package:
# This job checks if we can build our compliance_tool package
#server-test:
# TODO: This job runs the unittests on the python versions specified down at the matrix
# and aas-test-engines on the server


server-static-analysis:
# This job runs static code analysis, namely pycodestyle and mypy
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./compliance_tool
working-directory: ./server/app
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.X_PYTHON_MIN_VERSION }}
- name: Install dependencies
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Create source and wheel dist
pip install ../../sdk
pip install .[dev]
- name: Check typing with MyPy
run: |
python -m build
mypy .
- name: Check code style with PyCodestyle
run: |
pycodestyle --count --max-line-length 120 .

server-package:
# This job checks if we can build our server package
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ htmlcov/
docs/build/
.hypothesis/

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

# Ignore dynamically generated version file
sdk/basyx/version.py
compliance_tool/aas_compliance_tool/version.py
server/app/version.py

# ignore the content of the server storage
# Ignore the content of the server storage
server/input/
server/storage/
2 changes: 1 addition & 1 deletion compliance_tool/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ classifiers = [
"Operating System :: OS Independent",
"Development Status :: 5 - Production/Stable"
]
requires-python = ">=3.9"
requires-python = ">=3.10"
dependencies = [
"pyecma376-2>=0.2.4",
"jsonschema>=4.21.1",
Expand Down
5 changes: 3 additions & 2 deletions sdk/.readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version: 2
build:
os: ubuntu-20.04
tools:
python: "3.9"
python: "3.10"

sphinx:
configuration: docs/source/conf.py
Expand All @@ -15,4 +15,5 @@ python:
install:
- method: pip
path: .
- requirements: docs/add-requirements.txt
extra_requirements:
- docs
5 changes: 2 additions & 3 deletions sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ The BaSyx Python SDK requires the following Python packages to be installed for
* `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)


Development/testing/documentation/example dependencies:
* `mypy` (MIT License)
Expand Down Expand Up @@ -128,7 +127,7 @@ For further examples and tutorials, check out the `basyx.aas.examples`-package.
* [`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
* [`tutorial_backend_couchdb`](./basyx/aas/examples/tutorial_backend_couchdb.py): Use the *CouchDBObjectStore* to manage and retrieve AAS objects in a CouchDB document database


### Documentation
Expand Down
42 changes: 42 additions & 0 deletions sdk/basyx/aas/adapter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,45 @@
Python SDK objects to/from XML.
* :ref:`aasx <adapter.aasx>`: This package offers functions for reading and writing AASX-files.
"""

from basyx.aas.adapter.aasx import AASXReader, DictSupplementaryFileContainer
from basyx.aas.adapter.json import read_aas_json_file_into
from basyx.aas.adapter.xml import read_aas_xml_file_into
from basyx.aas.model.provider import DictObjectStore
from pathlib import Path
from typing import Union


def load_directory(directory: Union[Path, str]) -> tuple[DictObjectStore, DictSupplementaryFileContainer]:
"""
Create a new :class:`~basyx.aas.model.provider.DictObjectStore` and use it to load Asset Administration Shell and
Submodel files in ``AASX``, ``JSON`` and ``XML`` format from a given directory into memory. Additionally, load all
embedded supplementary files into a new :class:`~basyx.aas.adapter.aasx.DictSupplementaryFileContainer`.

:param directory: :class:`~pathlib.Path` or ``str`` pointing to the directory containing all Asset Administration
Shell and Submodel files to load
:return: Tuple consisting of a :class:`~basyx.aas.model.provider.DictObjectStore` and a
:class:`~basyx.aas.adapter.aasx.DictSupplementaryFileContainer` containing all loaded data
"""

dict_object_store: DictObjectStore = DictObjectStore()
file_container: DictSupplementaryFileContainer = DictSupplementaryFileContainer()

directory = Path(directory)

for file in directory.iterdir():
if not file.is_file():
continue

suffix = file.suffix.lower()
if suffix == ".json":
with open(file) as f:
read_aas_json_file_into(dict_object_store, f)
elif suffix == ".xml":
with open(file) as f:
read_aas_xml_file_into(dict_object_store, f)
elif suffix == ".aasx":
with AASXReader(file) as reader:
reader.read_into(object_store=dict_object_store, file_store=file_container)

return dict_object_store, file_container
7 changes: 7 additions & 0 deletions sdk/basyx/aas/adapter/_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
PathOrBinaryIO = Union[Path, BinaryIO]
PathOrIO = Union[Path, IO] # IO is TextIO or BinaryIO

# JSON top-level keys and their corresponding model classes
JSON_AAS_TOP_LEVEL_KEYS_TO_TYPES = (
('assetAdministrationShells', model.AssetAdministrationShell),
('submodels', model.Submodel),
('conceptDescriptions', model.ConceptDescription),
)

# XML Namespace definition
XML_NS_MAP = {"aas": "https://admin-shell.io/aas/3/0"}
XML_NS_AAS = "{" + XML_NS_MAP["aas"] + "}"
Expand Down
Loading