Skip to content

Commit dae3354

Browse files
authored
compliance_tool: add pyproject.toml (eclipse-basyx#361)
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.
1 parent d32fd63 commit dae3354

File tree

5 files changed

+96
-33
lines changed

5 files changed

+96
-33
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
run:
1515
working-directory: ./etc/scripts
1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v4
1818
- name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }}
19-
uses: actions/setup-python@v2
19+
uses: actions/setup-python@v5
2020
with:
2121
python-version: ${{ env.X_PYTHON_MIN_VERSION }}
2222
- name: Install Python dependencies
@@ -29,12 +29,14 @@ jobs:
2929
${{ env.X_PYTHON_MIN_VERSION }} \
3030
${{ env.X_PYTHON_MAX_VERSION }}
3131
32-
- name: Check Python Versions coincide with the SDKs pyproject.toml
32+
- name: Check Python Versions coincide with all pyproject.toml Files
3333
run: |
34-
python check_python_versions_coincide.py \
35-
../../sdk/pyproject.toml \
36-
${{ env.X_PYTHON_MIN_VERSION }} \
37-
${{ env.X_PYTHON_MAX_VERSION }}
34+
for file in ../../sdk/pyproject.toml ../../compliance_tool/pyproject.toml; do
35+
python check_python_versions_coincide.py \
36+
$file \
37+
${{ env.X_PYTHON_MIN_VERSION }} \
38+
${{ env.X_PYTHON_MAX_VERSION }}
39+
done
3840
3941
# Todo: Check other pyproject.toml here as well, as we add them
4042

@@ -72,7 +74,7 @@ jobs:
7274
exit 1
7375
fi
7476
- name: Set up Python ${{ matrix.python-version }}
75-
uses: actions/setup-python@v4
77+
uses: actions/setup-python@v5
7678
with:
7779
python-version: ${{ matrix.python-version }}
7880
- name: Collect schema files from aas-specs
@@ -104,7 +106,7 @@ jobs:
104106
steps:
105107
- uses: actions/checkout@v4
106108
- name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }}
107-
uses: actions/setup-python@v2
109+
uses: actions/setup-python@v5
108110
with:
109111
python-version: ${{ env.X_PYTHON_MIN_VERSION }}
110112
- name: Install Python dependencies
@@ -127,7 +129,7 @@ jobs:
127129
steps:
128130
- uses: actions/checkout@v4
129131
- name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }}
130-
uses: actions/setup-python@v2
132+
uses: actions/setup-python@v5
131133
with:
132134
python-version: ${{ env.X_PYTHON_MIN_VERSION }}
133135
- name: Install Python dependencies
@@ -153,7 +155,7 @@ jobs:
153155
steps:
154156
- uses: actions/checkout@v4
155157
- name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }}
156-
uses: actions/setup-python@v2
158+
uses: actions/setup-python@v5
157159
with:
158160
python-version: ${{ env.X_PYTHON_MIN_VERSION }}
159161
- name: Install Python dependencies
@@ -174,7 +176,7 @@ jobs:
174176
steps:
175177
- uses: actions/checkout@v4
176178
- name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }}
177-
uses: actions/setup-python@v2
179+
uses: actions/setup-python@v5
178180
with:
179181
python-version: ${{ env.X_PYTHON_MIN_VERSION }}
180182
- name: Install dependencies
@@ -213,16 +215,17 @@ jobs:
213215
working-directory: ./compliance_tool
214216

215217
steps:
216-
- uses: actions/checkout@v2
218+
- uses: actions/checkout@v4
217219
- name: Set up Python ${{ matrix.python-version }}
218-
uses: actions/setup-python@v2
220+
uses: actions/setup-python@v5
219221
with:
220222
python-version: ${{ matrix.python-version }}
221223
- name: Install Python dependencies
224+
# install the local sdk in editable mode so it does not get overwritten
222225
run: |
223226
python -m pip install --upgrade pip
224-
pip install coverage
225-
pip install -r requirements.txt
227+
pip install -e ../sdk[dev]
228+
pip install .[dev]
226229
- name: Test with coverage + unittest
227230
run: |
228231
coverage run --source=aas_compliance_tool -m unittest
@@ -239,16 +242,17 @@ jobs:
239242
run:
240243
working-directory: ./compliance_tool
241244
steps:
242-
- uses: actions/checkout@v2
245+
- uses: actions/checkout@v4
243246
- name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }}
244-
uses: actions/setup-python@v2
247+
uses: actions/setup-python@v5
245248
with:
246249
python-version: ${{ env.X_PYTHON_MIN_VERSION }}
247250
- name: Install Python dependencies
251+
# install the local sdk in editable mode so it does not get overwritten
248252
run: |
249253
python -m pip install --upgrade pip
250-
pip install pycodestyle mypy
251-
pip install -r requirements.txt
254+
pip install -e ../sdk[dev]
255+
pip install .[dev]
252256
- name: Check typing with MyPy
253257
run: |
254258
mypy ./aas_compliance_tool test
@@ -264,16 +268,17 @@ jobs:
264268
run:
265269
working-directory: ./compliance_tool
266270
steps:
267-
- uses: actions/checkout@v2
271+
- uses: actions/checkout@v4
268272
- name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }}
269-
uses: actions/setup-python@v2
273+
uses: actions/setup-python@v5
270274
with:
271275
python-version: ${{ env.X_PYTHON_MIN_VERSION }}
272276
- name: Install Python dependencies
277+
# install the local sdk in editable mode so it does not get overwritten
273278
run: |
274279
python -m pip install --upgrade pip
275-
pip install pycodestyle mypy codeblocks
276-
pip install -r requirements.txt
280+
pip install -e ../sdk[dev]
281+
pip install .[dev]
277282
- name: Check typing with MyPy
278283
run: |
279284
mypy <(codeblocks python README.md)
@@ -292,18 +297,18 @@ jobs:
292297
run:
293298
working-directory: ./compliance_tool
294299
steps:
295-
- uses: actions/checkout@v2
300+
- uses: actions/checkout@v4
296301
- name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }}
297-
uses: actions/setup-python@v2
302+
uses: actions/setup-python@v5
298303
with:
299304
python-version: ${{ env.X_PYTHON_MIN_VERSION }}
300305
- name: Install dependencies
301306
run: |
302307
python -m pip install --upgrade pip
303-
pip install setuptools wheel
308+
pip install build
304309
- name: Create source and wheel dist
305310
run: |
306-
python setup.py sdist bdist_wheel
311+
python -m build
307312
308313
server-package:
309314
# This job checks if we can build our server package

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
run:
1313
working-directory: ./sdk
1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
1616
- name: Set up Python 3.10
17-
uses: actions/setup-python@v2
17+
uses: actions/setup-python@v5
1818
with:
1919
python-version: "3.10"
2020
- name: Install dependencies

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ sdk/test/adapter/schemas
2828

2929
# Ignore dynamically generated version file
3030
sdk/basyx/version.py
31+
compliance_tool/aas_compliance_tool/version.py
3132

3233
# ignore the content of the server storage
3334
server/storage/

compliance_tool/pyproject.toml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
[build-system]
2+
requires = [
3+
"setuptools>=45",
4+
"wheel",
5+
"setuptools_scm[toml]>=6.2"
6+
]
7+
build-backend = "setuptools.build_meta"
8+
9+
[tool.setuptools_scm]
10+
# Configure setuptools_scm for version management:
11+
# - Automatically infers the version number from the most recent git tag
12+
# - Generates a version.py file in the package directory
13+
# - Allows for automatic versioning between releases (e.g., 1.0.1.dev4+g12345)
14+
# If you want to use the version anywhere in the code, use
15+
# ```
16+
# from aas_compliance_tool.version import version
17+
# print(f"Project version: {version}")
18+
# ```
19+
root = ".." # Defines the path to the root of the repository
20+
version_file = "aas_compliance_tool/version.py"
21+
22+
[project]
23+
name = "aas_compliance_tool"
24+
dynamic = ["version"]
25+
description = "AAS compliance checker based on the Eclipse BaSyx Python SDK"
26+
authors = [
27+
{ name = "The AAS Compliance Tool authors", email = "[email protected]" }
28+
]
29+
readme = "README.md"
30+
license = { file = "LICENSE" }
31+
classifiers = [
32+
"Programming Language :: Python :: 3",
33+
"License :: OSI Approved :: MIT License",
34+
"Operating System :: OS Independent",
35+
"Development Status :: 5 - Production/Stable"
36+
]
37+
requires-python = ">=3.9"
38+
dependencies = [
39+
"pyecma376-2>=0.2.4",
40+
"jsonschema>=4.21.1",
41+
"basyx-python-sdk>=1.0.0",
42+
]
43+
44+
[project.optional-dependencies]
45+
dev = [
46+
"mypy",
47+
"pycodestyle",
48+
"codeblocks",
49+
"coverage",
50+
]
51+
52+
[project.urls]
53+
"Homepage" = "https://github.com/eclipse-basyx/basyx-python-sdk"
54+
55+
[tool.setuptools]
56+
packages = { find = { include = ["aas_compliance_tool*"], exclude = ["test*"] } }
57+
58+
[tool.setuptools.package-data]
59+
aas_compliance_tool = ["py.typed"]
60+

compliance_tool/requirements.txt

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

0 commit comments

Comments
 (0)