From d8d2afaf81f8cbdd20ba81252fbd0a0e39c8f458 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Wed, 9 Oct 2024 14:42:18 +0200 Subject: [PATCH 1/3] Support Python 3.13 --- .github/workflows/coverage.yml | 2 +- .github/workflows/dev_test.yml | 2 +- .github/workflows/formatting.yml | 2 +- .github/workflows/packaging_test.yml | 2 +- .github/workflows/python-publish.yml | 2 +- .github/workflows/pythonlint.yml | 2 +- .github/workflows/unittests.yml | 2 +- pyproject.toml | 3 ++- 8 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index b7e0c94..a2f1643 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -9,7 +9,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ["3.12"] + python-version: ["3.12", "3.13"] os: [ubuntu-latest] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/dev_test.yml b/.github/workflows/dev_test.yml index 462d93e..bd65816 100644 --- a/.github/workflows/dev_test.yml +++ b/.github/workflows/dev_test.yml @@ -11,7 +11,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ["3.11", "3.12"] + python-version: ["3.11", "3.12", "3.13"] os: [ubuntu-latest] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml index c977d7b..e4b2af8 100644 --- a/.github/workflows/formatting.yml +++ b/.github/workflows/formatting.yml @@ -9,7 +9,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ["3.12"] + python-version: ["3.13"] os: [ubuntu-latest] tool: ["black", "isort"] steps: diff --git a/.github/workflows/packaging_test.yml b/.github/workflows/packaging_test.yml index e41f1ff..cec8693 100644 --- a/.github/workflows/packaging_test.yml +++ b/.github/workflows/packaging_test.yml @@ -9,7 +9,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ["3.12"] + python-version: ["3.13"] os: [ubuntu-latest] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 1638f94..8359543 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -17,7 +17,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: [ "3.12" ] + python-version: [ "3.13" ] os: [ ubuntu-latest ] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/pythonlint.yml b/.github/workflows/pythonlint.yml index d69821b..c93694d 100644 --- a/.github/workflows/pythonlint.yml +++ b/.github/workflows/pythonlint.yml @@ -10,7 +10,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ["3.12"] + python-version: ["3.13"] os: [ubuntu-latest] linter-env: ["linting", "type_check", "spell_check"] steps: diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 3edd536..f1c3197 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -9,7 +9,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ["3.11", "3.12"] + python-version: ["3.11", "3.12", "3.13"] os: [ubuntu-latest] steps: - uses: actions/checkout@v4 diff --git a/pyproject.toml b/pyproject.toml index 015388c..138a219 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,6 +15,7 @@ classifiers = [ "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] dependencies = [ "pydantic>=2.0.0", @@ -62,7 +63,7 @@ Homepage = "https://github.com/Hochfrequenz/tmdsclient.py" [tool.black] line-length = 120 -target_version = ["py311", "py312"] +target_version = ["py311", "py312", "py313"] [tool.isort] line_length = 120 From 9b626f3b272b64753fdc2c08f3b9b618fbb25b7b Mon Sep 17 00:00:00 2001 From: Konstantin Date: Mon, 13 Jan 2025 14:13:06 +0100 Subject: [PATCH 2/3] coverage 3.13 only --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index a2f1643..1a887e5 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -9,7 +9,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ["3.12", "3.13"] + python-version: ["3.13"] os: [ubuntu-latest] steps: - uses: actions/checkout@v4 From 17860aa67bea05ebb41be59c8737731cc5b7f264 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Mon, 13 Jan 2025 14:15:09 +0100 Subject: [PATCH 3/3] ignore mypy for now Run tox -e type_check type_check: install_deps> python -I -m pip install './.[type_check]' '.[tests]' -r requirements.txt type_check: freeze> python -m pip freeze --all type_check: aioauth-client==0.29.0,aiodns==3.2.0,aiohappyeyeballs==2.4.4,aiohttp==3.11.11,aioresponses==0.7.7,aiosignal==1.3.2,annotated-types==0.7.0,anyio==4.8.0,attrs==24.3.0,bo4e==202401.2.1,Brotli==1.1.0,certifi==2024.12.14,cffi==1.17.1,frozenlist==1.5.0,h11==0.14.0,httpcore==1.0.7,httpx==0.28.1,idna==3.10,iniconfig==2.0.0,iso3166==2.1.1,jsonpatch==1.33,jsonpointer==3.0.0,more-itertools==10.5.0,multidict==6.1.0,mypy==1.14.1,mypy-extensions==1.0.0,packaging==24.2,pip==24.3.1,pluggy==1.5.0,propcache==0.2.1,pycares==4.5.0,pycparser==2.22,pydantic==2.10.5,pydantic_core==2.27.2,pyhumps==3.8.0,PyJWT==2.10.1,pytest==8.3.4,pytest-asyncio==0.25.2,sniffio==1.3.1,tmdsclient @ file:///home/runner/work/tmdsclient.py/tmdsclient.py,types-pytz==2024.2.0.20241221,typing_extensions==4.12.2,yarl==1.18.3 type_check: commands[0]> mypy --show-error-codes src/tmdsclient --strict src/tmdsclient/models/marktlokation.py:37: error: Signature of "__replace__" incompatible with supertype "Marktlokation" [override] src/tmdsclient/models/marktlokation.py:37: note: Superclass: src/tmdsclient/models/marktlokation.py:37: note: def __replace__(*, version: str | None = ..., typ: Typ | None = ..., zusatz_attribute: list[ZusatzAttribut] | None = ..., id: str | None = ..., marktlokations_id: str | None = ..., sparte: Sparte | None = ..., energierichtung: Energierichtung | None = ..., bilanzierungsmethode: Bilanzierungsmethode | None = ..., netzebene: Netzebene | None = ..., verbrauchsart: Verbrauchsart | None = ..., ist_unterbrechbar: bool | None = ..., netzbetreibercodenr: str | None = ..., gebietstyp: Gebiettyp | None = ..., netzgebietsnr: str | None = ..., bilanzierungsgebiet: str | None = ..., grundversorgercodenr: str | None = ..., gasqualitaet: Gasqualitaet | None = ..., endkunde: Geschaeftspartner | None = ..., zugehoerige_messlokation: Messlokationszuordnung | None = ..., lokationsadresse: Adresse | None = ..., geoadresse: Geokoordinaten | None = ..., katasterinformation: Katasteradresse | None = ..., kundengruppen: list[Kundentyp] | None = ..., regelzone: str | None = ..., marktgebiet: str | None = ..., zaehlwerke: list[Zaehlwerk] | None = ..., verbrauchsmengen: list[Verbrauch] | None = ..., zaehlwerke_der_beteiligten_marktrolle: list[Zaehlwerk] | None = ...) -> Marktlokation src/tmdsclient/models/marktlokation.py:37: note: Subclass: src/tmdsclient/models/marktlokation.py:37: note: def __replace__(*, version: str | None = ..., typ: Typ | None = ..., zusatz_attribute: list[ZusatzAttribut] | None = ..., id: str | None = ..., marktlokations_id: str | None = ..., sparte: Sparte | None = ..., energierichtung: Energierichtung | None = ..., bilanzierungsmethode: Bilanzierungsmethode | None = ..., netzebene: Netzebene | None = ..., verbrauchsart: Verbrauchsart | None = ..., ist_unterbrechbar: bool | None = ..., netzbetreibercodenr: str | None = ..., gebietstyp: Gebiettyp | None = ..., netzgebietsnr: str | None = ..., bilanzierungsgebiet: str | None = ..., grundversorgercodenr: str | None = ..., gasqualitaet: Gasqualitaet | None = ..., endkunde: Geschaeftspartner | None = ..., zugehoerige_messlokation: Messlokationszuordnung | None = ..., lokationsadresse: Adresse | None = ..., geoadresse: Geokoordinaten | None = ..., katasterinformation: Katasteradresse | None = ..., kundengruppen: list[Kundentyp] | None = ..., regelzone: str | None = ..., marktgebiet: str | None = ..., zaehlwerke: list[Zaehlwerk] | None = ..., verbrauchsmengen: list[Verbrauch] | None = ..., zaehlwerke_der_beteiligten_marktrolle: list[Zaehlwerk] | None = ..., netznutzungsabrechnungsdaten: list[_Netznutzungsabrechnungsdaten] | None = ...) -> Bo4eMarktlokationWithNetznutzungsabrechnungsdaten src/tmdsclient/models/messlokation.py:23: error: Argument 5 of "__replace__" is incompatible with supertype "Messlokation"; supertype defines the argument type as "str | None" [override] src/tmdsclient/models/messlokation.py:23: note: This violates the Liskov substitution principle src/tmdsclient/models/messlokation.py:23: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides Found 2 errors in 2 files (checked 22 source files) type_check: exit 1 (7.87 seconds) /home/runner/work/tmdsclient.py/tmdsclient.py> mypy --show-error-codes src/tmdsclient --strict pid=2014 type_check: FAIL code 1 (19.54=setup[11.67]+cmd[7.87] seconds) evaluation failed :( (19.61 seconds) --- src/tmdsclient/models/marktlokation.py | 2 +- src/tmdsclient/models/messlokation.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tmdsclient/models/marktlokation.py b/src/tmdsclient/models/marktlokation.py index fd255c3..43c49e4 100644 --- a/src/tmdsclient/models/marktlokation.py +++ b/src/tmdsclient/models/marktlokation.py @@ -34,7 +34,7 @@ class Bilanzierungsmethode(StrEnum): IMS = "IMS" # see https://github.com/bo4e/BO4E-python/pull/921 -class Bo4eMarktlokationWithNetznutzungsabrechnungsdaten(Bo4eMarktlokation): +class Bo4eMarktlokationWithNetznutzungsabrechnungsdaten(Bo4eMarktlokation): # type:ignore[override] """ similar to the bo4e marktlokation but with a list of Netznutzungsabrechnungsdaten """ diff --git a/src/tmdsclient/models/messlokation.py b/src/tmdsclient/models/messlokation.py index 0e85143..de64f47 100644 --- a/src/tmdsclient/models/messlokation.py +++ b/src/tmdsclient/models/messlokation.py @@ -20,7 +20,7 @@ # pylint:disable=missing-function-docstring -class Bo4eMeLoWithoutIdValidation(Bo4eMesslokation): +class Bo4eMeLoWithoutIdValidation(Bo4eMesslokation): # type:ignore[override] """ Similar to bo4e messlokation but with no regex validation on the messlokations_id. The reason is that the IS-U water melo IDs do not match the regex. 🙄