diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 10487ada3..1fd63ada2 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -4,8 +4,8 @@ name: Latest release env: - CACHE_VERSION: 10 - DEFAULT_PYTHON: "3.13" + CACHE_VERSION: 11 + DEFAULT_PYTHON: "3.14" # Only run on merges on: diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 77be43a22..09c6bb9f0 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -4,8 +4,8 @@ name: Latest commit env: - CACHE_VERSION: 14 - DEFAULT_PYTHON: "3.13" + CACHE_VERSION: 2 + DEFAULT_PYTHON: "3.14" PRE_COMMIT_HOME: ~/.cache/pre-commit VENV: venv @@ -23,7 +23,7 @@ jobs: name: Cache identify outputs: cache-key: ${{ steps.set-key.outputs.cache-key }} - python-version: ${{ steps.python.outputs.python-version}} # Ensure all runners use THIS minor version + python-version: ${{ steps.python.outputs.python-version }} # Ensure all runners use THIS minor version steps: - name: Check out committed code uses: actions/checkout@v5 @@ -37,7 +37,7 @@ jobs: run: wget -O ha_pyproject.toml "https://raw.githubusercontent.com/home-assistant/core/refs/heads/dev/pyproject.toml" - name: Compute cache key id: set-key - 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" + run: echo "cache-key=${{ runner.os }}-${{ env.CACHE_VERSION }}-${{ hashFiles('pyproject.toml', 'requirements_test.txt', '.pre-commit-config.yaml') }}" >> "$GITHUB_OUTPUT" # Prepare default python version environment prepare: @@ -71,17 +71,17 @@ jobs: uses: plugwise/gh-actions/restore-venv@v1 with: cache-key: ${{ needs.cache.outputs.cache-key }} - python-version: ${{ needs.cache.outputs.python-version}} + python-version: ${{ needs.cache.outputs.python-version }} venv-dir: ${{ env.VENV }} precommit-home: ${{ env.PRE_COMMIT_HOME }} - name: Ruff (with fix) run: | - . venv/bin/activate + . venv-${{ needs.cache.outputs.python-version }}/bin/activate ruff check plugwise/ tests/ - name: If needed, commit ruff changes to the pull request if: failure() run: | - . venv/bin/activate + . venv-${{ needs.cache.outputs.python-version }}/bin/activate ruff format plugwise/ tests/ git config --global user.name 'autoruff' git config --global user.email 'plugwise@users.noreply.github.com' @@ -107,21 +107,21 @@ jobs: uses: plugwise/gh-actions/restore-venv@v1 with: cache-key: ${{ needs.cache.outputs.cache-key }} - python-version: ${{ needs.cache.outputs.python-version}} + python-version: ${{ needs.cache.outputs.python-version }} venv-dir: ${{ env.VENV }} precommit-home: ${{ env.PRE_COMMIT_HOME }} - name: Verify commit run: | - . venv/bin/activate + . venv-${{ needs.cache.outputs.python-version }}/bin/activate pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual pylint - name: Biome lint run: | - . venv/bin/activate + . venv-${{ needs.cache.outputs.python-version }}/bin/activate mkdir -p ./tmp && curl -sL "https://github.com/biomejs/biome/releases/latest/download/biome-linux-x64" -o ./tmp/biome && chmod +x ./tmp/biome pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual biome - name: Lint markdown files run: | - . venv/bin/activate + . venv-${{ needs.cache.outputs.python-version }}/bin/activate pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual markdownlint pytest: @@ -133,7 +133,7 @@ jobs: - commitcheck strategy: matrix: - python-version: ["3.13"] + python-version: ["3.14", "3.13"] steps: - name: Check out committed code uses: actions/checkout@v5 @@ -146,18 +146,19 @@ jobs: id: cache-reuse uses: plugwise/gh-actions/restore-venv@v1 with: + fail-on-miss: false # First time create cache (if not already exists) cache-key: ${{ needs.cache.outputs.cache-key }} - python-version: ${{ steps.python.outputs.python-version }} # Force to installed python minor$ + python-version: ${{ steps.python.outputs.python-version }} # Force to installed python minor venv-dir: ${{ env.VENV }} precommit-home: ${{ env.PRE_COMMIT_HOME }} - name: Run all tests run: | - . venv/bin/activate + . venv-${{ steps.python.outputs.python-version }}/bin/activate pytest --log-level info tests/*.py --cov='.' - name: Upload coverage artifact uses: actions/upload-artifact@v4 with: - name: coverage-${{ matrix.python-version }} + name: coverage-${{ steps.python.outputs.python-version }} path: .coverage if-no-files-found: error include-hidden-files: true @@ -179,12 +180,12 @@ jobs: uses: plugwise/gh-actions/restore-venv@v1 with: cache-key: ${{ needs.cache.outputs.cache-key }} - python-version: ${{ needs.cache.outputs.python-version}} + python-version: ${{ needs.cache.outputs.python-version }} venv-dir: ${{ env.VENV }} precommit-home: ${{ env.PRE_COMMIT_HOME }} - name: Run mypy run: | - . venv/bin/activate + . venv-${{ needs.cache.outputs.python-version }}/bin/activate pip list | grep -i mypy mypy plugwise/ @@ -224,7 +225,7 @@ jobs: uses: plugwise/gh-actions/restore-venv@v1 with: cache-key: ${{ needs.cache.outputs.cache-key }} - python-version: ${{ needs.cache.outputs.python-version}} + python-version: ${{ needs.cache.outputs.python-version }} venv-dir: ${{ env.VENV }} precommit-home: ${{ env.PRE_COMMIT_HOME }} - name: Download all coverage artifacts @@ -235,7 +236,7 @@ jobs: path: ${{ github.workspace }}/artifacts - name: Combine coverage results run: | - . venv/bin/activate + . venv-${{ needs.cache.outputs.python-version }}/bin/activate coverage combine artifacts/.coverage* coverage report --fail-under=94 coverage xml @@ -306,11 +307,11 @@ jobs: uses: plugwise/gh-actions/restore-venv@v1 with: cache-key: ${{ needs.cache.outputs.cache-key }} - python-version: ${{ needs.cache.outputs.python-version}} + python-version: ${{ needs.cache.outputs.python-version }} venv-dir: ${{ env.VENV }} precommit-home: ${{ env.PRE_COMMIT_HOME }} - name: Run complexity report (click to view details) run: | - . venv/bin/activate + . venv-${{ needs.cache.outputs.python-version }}/bin/activate echo "Showing complexity higher or equal to 'C'" radon cc plugwise/ tests/ -s -nc --no-assert diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bfb659f69..c69b82a6b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ default_language_version: # force all unspecified python hooks to run python3 - python: python3.13 + python: default repos: # Run manually in CI skipping the branch checks diff --git a/CHANGELOG.md b/CHANGELOG.md index 61d6b4d81..9501fb947 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Ongoing + +- Test/validate for Python 3.14 + ## v1.7.8 - 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) diff --git a/pyproject.toml b/pyproject.toml index 326fed51f..05c85198d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,7 @@ classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Operating System :: OS Independent", + "Programming Language :: Python :: 3.14", "Programming Language :: Python :: 3.13", "Topic :: Home Automation", ] @@ -56,7 +57,7 @@ include = ["plugwise*"] ## [tool.pylint.MAIN] -py-version = "3.13" +py-version = "3.14" # Use a conservative default here; 2 should speed up most setups and not hurt # any too bad. Override on command line as appropriate. jobs = 2 @@ -391,7 +392,7 @@ max-line-length-suggestions = 72 [tool.mypy] -python_version = "3.13" +python_version = "3.14" show_error_codes = true follow_imports = "silent" ignore_missing_imports = true @@ -421,7 +422,7 @@ omit= [ ] [tool.ruff] -target-version = "py313" +target-version = "py314" lint.select = [ "B002", # Python does not support the unary prefix increment