Skip to content

Commit

Permalink
Replace setup.py with pyproject.toml and update CI configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
hadijannat committed Jul 5, 2024
1 parent c5aeec8 commit d03eaff
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 75 deletions.
93 changes: 44 additions & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,26 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
pip install poetry
- name: Install dependencies with Poetry
run: |
poetry install
- name: Collect schema files from aas-specs
run: |
mkdir -p ./test/adapter/schema
curl -sSL -o ./test/adapter/schema/aasJSONSchema.json https://raw.githubusercontent.com/admin-shell-io/aas-specs/${{ env.AAS_SPECS_RELEASE_TAG }}/schemas/json/aas.json
curl -sSL -o ./test/adapter/schema/aasXMLSchema.xsd https://raw.githubusercontent.com/admin-shell-io/aas-specs/${{ env.AAS_SPECS_RELEASE_TAG }}/schemas/xml/AAS.xsd
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install coverage
pip install .
- name: Setup test config and CouchDB database server
run: |
python test/_helper/setup_testdb.py -u "admin" -p "$COUCHDB_ADMIN_PASSWORD"
- name: Test with coverage + unittest
run: |
poetry run coverage run --source=basyx -m unittest
coverage run --source=basyx -m unittest
- name: Report test coverage
if: always()
if: ${{ always() }}
run: |
poetry run coverage report -m
coverage report -m
static-analysis:
runs-on: ubuntu-latest
Expand All @@ -60,44 +59,41 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ env.X_PYTHON_VERSION }}
- name: Install Poetry and dependencies
- name: Install Python dependencies
run: |
pip install poetry
poetry install
- name: Clear MyPy cache
run: rm -rf .mypy_cache
python -m pip install --upgrade pip
pip install pycodestyle mypy
pip install .
- name: Check typing with MyPy
run: |
poetry run mypy --config-file mypy.ini basyx test
mypy basyx test
- name: Check code style with PyCodestyle
run: |
poetry run pycodestyle --count --max-line-length 120 basyx test
pycodestyle --count --max-line-length 120 basyx test
readme-codeblocks:
runs-on: ubuntu-latest

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 Poetry and dependencies
run: |
pip install poetry
poetry install
- name: Install codeblocks, pycodestyle, and mypy
run: |
pip install codeblocks pycodestyle mypy
- name: Check typing with MyPy
run: |
poetry run mypy --config-file mypy.ini <(codeblocks python README.md)
- name: Check code style with PyCodestyle
run: |
codeblocks --wrap python README.md | pycodestyle --max-line-length 120 -
- name: Run readme codeblocks with Python
run: |
codeblocks python README.md | python
- 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 .
- 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
docs:
runs-on: ubuntu-latest
Expand All @@ -108,14 +104,14 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ env.X_PYTHON_VERSION }}
- name: Install Poetry and documentation dependencies
- name: Install Python dependencies
run: |
pip install poetry
poetry install
poetry run pip install -r docs/add-requirements.txt
- name: Build and check documentation
python -m pip install --upgrade pip
pip install .
pip install -r docs/add-requirements.txt
- name: Check documentation for errors
run: |
SPHINXOPTS="-a -E -n -W --keep-going" poetry run make -C docs html
SPHINXOPTS="-a -E -n -W --keep-going" make -C docs html
package:
runs-on: ubuntu-latest
Expand All @@ -126,11 +122,10 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ env.X_PYTHON_VERSION }}
- name: Install dependencies and build package
- name: Install dependencies
run: |
```yaml
pip install poetry
poetry install
- name: Build source and wheel distribution
python -m pip install --upgrade pip
pip install build
- name: Create source and wheel dist
run: |
poetry build
python -m build
57 changes: 31 additions & 26 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,41 +1,46 @@
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["setuptools>=45", "wheel"]
build-backend = "setuptools.build_meta"

[tool.poetry]
[project]
name = "basyx-python-sdk"
version = "0.1.0"
dynamic = ["version"]
authors = [
{name = "The Eclipse BaSyx Authors", email = "[email protected]"}
]
description = "The Eclipse BaSyx Python SDK, an implementation of the Asset Administration Shell for Industry 4.0 systems"
authors = ["The Eclipse BaSyx Authors IAT, RWTH Aachen University"]
license = "MIT"
readme = "README.md"
homepage = "https://github.com/eclipse-basyx/basyx-python-sdk"
requires-python = ">=3.8"
license = {file = "LICENSE"}
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Development Status :: 5 - Production/Stable",
]
packages = [
{ include = "basyx" }
dependencies = [
"python-dateutil>=2.8,<3",
"lxml>=4.2,<5",
"urllib3>=1.26,<2.0",
"pyecma376-2>=0.2.4",
"jsonschema~=4.7",
"types-python-dateutil",
"lxml-stubs~=0.5.1",
]
exclude = ["tests", "tests.*"]
include = ["basyx/py.typed", "basyx.aas.examples.data/TestFile.pdf"]

[tool.poetry.dependencies]
python = "^3.8"
jsonschema = "~4.7"
lxml = ">=4.2,<5"
python-dateutil = ">=2.8,<3.0"
pyecma376-2 = ">=0.2.4"
urllib3 = ">=1.26,<2.0"
lxml-stubs = "~0.5.1"

[tool.poetry.dev-dependencies]
types-python-dateutil = "*"
#dateutil-stubs = "*"
coverage = "^5.5"
mypy = "^0.910"
[project.urls]
Homepage = "https://github.com/eclipse-basyx/basyx-python-sdk"

[tool.poetry.scripts]
[project.scripts]
aas-compliance-check = "basyx.aas.compliance_tool.cli:main"

[tool.setuptools]
packages = {find = {exclude = ["test", "test.*"]}}
zip-safe = false

[tool.setuptools.package-data]
"basyx" = ["py.typed"]
"basyx.aas.examples.data" = ["TestFile.pdf"]

[tool.setuptools.dynamic]
version = {attr = "basyx.aas.__version__"}

0 comments on commit d03eaff

Please sign in to comment.