diff --git a/.github/workflows/linux-build-test-amd64.yml b/.github/workflows/linux-build-test-amd64.yml index d02d1a4f..120a188b 100644 --- a/.github/workflows/linux-build-test-amd64.yml +++ b/.github/workflows/linux-build-test-amd64.yml @@ -39,7 +39,7 @@ jobs: strategy: matrix: os: ["ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04"] - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/linux-build-test-arm64.yml b/.github/workflows/linux-build-test-arm64.yml index 66ce2c5f..34b8048d 100644 --- a/.github/workflows/linux-build-test-arm64.yml +++ b/.github/workflows/linux-build-test-arm64.yml @@ -41,7 +41,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", "3.13"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/linux-test-with-deb.yml b/.github/workflows/linux-test-with-deb.yml index 4f84c74c..e582312a 100644 --- a/.github/workflows/linux-test-with-deb.yml +++ b/.github/workflows/linux-test-with-deb.yml @@ -8,7 +8,7 @@ jobs: build: strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] runs-on: ["ubuntu-20.04", "ubuntu-22.04", "ubuntu-24.04"] runs-on: ${{ matrix.runs-on }} steps: diff --git a/.github/workflows/osx-build-test-amd64.yml b/.github/workflows/osx-build-test-amd64.yml index 72e0d258..e5f905a6 100644 --- a/.github/workflows/osx-build-test-amd64.yml +++ b/.github/workflows/osx-build-test-amd64.yml @@ -46,8 +46,13 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-14, macos-12] - python-version: ["3.9", "3.10", "3.11", "3.12"] + os: ["macos-12", "macos-13", "macos-14", "macos-15"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + + exclude: + - os: "macos-12" + python-version: "3.13" + steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/osx-test-with-brew.yml b/.github/workflows/osx-test-with-brew.yml index 4a179dbe..79225889 100644 --- a/.github/workflows/osx-test-with-brew.yml +++ b/.github/workflows/osx-test-with-brew.yml @@ -8,8 +8,12 @@ jobs: osx_wheel: strategy: matrix: - python-version: [ "3.9", "3.10", "3.11", "3.12" ] - runs-on: [ "macos-14", "macos-12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ] + runs-on: ["macos-12", "macos-13", "macos-14", "macos-15"] + exclude: + - os: "macos-12" + python-version: "3.13" + runs-on: ${{ matrix.runs-on }} steps: - name: Checkout diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index f0698966..82c45eb2 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -53,8 +53,8 @@ jobs: needs: publish-to-testpypi strategy: matrix: - os: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, macos-14, macos-12, windows-2022, windows-2019] - python-version: ["3.9", "3.10", "3.11", "3.12"] + os: ["ubuntu-24.04"," ubuntu-22.04", "ubuntu-20.04", "macos-12", "macos-13", "macos-14", "macos-15", "windows-2019", "windows-2022"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/publish-test-pypi.yml b/.github/workflows/publish-test-pypi.yml index 0d405073..d5c03288 100644 --- a/.github/workflows/publish-test-pypi.yml +++ b/.github/workflows/publish-test-pypi.yml @@ -56,8 +56,8 @@ jobs: needs: publish-to-testpypi strategy: matrix: - os: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, macos-14, macos-12, windows-2022, windows-2019] - python-version: ["3.9", "3.10", "3.11", "3.12"] + os: ["ubuntu-24.04"," ubuntu-22.04", "ubuntu-20.04", "macos-12", "macos-13", "macos-14", "macos-15", "windows-2019", "windows-2022"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/windows-build-test-amd64.yml b/.github/workflows/windows-build-test-amd64.yml index ee9674bf..c7afb8d2 100644 --- a/.github/workflows/windows-build-test-amd64.yml +++ b/.github/workflows/windows-build-test-amd64.yml @@ -34,7 +34,7 @@ jobs: strategy: matrix: os: [windows-2022, windows-2019] - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/windows-test.yml b/.github/workflows/windows-test.yml index 794d8f8d..5527ba8a 100644 --- a/.github/workflows/windows-test.yml +++ b/.github/workflows/windows-test.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: runs-on: [ "windows-2022", "windows-2019" ] - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] runs-on: ${{ matrix.runs-on }} steps: - name: Checkout diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4b7a8e34..6482ec8a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,30 +1,35 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-ast + - id: check-shebang-scripts-are-executable - id: check-json + - id: check-symlinks - id: check-toml - id: check-xml - id: check-yaml + - id: check-illegal-windows-names - id: check-merge-conflict - id: debug-statements - id: check-builtin-literals - id: check-case-conflict - id: check-docstring-first - id: detect-private-key + - id: forbid-submodules + - id: mixed-line-ending - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v1.10.0' + rev: 'v1.13.0' hooks: - id: mypy additional_dependencies: [types-setuptools, types-click] files: ^snap7 - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.4.2' + rev: 'v0.7.2' hooks: - id: ruff - id: ruff-format diff --git a/pyproject.toml b/pyproject.toml index b267afbc..8fc55f42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "python-snap7" -version = "2.0.0" +version = "2.0.1" description = "Python wrapper for the snap7 library" readme = "README.rst" authors = [ @@ -22,6 +22,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] license = {text = "MIT License"} requires-python = ">=3.9" @@ -32,7 +33,7 @@ Homepage = "https://github.com/gijzelaerr/python-snap7" Documentation = "https://python-snap7.readthedocs.io/en/latest/" [project.optional-dependencies] -test = ["pytest", "mypy", "types-setuptools", "ruff", "tox", "types-click"] +test = ["pytest", "mypy", "types-setuptools", "ruff", "tox", "types-click", "uv"] cli = ["rich", "click" ] doc = ["sphinx", "sphinx_rtd_theme", "enum-tools[sphinx]"] diff --git a/requirements-dev.txt b/requirements-dev.txt index 5cd80a9b..59dde340 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,11 +1,6 @@ -# -# This file is autogenerated by pip-compile with Python 3.10 -# by the following command: -# -# 'tox -e requirements-dev' -# - -alabaster==1.0.0 +# This file was autogenerated by uv via the following command: +# uv pip compile --extra test --extra cli --extra doc --output-file=requirements-dev.txt pyproject.toml +alabaster==0.7.16 # via sphinx apeye==1.4.1 # via sphinx-toolbox @@ -17,14 +12,12 @@ babel==2.16.0 # via sphinx beautifulsoup4==4.12.3 # via sphinx-toolbox -cachecontrol[filecache]==0.14.0 +cachecontrol==0.14.0 # via sphinx-toolbox cachetools==5.5.0 # via tox certifi==2024.8.30 - # via - # requests - # sphinx-prompt + # via requests chardet==5.2.0 # via tox charset-normalizer==3.4.0 @@ -52,7 +45,7 @@ domdf-python-tools==3.9.0 # apeye-core # dict2css # sphinx-toolbox -enum-tools[sphinx]==0.12.0 +enum-tools==0.12.0 # via python-snap7 (pyproject.toml) exceptiongroup==1.2.2 # via pytest @@ -68,9 +61,10 @@ idna==3.10 # via # apeye-core # requests - # sphinx-prompt imagesize==1.4.1 # via sphinx +importlib-metadata==8.5.0 + # via sphinx iniconfig==2.0.0 # via pytest jinja2==3.1.4 @@ -140,24 +134,24 @@ snowballstemmer==2.2.0 # via sphinx soupsieve==2.6 # via beautifulsoup4 -sphinx==8.1.3 +sphinx==7.4.7 # via + # python-snap7 (pyproject.toml) # autodocsumm # enum-tools - # python-snap7 (pyproject.toml) # sphinx-autodoc-typehints # sphinx-prompt # sphinx-rtd-theme # sphinx-tabs # sphinx-toolbox # sphinxcontrib-jquery -sphinx-autodoc-typehints==2.5.0 +sphinx-autodoc-typehints==2.3.0 # via sphinx-toolbox sphinx-jinja2-compat==0.3.0 # via # enum-tools # sphinx-toolbox -sphinx-prompt==1.9.0 +sphinx-prompt==1.8.0 # via sphinx-toolbox sphinx-rtd-theme==3.0.1 # via python-snap7 (pyproject.toml) @@ -203,10 +197,12 @@ typing-extensions==4.12.2 # sphinx-toolbox # tox urllib3==2.2.3 - # via - # requests - # sphinx-prompt + # via requests +uv==0.4.29 + # via python-snap7 (pyproject.toml) virtualenv==20.27.1 # via tox webencodings==0.5.1 # via html5lib +zipp==3.20.2 + # via importlib-metadata diff --git a/tests/test_client.py b/tests/test_client.py index f9f03111..436a872c 100755 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -18,7 +18,7 @@ pointer, Array, ) -from datetime import datetime, timedelta, date +from datetime import datetime, timedelta, timezone from multiprocessing import Process from unittest import mock from typing import cast as typing_cast @@ -803,8 +803,14 @@ def test_get_pg_block_info(self) -> None: self.assertEqual(10, block_info.BlkType) self.assertEqual(99, block_info.BlkNumber) self.assertEqual(2752512, block_info.SBBLength) - self.assertEqual(bytes((date(2019, 6, 27).strftime("%Y/%m/%d")), encoding="utf-8"), block_info.CodeDate) - self.assertEqual(bytes((date(2019, 6, 27).strftime("%Y/%m/%d")), encoding="utf-8"), block_info.IntfDate) + self.assertEqual( + bytes((datetime(2019, 6, 27, tzinfo=timezone.utc).astimezone().strftime("%Y/%m/%d")), encoding="utf-8"), + block_info.CodeDate, + ) + self.assertEqual( + bytes((datetime(2019, 6, 27, tzinfo=timezone.utc).astimezone().strftime("%Y/%m/%d")), encoding="utf-8"), + block_info.IntfDate, + ) def test_iso_exchange_buffer(self) -> None: # Cli_IsoExchangeBuffer diff --git a/tox.ini b/tox.ini index d24dc630..038776f3 100644 --- a/tox.ini +++ b/tox.ini @@ -7,6 +7,7 @@ envlist = py310 py311 py312 + py313 isolated_build = true [testenv] @@ -38,10 +39,9 @@ commands = ruff check --fix {toxinidir}/snap7 {toxinidir}/tests {toxinidir}/example [testenv:requirements-dev] -basepython = python3.10 +basepython = python3.9 labels = requirements -deps = pip-tools +deps = uv skip_install = true setenv = CUSTOM_COMPILE_COMMAND='tox -e requirements-dev' -commands = - pip-compile --upgrade --resolver backtracking --extra test,cli,doc --allow-unsafe pyproject.toml --output-file requirements-dev.txt +commands = uv pip compile --upgrade --extra test --extra cli --extra doc --output-file=requirements-dev.txt pyproject.toml