# eclipse-basyx/basyx-python-sdk architecture

> Architecture diagram of the GitHub repository eclipse-basyx/basyx-python-sdk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/eclipse-basyx/basyx-python-sdk
- Repository: https://github.com/eclipse-basyx/basyx-python-sdk

## Overview

1. This is a Python monorepo for the Eclipse BaSyx ecosystem, split into three publishable pieces: `sdk` for the core AAS library, `server` for a containerized HTTP service, and `compliance_tool` for command-line validation. The top-level repo also includes CI/release automation and shared contribution/legal files.

2. The `sdk` package is the main architecture center. It defines the Asset Administration Shell metamodel as Python objects under `basyx/aas/model`, with supporting utilities for identification, traversal, and string constraints. This is the layer other packages build on.

3. The SDK’s data transformation boundary is the adapter layer in `basyx/aas/adapter`. It contains serializers/deserializers for JSON and XML, plus an AASX adapter for reading and writing package files. In diagram terms, model objects sit in the middle, with format-specific adapters on the edges.

4. Persistence is abstracted through `basyx/aas/backend`. Two concrete backends are present: `local_file` for filesystem storage and `couchdb` for database-backed storage. This indicates a repository-style boundary where AAS objects can be stored either locally or in CouchDB without changing the model layer.

5. The SDK also ships example code and tutorials under `basyx/aas/examples`, which show the intended flows: create model objects, serialize/deserialize them, package them into AASX, and persist them through a backend. These are not separate subsystems, but they help clarify the library’s end-to-end usage.

6. The `server` package is a deployment-oriented service wrapper around the AAS functionality. Its `app/interfaces` and `app/util` modules suggest a clean separation between HTTP/service interfaces, repository abstractions, and conversion helpers. The server is packaged for Docker and run with `uwsgi`/`supervisord`, so runtime concerns are externalized from the core SDK.

7. The server’s role is to expose specification-compliant repositories: an Asset Administration Shell Repository and a Submodel Repository. The `test/interfaces/test_repository.py` coverage indicates the key boundary is the repository contract, not business logic inside the transport layer.

8. The `compliance_tool` package is a standalone validator focused on AAS JSON, XML, and AASX inputs. It includes separate checkers for each format, a `state_manager` for result tracking, and bundled JSON/XSD schemas for formal validation. The tool is CLI-driven and is designed to classify files as compliant, warning, or invalid based on schema and structural checks.

9. The compliance tool’s test fixtures make its pipeline explicit: raw JSON/XML files and AASX package directories are fed into the checkers, including positive examples, empty files, malformed attributes, and deserialization-warning cases. This subsystem is therefore file-in, report-out, with format-specific branching before validation.

10. Cross-cutting repository concerns include test suites for each package, typed-package markers (`py.typed`), and documentation trees for both SDK and server. The repository is built and verified via GitHub Actions workflows for CI and release, with version-consistency scripts under `etc/scripts`.

11. From an architecture-diagram perspective, the clearest boundaries are: core AAS model, format adapters, storage backends, HTTP server wrapper, compliance CLI, and external dependencies such as CouchDB, filesystem storage, and AASX package files. The SDK provides the reusable domain core; the server and compliance tool are thin application layers built on top of it.

Main entry points: [`server/app/main.py`](https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/server/app/main.py) (Service app), [`sdk/basyx/aas/model`](https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/sdk/basyx/aas/model) (AAS model), [`sdk/basyx/aas/adapter`](https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/sdk/basyx/aas/adapter) (Adapters), [`sdk/basyx/aas/backend`](https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/sdk/basyx/aas/backend) (Backends)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_sdk["SDK"]
  node_sdk_model["AAS model<br/>domain model"]
  node_sdk_adapter["Adapters<br/>serialization layer"]
  node_sdk_backend["Backends<br/>storage layer"]
  node_sdk_util["Utilities<br/>support layer"]
  node_sdk_examples["Examples<br/>usage demos"]
  node_adapter_json["JSON"]
  node_adapter_xml["XML"]
  node_adapter_aasx["AASX<br/>package adapter<br/>[aasx.py]"]
  node_backend_local["Local file<br/>filesystem backend<br/>[local_file.py]"]
  node_backend_couchdb["CouchDB<br/>database backend<br/>[couchdb.py]"]
end

subgraph group_group_server["Server"]
  node_server_main["Service app<br/>runtime entrypoint<br/>[main.py]"]
  node_server_interfaces["Interfaces<br/>repository API"]
  node_server_util["Converters<br/>conversion helpers<br/>[converters.py]"]
  node_server_runtime["Container runtime<br/>deployment"]
end

subgraph group_group_compliance["Compliance Tool"]
  node_comp_cli["CLI<br/>validator entrypoint<br/>[cli.py]"]
  node_comp_json["JSON check<br/>json validator"]
  node_comp_xml["XML check<br/>xml validator"]
  node_comp_aasx["AASX check<br/>package validator"]
  node_comp_state["State manager<br/>result tracking<br/>[state_manager.py]"]
end

subgraph group_group_repo["Repo Ops"]
  node_root_repo["basyx-python-sdk<br/>monorepo"]
  node_repo_ci["CI / release<br/>automation<br/>[workflows]"]
  node_repo_scripts["Version scripts<br/>repo tooling"]
end

node_root_repo -->|"contains"| node_sdk_model
node_root_repo -->|"contains"| node_server_main
node_root_repo -->|"contains"| node_comp_cli
node_sdk_model -->|"feeds"| node_sdk_adapter
node_sdk_model -->|"persists via"| node_sdk_backend
node_sdk_model -->|"uses"| node_sdk_util
node_sdk_adapter -->|"includes"| node_adapter_json
node_sdk_adapter -->|"includes"| node_adapter_xml
node_sdk_adapter -->|"includes"| node_adapter_aasx
node_sdk_backend -->|"includes"| node_backend_local
node_sdk_backend -->|"includes"| node_backend_couchdb
node_sdk_examples -->|"demonstrates"| node_sdk_model
node_sdk_examples -->|"demonstrates"| node_sdk_adapter
node_sdk_examples -->|"demonstrates"| node_sdk_backend
node_server_main -->|"depends on"| node_server_interfaces
node_server_main -->|"uses"| node_server_util
node_server_main -->|"serves"| node_sdk_model
node_server_main -->|"stores through"| node_sdk_backend
node_server_runtime -->|"runs"| node_server_main
node_comp_cli -->|"dispatches"| node_comp_json
node_comp_cli -->|"dispatches"| node_comp_xml
node_comp_cli -->|"dispatches"| node_comp_aasx
node_comp_json -->|"reports"| node_comp_state
node_comp_xml -->|"reports"| node_comp_state
node_comp_aasx -->|"reports"| node_comp_state
node_repo_ci -->|"verifies"| node_root_repo
node_repo_scripts -->|"supports"| node_repo_ci

click node_sdk_model "https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/sdk/basyx/aas/model"
click node_sdk_adapter "https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/sdk/basyx/aas/adapter"
click node_sdk_backend "https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/sdk/basyx/aas/backend"
click node_sdk_util "https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/sdk/basyx/aas/util"
click node_sdk_examples "https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/sdk/basyx/aas/examples"
click node_adapter_json "https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/sdk/basyx/aas/adapter/json"
click node_adapter_xml "https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/sdk/basyx/aas/adapter/xml"
click node_adapter_aasx "https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/sdk/basyx/aas/adapter/aasx.py"
click node_backend_local "https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/sdk/basyx/aas/backend/local_file.py"
click node_backend_couchdb "https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/sdk/basyx/aas/backend/couchdb.py"
click node_server_main "https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/server/app/main.py"
click node_server_interfaces "https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/server/app/interfaces"
click node_server_util "https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/server/app/util/converters.py"
click node_server_runtime "https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/server/Dockerfile"
click node_comp_cli "https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/compliance_tool/aas_compliance_tool/cli.py"
click node_comp_json "https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/compliance_tool/aas_compliance_tool/compliance_check_json.py"
click node_comp_xml "https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/compliance_tool/aas_compliance_tool/compliance_check_xml.py"
click node_comp_aasx "https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/compliance_tool/aas_compliance_tool/compliance_check_aasx.py"
click node_comp_state "https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/compliance_tool/aas_compliance_tool/state_manager.py"
click node_repo_ci "https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/.github/workflows"
click node_repo_scripts "https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/etc/scripts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_sdk_model,node_sdk_adapter,node_sdk_backend,node_sdk_util,node_sdk_examples,node_adapter_json,node_adapter_xml,node_adapter_aasx,node_backend_local,node_backend_couchdb toneBlue
class node_server_main,node_server_interfaces,node_server_util,node_server_runtime toneAmber
class node_comp_cli,node_comp_json,node_comp_xml,node_comp_aasx,node_comp_state toneMint
class node_root_repo,node_repo_ci,node_repo_scripts toneRose
```

## Components

### SDK

Core reusable AAS library

- [AAS model](https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/sdk/basyx/aas/model): domain model · Asset Administration Shell metamodel objects · `sdk/basyx/aas/model`
- [Adapters](https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/sdk/basyx/aas/adapter): serialization layer · Format adapters for JSON, XML, and AASX · `sdk/basyx/aas/adapter`
- [Backends](https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/sdk/basyx/aas/backend): storage layer · Persistence abstraction with filesystem and CouchDB implementations · `sdk/basyx/aas/backend`
- [Utilities](https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/sdk/basyx/aas/util): support layer · Identification and traversal helpers · `sdk/basyx/aas/util`
- [Examples](https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/sdk/basyx/aas/examples): usage demos · Tutorials and sample flows across model, adapters, and storage · `sdk/basyx/aas/examples`
- [JSON](https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/sdk/basyx/aas/adapter/json): json serializer · JSON serialization and deserialization · `sdk/basyx/aas/adapter/json`
- [XML](https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/sdk/basyx/aas/adapter/xml): xml serializer · XML serialization and deserialization · `sdk/basyx/aas/adapter/xml`
- [AASX](https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/sdk/basyx/aas/adapter/aasx.py): package adapter · AASX package read/write adapter · `sdk/basyx/aas/adapter/aasx.py`
- [Local file](https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/sdk/basyx/aas/backend/local_file.py): filesystem backend · Filesystem storage backend · `sdk/basyx/aas/backend/local_file.py`
- [CouchDB](https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/sdk/basyx/aas/backend/couchdb.py): database backend · CouchDB-backed storage backend · `sdk/basyx/aas/backend/couchdb.py`

### Server

HTTP service wrapper around the SDK

- [Service app](https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/server/app/main.py): runtime entrypoint · Server application entrypoint · `server/app/main.py`
- [Interfaces](https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/server/app/interfaces): repository API · Repository contracts and HTTP-facing interfaces · `server/app/interfaces`
- [Converters](https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/server/app/util/converters.py): conversion helpers · Helpers for mapping between transport and domain objects · `server/app/util/converters.py`
- [Container runtime](https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/server/Dockerfile): deployment · Docker, uWSGI, and supervisord packaging for service execution · `server/Dockerfile`

### Compliance Tool

CLI validator for AAS files

- [CLI](https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/compliance_tool/aas_compliance_tool/cli.py): validator entrypoint · Command-line entrypoint for compliance checks · `compliance_tool/aas_compliance_tool/cli.py`
- [JSON check](https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/compliance_tool/aas_compliance_tool/compliance_check_json.py): json validator · Schema and structure validation for JSON inputs · `compliance_tool/aas_compliance_tool/compliance_check_json.py`
- [XML check](https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/compliance_tool/aas_compliance_tool/compliance_check_xml.py): xml validator · Schema and structure validation for XML inputs · `compliance_tool/aas_compliance_tool/compliance_check_xml.py`
- [AASX check](https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/compliance_tool/aas_compliance_tool/compliance_check_aasx.py): package validator · Validation of AASX package inputs · `compliance_tool/aas_compliance_tool/compliance_check_aasx.py`
- [State manager](https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/compliance_tool/aas_compliance_tool/state_manager.py): result tracking · Tracks compliance outcomes and statuses · `compliance_tool/aas_compliance_tool/state_manager.py`

### Repo Ops

Shared repository automation and docs

- **basyx-python-sdk**: monorepo · Python monorepo for SDK, server, and compliance tool
- [CI / release](https://github.com/eclipse-basyx/basyx-python-sdk/blob/main/.github/workflows): automation · GitHub Actions workflows for testing and release · `.github/workflows`
- [Version scripts](https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/etc/scripts): repo tooling · Shared scripts for version and copyright checks · `etc/scripts`

## Connections

- basyx-python-sdk → AAS model: contains · Repository includes the SDK domain core
- basyx-python-sdk → Service app: contains · Repository includes the server package
- basyx-python-sdk → CLI: contains · Repository includes the compliance tool
- AAS model → Adapters: feeds · Model objects are serialized and deserialized through adapters
- AAS model → Backends: persists via · Model objects are stored through backend abstractions
- AAS model → Utilities: uses · Domain helpers support identifiers and traversal
- Adapters → JSON: includes · JSON format adapter
- Adapters → XML: includes · XML format adapter
- Adapters → AASX: includes · AASX package adapter
- Backends → Local file: includes · Filesystem backend implementation
- Backends → CouchDB: includes · CouchDB backend implementation
- Examples → AAS model: demonstrates · Examples create and manipulate model objects
- Examples → Adapters: demonstrates · Examples serialize and deserialize formats
- Examples → Backends: demonstrates · Examples show storage flows
- Service app → Interfaces: depends on · Service entrypoint is built around repository interfaces
- Service app → Converters: uses · Runtime converts between transport and SDK types
- Service app → AAS model: serves · HTTP service exposes AAS domain objects
- Service app → Backends: stores through · Service uses SDK backends for persistence
- Container runtime → Service app: runs · Container and supervisor tooling launch the service
- CLI → JSON check: dispatches · CLI routes JSON inputs to the JSON checker
- CLI → XML check: dispatches · CLI routes XML inputs to the XML checker
- CLI → AASX check: dispatches · CLI routes AASX inputs to the package checker
- JSON check → State manager: reports · Checker updates validation state
- XML check → State manager: reports · Checker updates validation state
- AASX check → State manager: reports · Checker updates validation state
- CI / release → basyx-python-sdk: verifies · Workflows validate the monorepo
- Version scripts → CI / release: supports · Shared scripts help enforce repository policy
