Skip to content

Commit

Permalink
Merge branch 'main' into add_copyright_check
Browse files Browse the repository at this point in the history
  • Loading branch information
Frosty2500 authored Dec 13, 2024
2 parents a924c2c + eaa59e3 commit 92ee7b3
Show file tree
Hide file tree
Showing 66 changed files with 26,998 additions and 8 deletions.
106 changes: 105 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ jobs:
run: |
python -m build
repository-check-copyright:
# This job checks that the copyright year in the header of all files is up to date
runs-on: ubuntu-latest
Expand All @@ -199,6 +200,110 @@ jobs:
chmod +x ./etc/scripts/set_copyright_year.sh
./etc/scripts/set_copyright_year.sh --check
compliance-tool-test:
# This job runs the unittests on the python versions specified down at the matrix
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.10", "3.12"]
defaults:
run:
working-directory: ./compliance_tool

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install coverage
pip install -r requirements.txt
- name: Test with coverage + unittest
run: |
coverage run --source=aas_compliance_tool -m unittest
- name: Report test coverage
if: ${{ always() }}
run: |
coverage report -m
compliance-tool-static-analysis:
# This job runs static code analysis, namely pycodestyle and mypy
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./compliance_tool
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.X_PYTHON_VERSION }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.X_PYTHON_VERSION }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install pycodestyle mypy
pip install -r requirements.txt
- name: Check typing with MyPy
run: |
mypy ./aas_compliance_tool test
- name: Check code style with PyCodestyle
run: |
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.
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./compliance_tool
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.X_PYTHON_VERSION }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.X_PYTHON_VERSION }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install pycodestyle mypy codeblocks
pip install -r requirements.txt
- 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
run: |
codeblocks python README.md | python
compliance-tool-package:
# This job checks if we can build our compliance_tool package
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./compliance_tool
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.X_PYTHON_VERSION }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.X_PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Create source and wheel dist
run: |
python setup.py sdist bdist_wheel
server-package:
# This job checks if we can build our server package
runs-on: ubuntu-latest
Expand Down Expand Up @@ -226,4 +331,3 @@ jobs:
- name: Stop and remove the container
run: |
docker stop basyx-python-server && docker rm basyx-python-server
8 changes: 7 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ jobs:
publish:
# This job publishes the package to PyPI
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./sdk
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
Expand All @@ -19,8 +22,11 @@ jobs:
python -m pip install --upgrade pip
pip install build
- name: Create source and wheel dist
# (2024-12-11, s-heppner)
# The PyPI Action expects the dist files in a toplevel `/dist` directory,
# so we have to specify this as output directory here.
run: |
python -m build
python -m build --outdir ../dist
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ The `compliance_tool` is to be determined.
* Modelling of AASs as Python objects
* Reading and writing of AASX package files
* (De-)serialization of AAS objects into/from JSON and XML
* Experimental serialization to RDF (see branch [Experimental/Adapter/RDF](https://github.com/eclipse-basyx/basyx-python-sdk/tree/Experimental/Adapter/RDF/basyx/aas/adapter/rdf)).
Please refer to discussion of PR [#308](https://github.com/eclipse-basyx/basyx-python-sdk/pull/308) for the reasoning behind keeping this feature experimental.
* Storing of AAS objects in CouchDB, Backend infrastructure for easy expansion
* Compliance checking of AAS XML and JSON files
* [Server](./server/README.md): Docker Image of a specification compliant HTTP Server implementing the interfaces:
* Asset Administration Shell Repository
* Submodel Repository
* Compliance Tool (tbd)
* [Compliance Tool](./compliance_tool/README.md): A command-line tool for checking compliance of JSON and XML files
to the specification of the AAS

## License

Expand Down
27 changes: 27 additions & 0 deletions compliance_tool/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Python caching
**/__pycache__/
*.pyc
/.mypy_cache/

# Typical virtualenv dir
/venv/

# IDE settings
/.idea/

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

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

# customized config files
/test/test_config.ini

# Do not ship the dynamicylly packaged aasx files in the `test/files`
/test/files/*.aasx
21 changes: 21 additions & 0 deletions compliance_tool/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 IAT, RWTH Aachen University

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
18 changes: 18 additions & 0 deletions compliance_tool/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Declared Project License
------------------------
The artifacts of this project are made available under the terms of the MIT License.
Please refer to the LICENSE file for more information.


Third-party Work in this Repository
-----------------------------------
This project includes XSD and JSON Schema files, developed by IDTA and published
at https://github.com/admin-shell-io/aas-specs/

under the terms of the Creative Commons Attribution 4.0 International (CC-BY-4.0)
https://github.com/admin-shell-io/aas-specs/?tab=CC-BY-4.0-1-ov-file#readme

These files are located at
- `aas_compliance_tool/schemas/aasJSONSchema.json` and
- `aas_compliance_tool/schemas/aasXMLSchema.xsd`.

17 changes: 17 additions & 0 deletions compliance_tool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# AAS Compliance Tool
An AAS compliance checker based on the [Eclipse BaSyx Python SDK](https://github.com/eclipse-basyx/basyx-python-sdk) for testing XML and JSON files.
Following functionalities are supported:

* create an xml or json file compliant to the official schema containing example Asset Administration Shell elements
* create an aasx file with xml or json files compliant to the official schema containing example Asset Administration
Shell elements
* check if a given xml or json file is compliant to the official schema
* check if a given xml, json or aasx file is readable even if it is not compliant to the offical schema
* check if the data in a given xml, json or aasx file is the same as the example data
* check if two given xml, json or aasx files contain the same Asset Administration Shell elements in any order

Invoking should work with either `python -m aas_compliance_tool.cli` or (when installed correctly and PATH is set
correctly) with `aas-compliance-check` on the command line.

For further usage information consider the `aas_compliance_tool`-package or invoke with
`python -m aas_compliance_tool.cli --help` respectively `aas-compliance-check --help`.
Empty file added compliance_tool/__init__.py
Empty file.
Empty file.
Loading

0 comments on commit 92ee7b3

Please sign in to comment.