From 639248025c131479cfb714bc8c6efec1e21f14eb Mon Sep 17 00:00:00 2001 From: Sercan Sahin Date: Sun, 29 Dec 2024 23:43:11 +0100 Subject: [PATCH 1/8] add pyproject.toml --- .gitignore | 1 + compliance_tool/pyproject.toml | 52 ++++++++++++++++++++++++++++++++ compliance_tool/requirements.txt | 3 -- compliance_tool/setup.py | 43 -------------------------- 4 files changed, 53 insertions(+), 46 deletions(-) create mode 100644 compliance_tool/pyproject.toml delete mode 100644 compliance_tool/requirements.txt delete mode 100644 compliance_tool/setup.py diff --git a/.gitignore b/.gitignore index dc7eddbb6..18b522c3a 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ sdk/test/adapter/schemas # Ignore dynamically generated version file sdk/basyx/version.py +compliance_tool/aas_compliance_tool/version.py # ignore the content of the server storage server/storage/ diff --git a/compliance_tool/pyproject.toml b/compliance_tool/pyproject.toml new file mode 100644 index 000000000..c9ce5ac38 --- /dev/null +++ b/compliance_tool/pyproject.toml @@ -0,0 +1,52 @@ +[build-system] +requires = [ + "setuptools>=45", + "wheel", + "setuptools_scm[toml]>=6.2" +] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +# Configure setuptools_scm for version management: +# - Automatically infers the version number from the most recent git tag +# - Generates a version.py file in the package directory +# - Allows for automatic versioning between releases (e.g., 1.0.1.dev4+g12345) +# If you want to use the version anywhere in the code, use +# ``` +# from aas_compliance_tool.version import version +# print(f"Project version: {version}") +# ``` +root = ".." # Defines the path to the root of the repository +version_file = "aas_compliance_tool/version.py" + +[project] +name = "aas_compliance_tool" +dynamic = ["version"] +description = "AAS compliance checker based on the Eclipse BaSyx Python SDK" +authors = [ + { name = "The AAS Compliance Tool authors", email = "admins@iat.rwth-aachen.de" } +] +readme = "README.md" +license = { file = "LICENSE" } +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Development Status :: 5 - Production/Stable" +] +requires-python = ">=3.9" +dependencies = [ + "pyecma376-2>=0.2.4", + "jsonschema>=4.21.1", + "basyx-python-sdk>=1.0.0", +] + +[project.urls] +"Homepage" = "https://github.com/eclipse-basyx/basyx-python-sdk" + +[tool.setuptools] +packages = { find = { include = ["aas_compliance_tool*"], exclude = ["test*"] } } + +[tool.setuptools.package-data] +aas_compliance_tool = ["py.typed"] + diff --git a/compliance_tool/requirements.txt b/compliance_tool/requirements.txt deleted file mode 100644 index 89a1d39df..000000000 --- a/compliance_tool/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -pyecma376-2>=0.2.4 -jsonschema>=4.21.1 -basyx-python-sdk>=1.0.0 diff --git a/compliance_tool/setup.py b/compliance_tool/setup.py deleted file mode 100644 index c214d4bcd..000000000 --- a/compliance_tool/setup.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (c) 2019-2021 the Eclipse BaSyx Authors -# -# This program and the accompanying materials are made available under the terms of the MIT License, available in -# the LICENSE file of this project. -# -# SPDX-License-Identifier: MIT - -import setuptools - -with open("README.md", "r", encoding='utf-8') as fh: - long_description = fh.read() - -setuptools.setup( - name="aas_compliance_tool", - version="1.0.0", - author="The AAS Compliance Tool authors", - description="AAS compliance checker based on the Eclipse BaSyx Python SDK", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/rwth-iat/aas-compliance-tool", - packages=setuptools.find_packages(exclude=["test", "test.*"]), - zip_safe=False, - package_data={ - "aas_compliance_tool": ["py.typed", "schemas/aasJSONSchema.json", "schemas/aasXMLSchema.xsd"], - }, - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Development Status :: 5 - Production/Stable", - ], - entry_points={ - 'console_scripts': [ - "aas-compliance-check = aas_compliance_tool:main" - ] - }, - python_requires='>=3.8', - install_requires=[ - 'pyecma376-2>=0.2.4', - 'basyx-python-sdk>=1.0.0', - ] -) From 6d8ef084b4b771cf396a3cd5c36a3e0c3d030bb0 Mon Sep 17 00:00:00 2001 From: Sercan Sahin Date: Mon, 30 Dec 2024 14:01:22 +0100 Subject: [PATCH 2/8] adapt check-python-versions ci job --- .github/workflows/ci.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8774ebfd..234881b39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,12 +29,14 @@ jobs: ${{ env.X_PYTHON_MIN_VERSION }} \ ${{ env.X_PYTHON_MAX_VERSION }} - - name: Check Python Versions coincide with the SDKs pyproject.toml + - name: Check Python Versions coincide with all pyproject.toml Files run: | - python check_python_versions_coincide.py \ - ../../sdk/pyproject.toml \ - ${{ env.X_PYTHON_MIN_VERSION }} \ - ${{ env.X_PYTHON_MAX_VERSION }} + for file in ../../sdk/pyproject.toml ../../compliance_tool/pyproject.toml; do + python check_python_versions_coincide.py \ + $file \ + ${{ env.X_PYTHON_MIN_VERSION }} \ + ${{ env.X_PYTHON_MAX_VERSION }} + done # Todo: Check other pyproject.toml here as well, as we add them From cf55b62346bfbd015c5fff4163fc3a0af8c1fd1c Mon Sep 17 00:00:00 2001 From: Sercan Sahin Date: Mon, 30 Dec 2024 15:05:46 +0100 Subject: [PATCH 3/8] adapt ci, install sdk dependency locally --- .github/workflows/ci.yml | 42 +++++++++++++++++----------------- compliance_tool/pyproject.toml | 8 +++++++ 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 234881b39..630f6c214 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,9 +14,9 @@ jobs: run: working-directory: ./etc/scripts steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} - name: Install Python dependencies @@ -74,7 +74,7 @@ jobs: exit 1 fi - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Collect schema files from aas-specs @@ -106,7 +106,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} - name: Install Python dependencies @@ -129,7 +129,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} - name: Install Python dependencies @@ -155,7 +155,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} - name: Install Python dependencies @@ -176,7 +176,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} - name: Install dependencies @@ -199,16 +199,16 @@ jobs: working-directory: ./compliance_tool steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 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 + # since the sdks dependencies are currently a superset of compliance-tools this is sufficient. + pip install ../sdk[dev] - name: Test with coverage + unittest run: | coverage run --source=aas_compliance_tool -m unittest @@ -225,16 +225,16 @@ jobs: run: working-directory: ./compliance_tool steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ env.X_PYTHON_VERSION }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 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 + # since the sdks dependencies are currently a superset of compliance-tools this is sufficient. + pip install ../sdk[dev] - name: Check typing with MyPy run: | mypy ./aas_compliance_tool test @@ -250,16 +250,16 @@ jobs: run: working-directory: ./compliance_tool steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ env.X_PYTHON_VERSION }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 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 + # since the sdks dependencies are currently a superset of compliance-tools this is sufficient. + pip install ../sdk[dev] - name: Check typing with MyPy run: | mypy <(codeblocks python README.md) @@ -278,9 +278,9 @@ jobs: run: working-directory: ./compliance_tool steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ env.X_PYTHON_VERSION }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ env.X_PYTHON_VERSION }} - name: Install dependencies diff --git a/compliance_tool/pyproject.toml b/compliance_tool/pyproject.toml index c9ce5ac38..c907f90df 100644 --- a/compliance_tool/pyproject.toml +++ b/compliance_tool/pyproject.toml @@ -41,6 +41,14 @@ dependencies = [ "basyx-python-sdk>=1.0.0", ] +[project.optional-dependencies] +dev = [ + "mypy", + "pycodestyle", + "codeblocks", + "coverage", +] + [project.urls] "Homepage" = "https://github.com/eclipse-basyx/basyx-python-sdk" From f10cdd0e0e9c01c7c2547dde70bac2a4a368724a Mon Sep 17 00:00:00 2001 From: Sercan Sahin Date: Mon, 30 Dec 2024 15:07:46 +0100 Subject: [PATCH 4/8] adapt ci action versions --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 15b22ea25..991e8ad7b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,9 +12,9 @@ jobs: run: working-directory: ./sdk steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python 3.10 - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: "3.10" - name: Install dependencies From 38e5abfcbf2a3e4cf9ad485afd008fb93a68062c Mon Sep 17 00:00:00 2001 From: Sercan Sahin Date: Mon, 30 Dec 2024 15:27:39 +0100 Subject: [PATCH 5/8] fix comments --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 630f6c214..f0df5f5ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -205,9 +205,9 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install Python dependencies + # since the sdks dependencies are currently a superset of compliance-tools this is sufficient. run: | python -m pip install --upgrade pip - # since the sdks dependencies are currently a superset of compliance-tools this is sufficient. pip install ../sdk[dev] - name: Test with coverage + unittest run: | @@ -231,9 +231,9 @@ jobs: with: python-version: ${{ env.X_PYTHON_VERSION }} - name: Install Python dependencies + # since the sdks dependencies are currently a superset of compliance-tools this is sufficient. run: | python -m pip install --upgrade pip - # since the sdks dependencies are currently a superset of compliance-tools this is sufficient. pip install ../sdk[dev] - name: Check typing with MyPy run: | @@ -256,9 +256,9 @@ jobs: with: python-version: ${{ env.X_PYTHON_VERSION }} - name: Install Python dependencies + # since the sdks dependencies are currently a superset of compliance-tools this is sufficient. run: | python -m pip install --upgrade pip - # since the sdks dependencies are currently a superset of compliance-tools this is sufficient. pip install ../sdk[dev] - name: Check typing with MyPy run: | From 81810f950986f2e99c2828851f825830b3170fd3 Mon Sep 17 00:00:00 2001 From: Sercan Sahin Date: Mon, 30 Dec 2024 15:36:33 +0100 Subject: [PATCH 6/8] fix packaging --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0df5f5ee..e45d912a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -286,10 +286,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel + pip install build - name: Create source and wheel dist run: | - python setup.py sdist bdist_wheel + python -m build server-package: # This job checks if we can build our server package From 38a12de4f6da54c838c80f211a4f3678b4398462 Mon Sep 17 00:00:00 2001 From: Sercan Sahin Date: Tue, 14 Jan 2025 15:49:22 +0100 Subject: [PATCH 7/8] adapt how we install dependencies in the ci --- .github/workflows/ci.yml | 15 +++++++++------ compliance_tool/pyproject.toml | 3 +++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e45d912a1..98ffbb415 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -205,10 +205,11 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install Python dependencies - # since the sdks dependencies are currently a superset of compliance-tools this is sufficient. + # install the local sdk in editable mode so it does not get overwritten run: | python -m pip install --upgrade pip - pip install ../sdk[dev] + pip install -e ../sdk[dev] + pip install .[dev] - name: Test with coverage + unittest run: | coverage run --source=aas_compliance_tool -m unittest @@ -231,10 +232,11 @@ jobs: with: python-version: ${{ env.X_PYTHON_VERSION }} - name: Install Python dependencies - # since the sdks dependencies are currently a superset of compliance-tools this is sufficient. + # install the local sdk in editable mode so it does not get overwritten run: | python -m pip install --upgrade pip - pip install ../sdk[dev] + pip install -e ../sdk[dev] + pip install .[dev] - name: Check typing with MyPy run: | mypy ./aas_compliance_tool test @@ -256,10 +258,11 @@ jobs: with: python-version: ${{ env.X_PYTHON_VERSION }} - name: Install Python dependencies - # since the sdks dependencies are currently a superset of compliance-tools this is sufficient. + # install the local sdk in editable mode so it does not get overwritten run: | python -m pip install --upgrade pip - pip install ../sdk[dev] + pip install -e ../sdk[dev] + pip install .[dev] - name: Check typing with MyPy run: | mypy <(codeblocks python README.md) diff --git a/compliance_tool/pyproject.toml b/compliance_tool/pyproject.toml index c907f90df..31cea53df 100644 --- a/compliance_tool/pyproject.toml +++ b/compliance_tool/pyproject.toml @@ -48,6 +48,9 @@ dev = [ "codeblocks", "coverage", ] +# if you want local changes to the sdk to affect the compliance-tool first install +# only this with pip install .[local-sdk] --no-deps then install the other requirements +local-sdk = ["-e ../sdk"] [project.urls] "Homepage" = "https://github.com/eclipse-basyx/basyx-python-sdk" From be0c20ae179ad695ad0191ea0b2b1d6863605f40 Mon Sep 17 00:00:00 2001 From: Sercan Sahin Date: Tue, 14 Jan 2025 15:53:32 +0100 Subject: [PATCH 8/8] remove change to pyproject.toml --- compliance_tool/pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/compliance_tool/pyproject.toml b/compliance_tool/pyproject.toml index 31cea53df..c907f90df 100644 --- a/compliance_tool/pyproject.toml +++ b/compliance_tool/pyproject.toml @@ -48,9 +48,6 @@ dev = [ "codeblocks", "coverage", ] -# if you want local changes to the sdk to affect the compliance-tool first install -# only this with pip install .[local-sdk] --no-deps then install the other requirements -local-sdk = ["-e ../sdk"] [project.urls] "Homepage" = "https://github.com/eclipse-basyx/basyx-python-sdk"