From 6c18a74a923d9a63e21585044ad61eaf95b8d0b5 Mon Sep 17 00:00:00 2001 From: Gijs Molenaar Date: Thu, 2 May 2024 18:18:16 +0200 Subject: [PATCH 1/8] Also include submodules --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e505b0cb..9e7a1dba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,8 +39,7 @@ doc = ["sphinx", "sphinx_rtd_theme"] snap7 = ["py.typed", "lib/libsnap7.so", "lib/snap7.dll", "lib/libsnap7.dylib"] [tool.setuptools.packages.find] -where = ["."] -include = ["snap7", "snap7.lib"] +include = ["snap7*"] [project.scripts] snap7-server = "snap7.server.__main__:main" From 4eba9790a91685abcedab32d3918ccf4319b60a8 Mon Sep 17 00:00:00 2001 From: Gijs Molenaar Date: Thu, 2 May 2024 18:24:32 +0200 Subject: [PATCH 2/8] drop python 3.8, almost EOL --- .github/workflows/build-and-test-arm64.yml | 2 +- .github/workflows/build-and-test.yml | 2 +- .github/workflows/linux.yml | 2 +- .github/workflows/pre-commit.yml | 2 +- .github/workflows/test-pypi-packages.yml | 2 +- README.rst | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-test-arm64.yml b/.github/workflows/build-and-test-arm64.yml index c0e61225..acd93315 100644 --- a/.github/workflows/build-and-test-arm64.yml +++ b/.github/workflows/build-and-test-arm64.yml @@ -40,7 +40,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: [3.9", "3.10", "3.11", "3.12"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index e4212115..e7d33df4 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -97,7 +97,7 @@ jobs: strategy: matrix: os: [ubuntu-20.04, windows-2022, macos-14] - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 4c35d2d6..b069d4e5 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: [3.9", "3.10", "3.11", "3.12"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 0dba3039..371b529d 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -11,5 +11,5 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: '3.9' - uses: pre-commit/action@v3.0.1 diff --git a/.github/workflows/test-pypi-packages.yml b/.github/workflows/test-pypi-packages.yml index 0f29fbd7..e1b6782c 100644 --- a/.github/workflows/test-pypi-packages.yml +++ b/.github/workflows/test-pypi-packages.yml @@ -6,7 +6,7 @@ jobs: strategy: matrix: os: [ubuntu-22.04, ubuntu-20.04, macos-14, macos-11, windows-2022, windows-2019] - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/README.rst b/README.rst index 142808a9..d83c8a7e 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ This is a ctypes-based Python wrapper for snap7. Snap7 is an open-source, 32/64 bit, multi-platform Ethernet communication suite for interfacing natively with Siemens S7 PLCs. -Python-snap7 is tested with Python 3.8+, on Windows, Linux and OS X. +Python-snap7 is tested with Python 3.9+, on Windows, Linux and OS X. The full documentation is available on `Read The Docs `_. From eabf2fc11427d855184cefe6016142508ffea93d Mon Sep 17 00:00:00 2001 From: Gijs Molenaar Date: Thu, 2 May 2024 18:25:37 +0200 Subject: [PATCH 3/8] typo --- .github/workflows/build-and-test-arm64.yml | 2 +- .github/workflows/linux.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-test-arm64.yml b/.github/workflows/build-and-test-arm64.yml index acd93315..c67b4f38 100644 --- a/.github/workflows/build-and-test-arm64.yml +++ b/.github/workflows/build-and-test-arm64.yml @@ -40,7 +40,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: [3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index b069d4e5..d1481f14 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: [3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - name: Checkout uses: actions/checkout@v4 From c6f42589b9bdd3240c31c58e57efcbb331ac0dbb Mon Sep 17 00:00:00 2001 From: Gijs Molenaar Date: Fri, 3 May 2024 09:54:31 +0200 Subject: [PATCH 4/8] dont fail full step if job fails --- .github/workflows/build-and-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index e7d33df4..c48c9921 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -93,6 +93,7 @@ jobs: test-wheels-86_64: name: Testing wheels needs: [linux-build-86_64, windows-build, osx-build] + continue-on-error: true runs-on: ${{ matrix.os }} strategy: matrix: From c69e9a7f04eddddb4bbc79ccb72a84de49fc0580 Mon Sep 17 00:00:00 2001 From: Gijs Molenaar Date: Fri, 3 May 2024 09:59:09 +0200 Subject: [PATCH 5/8] add more pre commits --- .pre-commit-config.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1ee2778b..b6b4a8c5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,10 +4,12 @@ repos: hooks: - id: trailing-whitespace - id: end-of-file-fixer + - id: check-ast - id: check-json - id: check-toml - id: check-xml - id: check-yaml + - id: check-merge-conflict - id: debug-statements - id: check-builtin-literals - id: check-case-conflict @@ -25,3 +27,4 @@ repos: rev: 'v0.4.2' hooks: - id: ruff + - id: ruff-format From c52479c2f73722901948c5393373534a73115ac8 Mon Sep 17 00:00:00 2001 From: Gijs Molenaar Date: Fri, 3 May 2024 10:19:49 +0200 Subject: [PATCH 6/8] rename for clarity --- ...-and-test.yml => build-and-test-amd64.yml} | 8 +++--- .github/workflows/build-and-test-arm64.yml | 12 ++++----- .github/workflows/linux.yml | 10 ++++--- .github/workflows/test-pypi-packages.yml | 27 +++++++------------ 4 files changed, 26 insertions(+), 31 deletions(-) rename .github/workflows/{build-and-test.yml => build-and-test-amd64.yml} (95%) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test-amd64.yml similarity index 95% rename from .github/workflows/build-and-test.yml rename to .github/workflows/build-and-test-amd64.yml index c48c9921..927280b6 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test-amd64.yml @@ -1,11 +1,11 @@ -name: build-and-test-wheels +name: Build and test wheels AMD64 on: push: branches: [master] pull_request: branches: [master] jobs: - linux-build-86_64: + linux-build: name: Build wheel for linux x86_64 runs-on: ubuntu-20.04 steps: @@ -92,12 +92,12 @@ jobs: test-wheels-86_64: name: Testing wheels - needs: [linux-build-86_64, windows-build, osx-build] + needs: [linux-build, windows-build, osx-build] continue-on-error: true runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04, windows-2022, macos-14] + os: [ubuntu-22.04, ubuntu-20.04, macos-14, macos-11, windows-2022, windows-2019] python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - name: Checkout diff --git a/.github/workflows/build-and-test-arm64.yml b/.github/workflows/build-and-test-arm64.yml index c67b4f38..777519fc 100644 --- a/.github/workflows/build-and-test-arm64.yml +++ b/.github/workflows/build-and-test-arm64.yml @@ -1,11 +1,11 @@ -name: build-and-test-wheels-arm64 +name: Build and test wheels ARM64 on: push: branches: [master] pull_request: branches: [master] jobs: - linux-build-aarch64: + linux-build-arm64: name: Build wheel for linux arm64 runs-on: ubuntu-20.04 steps: @@ -20,7 +20,7 @@ jobs: with: platforms: arm64 - - name: Build wheel + - name: Build wheel for aarch64 uses: ./.github/actions/manylinux_2_28_aarch64 with: script: ./.github/build_scripts/build_package.sh @@ -34,9 +34,9 @@ jobs: name: wheels path: wheelhouse/*.whl - test-wheels-aarch64: - name: Testing wheel - needs: linux-build-aarch64 + test-wheels-arm64: + name: Testing wheel for arm64 + needs: linux-build-arm64 runs-on: ubuntu-20.04 strategy: matrix: diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index d1481f14..473b30d0 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -1,4 +1,4 @@ -name: Linux Test all Pythons +name: Linux Test all Pythons with Debian packages on: push: branches: [master] @@ -6,10 +6,12 @@ on: branches: [master] jobs: build: - runs-on: ubuntu-20.04 strategy: matrix: python-version: ["3.9", "3.10", "3.11", "3.12"] + runs-on: ["ubuntu-20.04", "ubuntu-22.04"] + runs-on: ${{ matrix.runs-on }} + continue-on-error: true steps: - name: Checkout uses: actions/checkout@v4 @@ -32,5 +34,5 @@ jobs: venv/bin/pip install ".[test]" - name: Run pytest run: | - venv/bin/pytest tests/test_client.py tests/test_mainloop.py tests/test_server.py tests/test_util.py - sudo venv/bin/pytest tests/test_partner.py + venv/bin/pytest -m "server or util or client or mainloop" + sudo venv/bin/pytest -m partner diff --git a/.github/workflows/test-pypi-packages.yml b/.github/workflows/test-pypi-packages.yml index e1b6782c..b733bf3e 100644 --- a/.github/workflows/test-pypi-packages.yml +++ b/.github/workflows/test-pypi-packages.yml @@ -16,27 +16,20 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Install pytest - run: | - python3 -m pip install --upgrade pip - python3 -m pip install pytest - - name: install python-snap7 - run: python3 -m pip install -i https://test.pypi.org/simple/ python-snap7 + run: | + python3 -m venv venv + venv/bin/pip install --upgrade pip + venv/bin/pip install -i https://test.pypi.org/simple/ python-snap7[test] - name: Run pytest run: | - which pytest - pytest -m "server or util or client or mainloop" - - - name: Run tests required sudo - if: ${{ runner.os == 'Linux'}} - run: sudo /opt/hostedtoolcache/Python/${{ matrix.python-version }}*/x64/bin/pytest -m partner + venv/bin/pytest -m "server or util or client or mainloop" - - name: Run tests required sudo - if: ${{ runner.os == 'macOS'}} - run: sudo pytest -m partner + - name: Run tests required sudo on Linux and macOS + if: ${{ runner.os == 'Linux' || runner.os == 'macOS'}} + run: sudo venv/bin/pytest -m partner - - name: Run tests required sudo + - name: On windows we don't need sudo if: ${{ runner.os == 'Windows'}} - run: pytest -m partner + run: venv/bin/pytest -m partner From e123a4dd7000e696b93299a25de67e7e83990e9e Mon Sep 17 00:00:00 2001 From: Gijs Molenaar Date: Fri, 3 May 2024 10:29:43 +0200 Subject: [PATCH 7/8] lets try this --- .github/workflows/build-and-test-amd64.yml | 10 +++++----- .github/workflows/build-and-test-arm64.yml | 1 + .github/workflows/linux.yml | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-test-amd64.yml b/.github/workflows/build-and-test-amd64.yml index 927280b6..e67dc9a5 100644 --- a/.github/workflows/build-and-test-amd64.yml +++ b/.github/workflows/build-and-test-amd64.yml @@ -6,7 +6,7 @@ on: branches: [master] jobs: linux-build: - name: Build wheel for linux x86_64 + name: Build wheel for linux AMD64 runs-on: ubuntu-20.04 steps: - name: Checkout @@ -31,7 +31,7 @@ jobs: path: wheelhouse/*/*.whl windows-build: - name: Build wheel for windows + name: Build wheel for windows AMD64 runs-on: windows-2022 steps: - name: Checkout @@ -55,7 +55,7 @@ jobs: path: wheelhouse/*/*.whl osx-build: - name: Build wheel for osx + name: Build wheel for osx AMD64 runs-on: macos-11 steps: - name: Checkout @@ -91,9 +91,9 @@ jobs: test-wheels-86_64: - name: Testing wheels + name: Testing wheels for AMD64 needs: [linux-build, windows-build, osx-build] - continue-on-error: true + if: success() || failure() # this makes sure the job runs even if another matrix job failed runs-on: ${{ matrix.os }} strategy: matrix: diff --git a/.github/workflows/build-and-test-arm64.yml b/.github/workflows/build-and-test-arm64.yml index 777519fc..8aa203c2 100644 --- a/.github/workflows/build-and-test-arm64.yml +++ b/.github/workflows/build-and-test-arm64.yml @@ -37,6 +37,7 @@ jobs: test-wheels-arm64: name: Testing wheel for arm64 needs: linux-build-arm64 + if: success() || failure() # this makes sure the job runs even if another matrix job failed runs-on: ubuntu-20.04 strategy: matrix: diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 473b30d0..c8a5bc4f 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -11,7 +11,7 @@ jobs: python-version: ["3.9", "3.10", "3.11", "3.12"] runs-on: ["ubuntu-20.04", "ubuntu-22.04"] runs-on: ${{ matrix.runs-on }} - continue-on-error: true + if: success() || failure() # this makes sure the job runs even if another matrix job failed steps: - name: Checkout uses: actions/checkout@v4 From b850dc32f6dd2abbfd3d830ead13e01986e30ee9 Mon Sep 17 00:00:00 2001 From: Gijs Molenaar Date: Fri, 3 May 2024 10:32:25 +0200 Subject: [PATCH 8/8] nah i think we want this --- .github/workflows/build-and-test-amd64.yml | 2 +- .github/workflows/build-and-test-arm64.yml | 2 +- .github/workflows/linux.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-test-amd64.yml b/.github/workflows/build-and-test-amd64.yml index e67dc9a5..dfa3568f 100644 --- a/.github/workflows/build-and-test-amd64.yml +++ b/.github/workflows/build-and-test-amd64.yml @@ -93,7 +93,7 @@ jobs: test-wheels-86_64: name: Testing wheels for AMD64 needs: [linux-build, windows-build, osx-build] - if: success() || failure() # this makes sure the job runs even if another matrix job failed + continue-on-error: true runs-on: ${{ matrix.os }} strategy: matrix: diff --git a/.github/workflows/build-and-test-arm64.yml b/.github/workflows/build-and-test-arm64.yml index 8aa203c2..1dedcdd7 100644 --- a/.github/workflows/build-and-test-arm64.yml +++ b/.github/workflows/build-and-test-arm64.yml @@ -37,7 +37,7 @@ jobs: test-wheels-arm64: name: Testing wheel for arm64 needs: linux-build-arm64 - if: success() || failure() # this makes sure the job runs even if another matrix job failed + continue-on-error: true runs-on: ubuntu-20.04 strategy: matrix: diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index c8a5bc4f..473b30d0 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -11,7 +11,7 @@ jobs: python-version: ["3.9", "3.10", "3.11", "3.12"] runs-on: ["ubuntu-20.04", "ubuntu-22.04"] runs-on: ${{ matrix.runs-on }} - if: success() || failure() # this makes sure the job runs even if another matrix job failed + continue-on-error: true steps: - name: Checkout uses: actions/checkout@v4