Skip to content

Commit c309ad1

Browse files
committed
Merge remote-tracking branch 'origin/main' into docker_ci
# Conflicts: # .github/workflows/release.yml
2 parents fbbdd83 + f831016 commit c309ad1

51 files changed

Lines changed: 1738 additions & 1778 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: ci
33
on: [push, pull_request]
44

55
env:
6-
X_PYTHON_MIN_VERSION: "3.9"
6+
X_PYTHON_MIN_VERSION: "3.10"
77
X_PYTHON_MAX_VERSION: "3.12"
88

99
jobs:
@@ -45,7 +45,7 @@ jobs:
4545
runs-on: ubuntu-latest
4646
strategy:
4747
matrix:
48-
python-version: ["3.9", "3.12"]
48+
python-version: ["3.10", "3.12"]
4949
env:
5050
COUCHDB_ADMIN_PASSWORD: "yo0Quai3"
5151
# (2024-10-11, s-heppner)
@@ -154,15 +154,14 @@ jobs:
154154
working-directory: ./sdk
155155
steps:
156156
- uses: actions/checkout@v4
157-
- name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }}
157+
- name: Set up Python ${{ env.X_PYTHON_MAX_VERSION }}
158158
uses: actions/setup-python@v5
159159
with:
160-
python-version: ${{ env.X_PYTHON_MIN_VERSION }}
160+
python-version: ${{ env.X_PYTHON_MAX_VERSION }}
161161
- name: Install Python dependencies
162162
run: |
163163
python -m pip install --upgrade pip
164-
pip install .
165-
pip install -r docs/add-requirements.txt
164+
pip install .[docs]
166165
- name: Check documentation for errors
167166
run: |
168167
SPHINXOPTS="-a -E -n -W --keep-going" make -C docs html
@@ -209,7 +208,7 @@ jobs:
209208
runs-on: ubuntu-latest
210209
strategy:
211210
matrix:
212-
python-version: ["3.9", "3.12"]
211+
python-version: ["3.10", "3.12"]
213212
defaults:
214213
run:
215214
working-directory: ./compliance_tool
@@ -255,13 +254,13 @@ jobs:
255254
pip install .[dev]
256255
- name: Check typing with MyPy
257256
run: |
258-
mypy ./aas_compliance_tool test
257+
mypy aas_compliance_tool test
259258
- name: Check code style with PyCodestyle
260259
run: |
261-
pycodestyle --count --max-line-length 120 ./aas_compliance_tool test
260+
pycodestyle --count --max-line-length 120 aas_compliance_tool test
262261
263-
compliance-tool-readme-codeblocks:
264-
# This job runs the same static code analysis (mypy and pycodestyle) on the codeblocks in our docstrings.
262+
compliance-tool-package:
263+
# This job checks if we can build our compliance_tool package
265264
runs-on: ubuntu-latest
266265

267266
defaults:
@@ -273,42 +272,43 @@ jobs:
273272
uses: actions/setup-python@v5
274273
with:
275274
python-version: ${{ env.X_PYTHON_MIN_VERSION }}
276-
- name: Install Python dependencies
277-
# install the local sdk in editable mode so it does not get overwritten
275+
- name: Install dependencies
278276
run: |
279277
python -m pip install --upgrade pip
280-
pip install -e ../sdk[dev]
281-
pip install .[dev]
282-
- name: Check typing with MyPy
283-
run: |
284-
mypy <(codeblocks python README.md)
285-
- name: Check code style with PyCodestyle
286-
run: |
287-
codeblocks --wrap python README.md | pycodestyle --count --max-line-length 120 -
288-
- name: Run readme codeblocks with Python
278+
pip install build
279+
- name: Create source and wheel dist
289280
run: |
290-
codeblocks python README.md | python
281+
python -m build
291282
292-
compliance-tool-package:
293-
# This job checks if we can build our compliance_tool package
283+
#server-test:
284+
# TODO: This job runs the unittests on the python versions specified down at the matrix
285+
# and aas-test-engines on the server
286+
287+
288+
server-static-analysis:
289+
# This job runs static code analysis, namely pycodestyle and mypy
294290
runs-on: ubuntu-latest
295291

296292
defaults:
297293
run:
298-
working-directory: ./compliance_tool
294+
working-directory: ./server/app
299295
steps:
300296
- uses: actions/checkout@v4
301297
- name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }}
302298
uses: actions/setup-python@v5
303299
with:
304300
python-version: ${{ env.X_PYTHON_MIN_VERSION }}
305-
- name: Install dependencies
301+
- name: Install Python dependencies
306302
run: |
307303
python -m pip install --upgrade pip
308-
pip install build
309-
- name: Create source and wheel dist
304+
pip install ../../sdk
305+
pip install .[dev]
306+
- name: Check typing with MyPy
310307
run: |
311-
python -m build
308+
mypy .
309+
- name: Check code style with PyCodestyle
310+
run: |
311+
pycodestyle --count --max-line-length 120 .
312312
313313
server-package:
314314
# This job checks if we can build our server package
@@ -320,7 +320,7 @@ jobs:
320320
- uses: actions/checkout@v4
321321
- name: Build the Docker image
322322
run: |
323-
docker build -t basyx-python-server .
323+
docker build -t basyx-python-server -f Dockerfile ..
324324
- name: Run container
325325
run: |
326326
docker run -d --name basyx-python-server basyx-python-server

.github/workflows/release.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
types: [published]
66

77
jobs:
8-
publish-pypi:
8+
sdk-publish:
99
# This job publishes the package to PyPI
1010
runs-on: ubuntu-latest
1111
defaults:
@@ -32,7 +32,34 @@ jobs:
3232
with:
3333
password: ${{ secrets.PYPI_ORG_TOKEN }}
3434

35-
publish-dockerhub:
35+
compliance-tool-publish:
36+
# This job publishes the compliance_tool package to PyPI
37+
runs-on: ubuntu-latest
38+
defaults:
39+
run:
40+
working-directory: ./compliance_tool
41+
steps:
42+
- uses: actions/checkout@v4
43+
- name: Set up Python 3.10
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: "3.10"
47+
- name: Install dependencies
48+
run: |
49+
python -m pip install --upgrade pip
50+
pip install build
51+
- name: Create source and wheel dist
52+
# (2024-12-11, s-heppner)
53+
# The PyPI Action expects the dist files in a toplevel `/dist` directory,
54+
# so we have to specify this as output directory here.
55+
run: |
56+
python -m build --outdir ../dist
57+
- name: Publish distribution to PyPI
58+
uses: pypa/gh-action-pypi-publish@release/v1
59+
with:
60+
password: ${{ secrets.PYPI_ORG_TOKEN }}
61+
62+
server-publish:
3663
# This job publishes the server docker image to DockerHub
3764
runs-on: ubuntu-latest
3865
defaults:

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,16 @@ htmlcov/
2121
docs/build/
2222
.hypothesis/
2323

24-
# customized config files
24+
# Customized config files
2525
sdk/test/test_config.ini
2626
# Schema files needed for testing
2727
sdk/test/adapter/schemas
2828

2929
# Ignore dynamically generated version file
3030
sdk/basyx/version.py
3131
compliance_tool/aas_compliance_tool/version.py
32+
server/app/version.py
3233

33-
# ignore the content of the server storage
34+
# Ignore the content of the server storage
35+
server/input/
3436
server/storage/

CONTRIBUTING.md

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,41 @@ The following guidelines are for the commit or PR message text:
119119
via `https://link/to.pdf#Page=123`
120120
- Optionally, where applicable reference respective issues: `Fixes #123`
121121

122-
## Codestyle and Testing
122+
## Code Quality
123123

124+
The Eclipse BaSyx Python project emphasizes high code quality.
125+
To achieve this, we apply best practices where possible and have developed an extensive suite of tests that are
126+
expected to pass for each Pull Request to the project.
127+
128+
### Codestyle
124129
Our code follows the [PEP 8 -- Style Guide for Python Code](https://www.python.org/dev/peps/pep-0008/)
125130
with the following exceptions:
126131
- Line length is allowed to be up to 120 characters, though lines up to 100 characters are preferred.
127132

128133
Additionally, we use [PEP 484 -- Type Hints](https://www.python.org/dev/peps/pep-0484/) throughout the code to enable type checking the code.
129134

130-
Before submitting any changes, make sure to let `mypy` and `pycodestyle` check your code and run the unit tests with
131-
Python's builtin `unittest`. To install the required tools, use:
135+
Before submitting any changes to the SDK, make sure to let `mypy` and `pycodestyle` check your code and run the unit
136+
tests with Python's builtin `unittest`.
137+
138+
### Testing
139+
There are many automated checks implemented in the CI pipelines of this project, all of which are expected to pass
140+
before new code can be added:
141+
142+
- We check that the Python packages can be built.
143+
- We run the developed unittests and aim for a code coverage of at least 80%.
144+
- We perform static code analysis for type-checking and codestyle, not just in the code itself, but also in codeblocks
145+
that are inside docstrings and the `README.md`.
146+
- We check that the automatically generated developer documentation compiles.
147+
- We check that the Python Versions we support match between the different subprojects in the monorepository and are
148+
not End of Life.
149+
- We check that the year in the copyright headers in each file (stemming from the license) is correct.
150+
151+
> [!note]
152+
> We strongly suggest to run the tests locally, before submitting a Pull Request, in order to accelerate the review
153+
> process.
154+
155+
### Testing the SDK
156+
For testing the SDK locally on your machine, you can install the required tools like so:
132157
```bash
133158
pip install .[dev]
134159
```
@@ -142,12 +167,51 @@ Running all checks:
142167
mypy basyx test
143168
pycodestyle --max-line-length 120 basyx test
144169
python -m unittest
170+
coverage run --source basyx --branch -m unittest
171+
coverage report -m
145172
```
146173

147-
We aim to cover our code with test by at least 80%. To check test coverage, you can use `coverage`:
174+
We aim to cover our code with tests by at least 80%.
175+
176+
This should help you sort out the most important bugs in your code.
177+
Note that there are more checks that run in the CI once you open a Pull Request.
178+
If you want to run the additional checks, please refer to the [CI definition](./.github/workflows/ci.yml).
148179

180+
### Testing the Server
181+
Currently, the automated server tests are still under development.
182+
To test that the server is working, we expect to at least be able to build the docker images and run a container
183+
of it without error.
184+
185+
For that, you need to have Docker installed on your system.
186+
In the directory with the `Dockerfile`:
149187
```bash
150-
pip install coverage
188+
docker build -t basyx-python-server .
189+
docker run --name basyx-python-server basyx-python-server
190+
```
191+
Wait until you see the line:
192+
```
193+
INFO success: quit_on_failure entered RUNNING state
194+
```
195+
196+
### Testing the Compliance Tool
197+
For the Compliance Tool, you can install the required tools like this (from the `./compliance_tool` directory):
198+
```bash
199+
pip install -e ../sdk[dev]
200+
pip install .[dev]
201+
```
202+
The first line installs the SDK and its dependencies, the second the developer dependencies for the compliance tool
203+
itself.
204+
205+
Then you can run the checks via:
206+
```bash
207+
mypy basyx test
208+
pycodestyle --max-line-length 120 basyx test
209+
python -m unittest
151210
coverage run --source basyx --branch -m unittest
152211
coverage report -m
153212
```
213+
214+
We aim to cover our code with tests by at least 80%.
215+
This should help you sort out the most important bugs in your code.
216+
Note that there are more checks that run in the CI once you open a Pull Request.
217+
If you want to run the additional checks, please refer to the [CI definition](./.github/workflows/ci.yml).

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Eclipse BaSyx Python SDK
22

3-
(formerly known as PyI40AAS – Python Industry 4.0 Asset Administration Shell)
4-
53
The Eclipse BaSyx Python project focuses on providing a Python implementation of the Asset Administration Shell (AAS)
6-
for Industry 4.0 Systems.
7-
These are the currently implemented specifications:
4+
for Industry 4.0 Systems.
5+
6+
**Please note that the SDK version number is independent of the supported AAS versions!**
7+
8+
These are the implemented AAS specifications of the [current SDK release](https://github.com/eclipse-basyx/basyx-python-sdk/releases/latest), which can be also found on [PyPI](https://pypi.org/project/basyx-python-sdk/):
89

910
| Specification | Version |
1011
|---------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -14,6 +15,9 @@ These are the currently implemented specifications:
1415
| 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) |
1516
| 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) |
1617

18+
If you need support to an older version of the specifications, please refer to our [prior releases](https://github.com/eclipse-basyx/basyx-python-sdk/releases).
19+
Each of them has a similar table at the top of the release notes.
20+
1721
## Features
1822
This repository is structured into separate packages.
1923
The `sdk` directory provides the AAS metamodel as Python objects and fundamental functionalities to handle AAS.

compliance_tool/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ classifiers = [
3434
"Operating System :: OS Independent",
3535
"Development Status :: 5 - Production/Stable"
3636
]
37-
requires-python = ">=3.9"
37+
requires-python = ">=3.10"
3838
dependencies = [
3939
"pyecma376-2>=0.2.4",
4040
"jsonschema>=4.21.1",

compliance_tool/setup.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

sdk/.readthedocs.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ version: 2
66
build:
77
os: ubuntu-20.04
88
tools:
9-
python: "3.9"
9+
python: "3.10"
1010

1111
sphinx:
1212
configuration: docs/source/conf.py
@@ -15,4 +15,5 @@ python:
1515
install:
1616
- method: pip
1717
path: .
18-
- requirements: docs/add-requirements.txt
18+
extra_requirements:
19+
- docs

0 commit comments

Comments
 (0)