Skip to content

Commit d20c3f3

Browse files
authored
Validate py314 compatibility (#793)
1 parent 12da803 commit d20c3f3

File tree

5 files changed

+33
-27
lines changed

5 files changed

+33
-27
lines changed

.github/workflows/merge.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
name: Latest release
55

66
env:
7-
CACHE_VERSION: 10
8-
DEFAULT_PYTHON: "3.13"
7+
CACHE_VERSION: 11
8+
DEFAULT_PYTHON: "3.14"
99

1010
# Only run on merges
1111
on:

.github/workflows/verify.yml

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
name: Latest commit
55

66
env:
7-
CACHE_VERSION: 14
8-
DEFAULT_PYTHON: "3.13"
7+
CACHE_VERSION: 2
8+
DEFAULT_PYTHON: "3.14"
99
PRE_COMMIT_HOME: ~/.cache/pre-commit
1010
VENV: venv
1111

@@ -23,7 +23,7 @@ jobs:
2323
name: Cache identify
2424
outputs:
2525
cache-key: ${{ steps.set-key.outputs.cache-key }}
26-
python-version: ${{ steps.python.outputs.python-version}} # Ensure all runners use THIS minor version
26+
python-version: ${{ steps.python.outputs.python-version }} # Ensure all runners use THIS minor version
2727
steps:
2828
- name: Check out committed code
2929
uses: actions/checkout@v5
@@ -37,7 +37,7 @@ jobs:
3737
run: wget -O ha_pyproject.toml "https://raw.githubusercontent.com/home-assistant/core/refs/heads/dev/pyproject.toml"
3838
- name: Compute cache key
3939
id: set-key
40-
run: echo "cache-key=${{ runner.os }}-venv-cache-${{ env.CACHE_VERSION }}-${{ steps.python.outputs.python-version }}-${{ hashFiles('pyproject.toml', 'requirements_test.txt', '.pre-commit-config.yaml') }}" >> "$GITHUB_OUTPUT"
40+
run: echo "cache-key=${{ runner.os }}-${{ env.CACHE_VERSION }}-${{ hashFiles('pyproject.toml', 'requirements_test.txt', '.pre-commit-config.yaml') }}" >> "$GITHUB_OUTPUT"
4141

4242
# Prepare default python version environment
4343
prepare:
@@ -71,17 +71,17 @@ jobs:
7171
uses: plugwise/gh-actions/restore-venv@v1
7272
with:
7373
cache-key: ${{ needs.cache.outputs.cache-key }}
74-
python-version: ${{ needs.cache.outputs.python-version}}
74+
python-version: ${{ needs.cache.outputs.python-version }}
7575
venv-dir: ${{ env.VENV }}
7676
precommit-home: ${{ env.PRE_COMMIT_HOME }}
7777
- name: Ruff (with fix)
7878
run: |
79-
. venv/bin/activate
79+
. venv-${{ needs.cache.outputs.python-version }}/bin/activate
8080
ruff check plugwise/ tests/
8181
- name: If needed, commit ruff changes to the pull request
8282
if: failure()
8383
run: |
84-
. venv/bin/activate
84+
. venv-${{ needs.cache.outputs.python-version }}/bin/activate
8585
ruff format plugwise/ tests/
8686
git config --global user.name 'autoruff'
8787
git config --global user.email '[email protected]'
@@ -107,21 +107,21 @@ jobs:
107107
uses: plugwise/gh-actions/restore-venv@v1
108108
with:
109109
cache-key: ${{ needs.cache.outputs.cache-key }}
110-
python-version: ${{ needs.cache.outputs.python-version}}
110+
python-version: ${{ needs.cache.outputs.python-version }}
111111
venv-dir: ${{ env.VENV }}
112112
precommit-home: ${{ env.PRE_COMMIT_HOME }}
113113
- name: Verify commit
114114
run: |
115-
. venv/bin/activate
115+
. venv-${{ needs.cache.outputs.python-version }}/bin/activate
116116
pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual pylint
117117
- name: Biome lint
118118
run: |
119-
. venv/bin/activate
119+
. venv-${{ needs.cache.outputs.python-version }}/bin/activate
120120
mkdir -p ./tmp && curl -sL "https://github.com/biomejs/biome/releases/latest/download/biome-linux-x64" -o ./tmp/biome && chmod +x ./tmp/biome
121121
pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual biome
122122
- name: Lint markdown files
123123
run: |
124-
. venv/bin/activate
124+
. venv-${{ needs.cache.outputs.python-version }}/bin/activate
125125
pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual markdownlint
126126
127127
pytest:
@@ -133,7 +133,7 @@ jobs:
133133
- commitcheck
134134
strategy:
135135
matrix:
136-
python-version: ["3.13"]
136+
python-version: ["3.14", "3.13"]
137137
steps:
138138
- name: Check out committed code
139139
uses: actions/checkout@v5
@@ -146,18 +146,19 @@ jobs:
146146
id: cache-reuse
147147
uses: plugwise/gh-actions/restore-venv@v1
148148
with:
149+
fail-on-miss: false # First time create cache (if not already exists)
149150
cache-key: ${{ needs.cache.outputs.cache-key }}
150-
python-version: ${{ steps.python.outputs.python-version }} # Force to installed python minor$
151+
python-version: ${{ steps.python.outputs.python-version }} # Force to installed python minor
151152
venv-dir: ${{ env.VENV }}
152153
precommit-home: ${{ env.PRE_COMMIT_HOME }}
153154
- name: Run all tests
154155
run: |
155-
. venv/bin/activate
156+
. venv-${{ steps.python.outputs.python-version }}/bin/activate
156157
pytest --log-level info tests/*.py --cov='.'
157158
- name: Upload coverage artifact
158159
uses: actions/upload-artifact@v4
159160
with:
160-
name: coverage-${{ matrix.python-version }}
161+
name: coverage-${{ steps.python.outputs.python-version }}
161162
path: .coverage
162163
if-no-files-found: error
163164
include-hidden-files: true
@@ -179,12 +180,12 @@ jobs:
179180
uses: plugwise/gh-actions/restore-venv@v1
180181
with:
181182
cache-key: ${{ needs.cache.outputs.cache-key }}
182-
python-version: ${{ needs.cache.outputs.python-version}}
183+
python-version: ${{ needs.cache.outputs.python-version }}
183184
venv-dir: ${{ env.VENV }}
184185
precommit-home: ${{ env.PRE_COMMIT_HOME }}
185186
- name: Run mypy
186187
run: |
187-
. venv/bin/activate
188+
. venv-${{ needs.cache.outputs.python-version }}/bin/activate
188189
pip list | grep -i mypy
189190
mypy plugwise/
190191
@@ -224,7 +225,7 @@ jobs:
224225
uses: plugwise/gh-actions/restore-venv@v1
225226
with:
226227
cache-key: ${{ needs.cache.outputs.cache-key }}
227-
python-version: ${{ needs.cache.outputs.python-version}}
228+
python-version: ${{ needs.cache.outputs.python-version }}
228229
venv-dir: ${{ env.VENV }}
229230
precommit-home: ${{ env.PRE_COMMIT_HOME }}
230231
- name: Download all coverage artifacts
@@ -235,7 +236,7 @@ jobs:
235236
path: ${{ github.workspace }}/artifacts
236237
- name: Combine coverage results
237238
run: |
238-
. venv/bin/activate
239+
. venv-${{ needs.cache.outputs.python-version }}/bin/activate
239240
coverage combine artifacts/.coverage*
240241
coverage report --fail-under=94
241242
coverage xml
@@ -306,11 +307,11 @@ jobs:
306307
uses: plugwise/gh-actions/restore-venv@v1
307308
with:
308309
cache-key: ${{ needs.cache.outputs.cache-key }}
309-
python-version: ${{ needs.cache.outputs.python-version}}
310+
python-version: ${{ needs.cache.outputs.python-version }}
310311
venv-dir: ${{ env.VENV }}
311312
precommit-home: ${{ env.PRE_COMMIT_HOME }}
312313
- name: Run complexity report (click to view details)
313314
run: |
314-
. venv/bin/activate
315+
. venv-${{ needs.cache.outputs.python-version }}/bin/activate
315316
echo "Showing complexity higher or equal to 'C'"
316317
radon cc plugwise/ tests/ -s -nc --no-assert

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
default_language_version:
22
# force all unspecified python hooks to run python3
3-
python: python3.13
3+
python: default
44

55
repos:
66
# Run manually in CI skipping the branch checks

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## Ongoing
4+
5+
- Test/validate for Python 3.14
6+
37
## v1.7.8
48

59
- Implement fixes related to the select-platform-data provided to the HA Core integrations, part of solving pw-beta issue [#897](https://github.com/plugwise/plugwise-beta/issues/897)

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ classifiers = [
1313
"Development Status :: 5 - Production/Stable",
1414
"Intended Audience :: Developers",
1515
"Operating System :: OS Independent",
16+
"Programming Language :: Python :: 3.14",
1617
"Programming Language :: Python :: 3.13",
1718
"Topic :: Home Automation",
1819
]
@@ -56,7 +57,7 @@ include = ["plugwise*"]
5657
##
5758

5859
[tool.pylint.MAIN]
59-
py-version = "3.13"
60+
py-version = "3.14"
6061
# Use a conservative default here; 2 should speed up most setups and not hurt
6162
# any too bad. Override on command line as appropriate.
6263
jobs = 2
@@ -391,7 +392,7 @@ max-line-length-suggestions = 72
391392

392393

393394
[tool.mypy]
394-
python_version = "3.13"
395+
python_version = "3.14"
395396
show_error_codes = true
396397
follow_imports = "silent"
397398
ignore_missing_imports = true
@@ -421,7 +422,7 @@ omit= [
421422
]
422423

423424
[tool.ruff]
424-
target-version = "py313"
425+
target-version = "py314"
425426

426427
lint.select = [
427428
"B002", # Python does not support the unary prefix increment

0 commit comments

Comments
 (0)