Skip to content

Commit

Permalink
compliance_tool: add pyproject.toml (#361)
Browse files Browse the repository at this point in the history
This refactors away from `setup.py` and towards
`pyproject.toml` for the `compliance_tool` 
package.

At the same step, we also update the relevant CI 
checks as well.
  • Loading branch information
Frosty2500 authored Feb 21, 2025
1 parent d32fd63 commit dae3354
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 33 deletions.
61 changes: 33 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -72,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
Expand Down Expand Up @@ -104,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
Expand All @@ -127,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
Expand All @@ -153,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
Expand All @@ -174,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
Expand Down Expand Up @@ -213,16 +215,17 @@ 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
# install the local sdk in editable mode so it does not get overwritten
run: |
python -m pip install --upgrade pip
pip install coverage
pip install -r requirements.txt
pip install -e ../sdk[dev]
pip install .[dev]
- name: Test with coverage + unittest
run: |
coverage run --source=aas_compliance_tool -m unittest
Expand All @@ -239,16 +242,17 @@ jobs:
run:
working-directory: ./compliance_tool
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
# install the local sdk in editable mode so it does not get overwritten
run: |
python -m pip install --upgrade pip
pip install pycodestyle mypy
pip install -r requirements.txt
pip install -e ../sdk[dev]
pip install .[dev]
- name: Check typing with MyPy
run: |
mypy ./aas_compliance_tool test
Expand All @@ -264,16 +268,17 @@ jobs:
run:
working-directory: ./compliance_tool
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
# install the local sdk in editable mode so it does not get overwritten
run: |
python -m pip install --upgrade pip
pip install pycodestyle mypy codeblocks
pip install -r requirements.txt
pip install -e ../sdk[dev]
pip install .[dev]
- name: Check typing with MyPy
run: |
mypy <(codeblocks python README.md)
Expand All @@ -292,18 +297,18 @@ jobs:
run:
working-directory: ./compliance_tool
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 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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
60 changes: 60 additions & 0 deletions compliance_tool/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[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.optional-dependencies]
dev = [
"mypy",
"pycodestyle",
"codeblocks",
"coverage",
]

[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"]

3 changes: 0 additions & 3 deletions compliance_tool/requirements.txt

This file was deleted.

0 comments on commit dae3354

Please sign in to comment.