Skip to content

Commit cdee5c2

Browse files
authored
Test/validate Py314 (#356)
1 parent 8acfcfa commit cdee5c2

File tree

6 files changed

+56
-140
lines changed

6 files changed

+56
-140
lines changed

.github/actions/restore-venv/action.yml

Lines changed: 0 additions & 60 deletions
This file was deleted.

.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: 21
8-
DEFAULT_PYTHON: "3.13"
7+
CACHE_VERSION: 22
8+
DEFAULT_PYTHON: "3.14"
99

1010
# Only run on merges
1111
on:

.github/workflows/verify.yml

Lines changed: 45 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
name: Latest commit
55

66
env:
7-
CACHE_VERSION: 5
8-
DEFAULT_PYTHON: "3.13"
9-
PRE_COMMIT_HOME: ${{ github.workspace }}/.cache/pre-commit
7+
CACHE_VERSION: 1
8+
DEFAULT_PYTHON: "3.14"
9+
PRE_COMMIT_HOME: ~/.cache/pre-commit
1010
VENV: venv
1111

1212
on:
@@ -32,30 +32,26 @@ jobs:
3232
uses: actions/setup-python@v6
3333
with:
3434
python-version: ${{ env.DEFAULT_PYTHON }}
35+
- name: Fetch HA pyproject
36+
id: core-version
37+
run: wget -O ha_pyproject.toml "https://raw.githubusercontent.com/home-assistant/core/refs/heads/dev/pyproject.toml"
3538
- name: Compute cache key
3639
id: set-key
37-
run: echo "cache-key=${{ runner.os }}-venv-cache-${{ env.CACHE_VERSION }}-${{ steps.python.outputs.python-version }}-${{ hashFiles('pyproject.toml', 'requirements_commit.txt', '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"
3841

3942
# Prepare default python version environment
4043
prepare:
4144
runs-on: ubuntu-latest
4245
needs: cache
4346
name: Prepare
4447
steps:
45-
- name: Check out committed code
46-
uses: actions/checkout@v5
47-
- name: Set up Python ${{ needs.cache.outputs.python-version }}
48-
id: python
49-
uses: actions/setup-python@v6
50-
with:
51-
python-version: ${{ needs.cache.outputs.python-version }}
52-
- name: Create or reuse cache
48+
- name: Prepare code checkout and python/pre-commit setup
5349
id: cache-reuse
54-
uses: ./.github/actions/restore-venv
50+
uses: plugwise/gh-actions/prepare-python-and-code@v1
5551
with:
5652
cache-key: ${{ needs.cache.outputs.cache-key }}
57-
fail-on-miss: false # First time create cache (if not already exists)
58-
python-version: ${{ steps.python.outputs.python-version }}
53+
fail-on-miss: false # First time create cache (if not already exists)
54+
python-version: ${{ needs.cache.outputs.python-version }}
5955
venv-dir: ${{ env.VENV }}
6056
precommit-home: ${{ env.PRE_COMMIT_HOME }}
6157

@@ -70,33 +66,28 @@ jobs:
7066
uses: actions/checkout@v5
7167
with:
7268
persist-credentials: false
73-
- name: Set up Python ${{ needs.cache.outputs.python-version }}
74-
id: python
75-
uses: actions/setup-python@v6
76-
with:
77-
python-version: ${{ needs.cache.outputs.python-version }}
78-
- name: Create or reuse cache
69+
- name: Restore cached environment
7970
id: cache-reuse
80-
uses: ./.github/actions/restore-venv
71+
uses: plugwise/gh-actions/restore-venv@v1
8172
with:
8273
cache-key: ${{ needs.cache.outputs.cache-key }}
83-
python-version: ${{ steps.python.outputs.python-version }}
74+
python-version: ${{ needs.cache.outputs.python-version }}
8475
venv-dir: ${{ env.VENV }}
8576
precommit-home: ${{ env.PRE_COMMIT_HOME }}
86-
- name: Ruff (check)
77+
- name: Ruff (with fix)
8778
run: |
88-
. venv/bin/activate
79+
. venv-${{ needs.cache.outputs.python-version }}/bin/activate
8980
ruff check plugwise_usb/ tests/
9081
- name: If needed, commit ruff changes to the pull request
9182
if: failure()
9283
run: |
93-
. venv/bin/activate
84+
. venv-${{ needs.cache.outputs.python-version }}/bin/activate
9485
ruff format plugwise_usb/ tests/
9586
git config --global user.name 'autoruff'
9687
git config --global user.email '[email protected]'
9788
git remote set-url origin https://x-access-token:${{ secrets.PAT_CT_PYPLUSB }}@github.com/$GITHUB_REPOSITORY
9889
git checkout $GITHUB_HEAD_REF
99-
git commit -am "fixup: ${GITHUB_REF##*/} Python code reformatted using Ruff"
90+
git commit -am "fixup: ${GITHUB_REF##*/} Python code fixed using Ruff"
10091
git push origin ${GITHUB_REF##*/}
10192
10293
commitcheck:
@@ -111,31 +102,26 @@ jobs:
111102
steps:
112103
- name: Check out committed code
113104
uses: actions/checkout@v5
114-
- name: Set up Python ${{ needs.cache.outputs.python-version }}
115-
id: python
116-
uses: actions/setup-python@v6
117-
with:
118-
python-version: ${{ needs.cache.outputs.python-version }}
119-
- name: Create or reuse cache
105+
- name: Restore cached environment
120106
id: cache-reuse
121-
uses: ./.github/actions/restore-venv
107+
uses: plugwise/gh-actions/restore-venv@v1
122108
with:
123109
cache-key: ${{ needs.cache.outputs.cache-key }}
124-
python-version: ${{ steps.python.outputs.python-version }}
110+
python-version: ${{ needs.cache.outputs.python-version }}
125111
venv-dir: ${{ env.VENV }}
126112
precommit-home: ${{ env.PRE_COMMIT_HOME }}
127113
- name: Verify commit
128114
run: |
129-
. venv/bin/activate
115+
. venv-${{ needs.cache.outputs.python-version }}/bin/activate
130116
pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual pylint
131117
# - name: Biome lint
132118
# run: |
133-
# . venv/bin/activate
134-
# mkdir -p ./tmp && curl -sL "https://github.com/biomejs/biome/releases/download/%40biomejs%2Fbiome%402.0.0/biome-linux-x64" -o ./tmp/biome && chmod +x ./tmp/biome
119+
# . venv-${{ needs.cache.outputs.python-version }}/bin/activate
120+
# mkdir -p ./tmp && curl -sL "https://github.com/biomejs/biome/releases/latest/download/biome-linux-x64" -o ./tmp/biome && chmod +x ./tmp/biome
135121
# pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual biome
136122
- name: Lint markdown files
137123
run: |
138-
. venv/bin/activate
124+
. venv-${{ needs.cache.outputs.python-version }}/bin/activate
139125
pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual markdownlint
140126
141127
pytest:
@@ -147,7 +133,7 @@ jobs:
147133
- commitcheck
148134
strategy:
149135
matrix:
150-
python-version: ["3.13"]
136+
python-version: ["3.14", "3.13"]
151137
steps:
152138
- name: Check out committed code
153139
uses: actions/checkout@v5
@@ -156,18 +142,18 @@ jobs:
156142
uses: actions/setup-python@v6
157143
with:
158144
python-version: ${{ matrix.python-version }}
159-
- name: Create or reuse cache
145+
- name: Restore cached environment
160146
id: cache-reuse
161-
uses: ./.github/actions/restore-venv
147+
uses: plugwise/gh-actions/restore-venv@v1
162148
with:
163-
cache-key: ${{ needs.cache.outputs.cache-key }}-pytest-matrix-${{ matrix.python-version }}
164-
fail-on-miss: false # First time create cache (if not already exists)
149+
fail-on-miss: false # First time create cache (if not already exists)
150+
cache-key: ${{ needs.cache.outputs.cache-key }}
165151
python-version: ${{ steps.python.outputs.python-version }} # Force to installed python minor
166152
venv-dir: ${{ env.VENV }}
167153
precommit-home: ${{ env.PRE_COMMIT_HOME }}
168154
- name: Run all tests
169155
run: |
170-
. venv/bin/activate
156+
. venv-${{ steps.python.outputs.python-version }}/bin/activate
171157
pytest --log-level info tests/*.py --cov='.'
172158
- name: Upload coverage artifact
173159
uses: actions/upload-artifact@v4
@@ -190,23 +176,18 @@ jobs:
190176
uses: actions/checkout@v5
191177
with:
192178
persist-credentials: false
193-
- name: Set up Python ${{ needs.cache.outputs.python-version }}
194-
id: python
195-
uses: actions/setup-python@v6
196-
with:
197-
python-version: ${{ needs.cache.outputs.python-version }}
198-
- name: Create or reuse cache
179+
- name: Restore cached environment
199180
id: cache-reuse
200-
uses: ./.github/actions/restore-venv
181+
uses: plugwise/gh-actions/restore-venv@v1
201182
with:
202183
cache-key: ${{ needs.cache.outputs.cache-key }}
203-
python-version: ${{ steps.python.outputs.python-version }}
184+
python-version: ${{ needs.cache.outputs.python-version }}
204185
venv-dir: ${{ env.VENV }}
205186
precommit-home: ${{ env.PRE_COMMIT_HOME }}
206187
- name: Run mypy
207188
run: |
208-
. venv/bin/activate
209-
uv pip list | grep -i mypy
189+
. venv-${{ needs.cache.outputs.python-version }}/bin/activate
190+
pip list | grep -i mypy
210191
mypy plugwise_usb/
211192
212193
# Check shellscripts
@@ -240,17 +221,12 @@ jobs:
240221
steps:
241222
- name: Check out committed code
242223
uses: actions/checkout@v5
243-
- name: Set up Python ${{ needs.cache.outputs.python-version }}
244-
id: python
245-
uses: actions/setup-python@v6
246-
with:
247-
python-version: ${{ needs.cache.outputs.python-version }}
248-
- name: Create or reuse cache
224+
- name: Restore cached environment
249225
id: cache-reuse
250-
uses: ./.github/actions/restore-venv
226+
uses: plugwise/gh-actions/restore-venv@v1
251227
with:
252228
cache-key: ${{ needs.cache.outputs.cache-key }}
253-
python-version: ${{ steps.python.outputs.python-version }}
229+
python-version: ${{ needs.cache.outputs.python-version }}
254230
venv-dir: ${{ env.VENV }}
255231
precommit-home: ${{ env.PRE_COMMIT_HOME }}
256232
- name: Download all coverage artifacts
@@ -261,7 +237,7 @@ jobs:
261237
path: ${{ github.workspace }}/artifacts
262238
- name: Combine coverage results
263239
run: |
264-
. venv/bin/activate
240+
. venv-${{ needs.cache.outputs.python-version }}/bin/activate
265241
coverage combine artifacts/.coverage*
266242
#coverage report --fail-under=80 ## plugwise is at 94, set to 80 for plugwise_usb
267243
echo "***"
@@ -333,21 +309,16 @@ jobs:
333309
steps:
334310
- name: Check out committed code
335311
uses: actions/checkout@v5
336-
- name: Set up Python ${{ needs.cache.outputs.python-version }}
337-
id: python
338-
uses: actions/setup-python@v6
339-
with:
340-
python-version: ${{ needs.cache.outputs.python-version }}
341-
- name: Create or reuse cache
312+
- name: Restore cached environment
342313
id: cache-reuse
343-
uses: ./.github/actions/restore-venv
314+
uses: plugwise/gh-actions/restore-venv@v1
344315
with:
345316
cache-key: ${{ needs.cache.outputs.cache-key }}
346-
python-version: ${{ steps.python.outputs.python-version }}
317+
python-version: ${{ needs.cache.outputs.python-version }}
347318
venv-dir: ${{ env.VENV }}
348319
precommit-home: ${{ env.PRE_COMMIT_HOME }}
349320
- name: Run complexity report (click to view details)
350321
run: |
351-
. venv/bin/activate
322+
. venv-${{ needs.cache.outputs.python-version }}/bin/activate
352323
echo "Showing complexity higher or equal to 'C'"
353-
radon cc plugwise/ tests/ -s -nc --no-assert
324+
radon cc plugwise_usb/ 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
## v0.47.1 - 2025-09-27
48

59
- PR [351](https://github.com/plugwise/python-plugwise-usb/pull/351): Avoid unintentional overwrite of nodetype.cache file at start/reload.

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ classifiers = [
1111
"Development Status :: 5 - Production/Stable",
1212
"Intended Audience :: Developers",
1313
"Operating System :: OS Independent",
14+
"Programming Language :: Python :: 3.14",
1415
"Programming Language :: Python :: 3.13",
1516
"Topic :: Home Automation",
1617
]
@@ -56,7 +57,7 @@ include = ["plugwise_usb*"]
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
@@ -389,7 +390,7 @@ max-line-length-suggestions = 72
389390

390391

391392
[tool.mypy]
392-
python_version = "3.13"
393+
python_version = "3.14"
393394
show_error_codes = true
394395
follow_imports = "silent"
395396
ignore_missing_imports = true
@@ -419,7 +420,7 @@ omit= [
419420
]
420421

421422
[tool.ruff]
422-
target-version = "py313"
423+
target-version = "py314"
423424

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

0 commit comments

Comments
 (0)