-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump python to 3.13 following core 2024.12 #656
Conversation
WalkthroughThe changes in this pull request primarily involve updates to various configuration files to support Python version 3.13. Key modifications include updating the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant GitHub Actions
participant Python Environment
User->>GitHub Actions: Trigger workflow
GitHub Actions->>Python Environment: Set up Python 3.13
Python Environment-->>GitHub Actions: Python 3.13 ready
GitHub Actions->>GitHub Actions: Install dependencies
GitHub Actions->>GitHub Actions: Run tests
GitHub Actions-->>User: Workflow complete
Warning Rate limit exceeded@CoMPaTech has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 8 minutes and 19 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Outside diff range and nitpick comments (2)
scripts/python-venv.sh (1)
Line range hint
4-24
: Consider updating documentation about Python version requirements.Since we're adding support for Python 3.13, it would be helpful to document this change in the project's documentation.
Let's verify if we need to update any documentation:
#!/bin/bash # Description: Check for Python version references in documentation # Look for README files and documentation directories echo "Checking documentation for Python version references..." rg -l "python.*3\.(12|13)" $(fd -t f -e md -e rst).pre-commit-config.yaml (1)
Line range hint
1-5
: Consider temporary CI adjustments for Python 3.13 transitionDuring the Python 3.13 transition period, consider:
- Temporarily increasing the autoupdate frequency from quarterly
- Running all hooks in CI at least once to verify Python 3.13 compatibility
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (6)
.github/workflows/merge.yml
(1 hunks).github/workflows/verify.yml
(3 hunks).pre-commit-config.yaml
(1 hunks)CHANGELOG.md
(1 hunks)pyproject.toml
(6 hunks)scripts/python-venv.sh
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- CHANGELOG.md
🔇 Additional comments (10)
scripts/python-venv.sh (1)
4-4
: LGTM! Verify Python 3.13 compatibility with dependencies.
The addition of Python 3.13 as the primary version while keeping 3.12 as fallback is a good approach. However, since Python 3.13 is relatively new, we should verify compatibility.
Let's check the project's dependencies for Python 3.13 compatibility:
✅ Verification successful
Python 3.13 upgrade is compatible with project configuration
The project's configuration already supports Python 3.13:
pyproject.toml
specifiesrequires-python = ">=3.12.0"
, which includes Python 3.13- Core dependencies (aiohttp, defusedxml, munch, python-dateutil) are mature packages that typically maintain compatibility with new Python versions
- Development dependencies are either version-agnostic or have specific versions that are compatible
- The project follows HA-core versioning for most dependencies, which ensures ecosystem compatibility
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if project dependencies support Python 3.13
# Look for pyproject.toml or requirements.txt to analyze dependencies
# First, check if we have pyproject.toml
if [ -f "pyproject.toml" ]; then
echo "Checking dependencies in pyproject.toml..."
cat pyproject.toml | grep -A 20 "dependencies"
fi
# Then check for requirements.txt
if [ -f "requirements.txt" ]; then
echo "Checking dependencies in requirements.txt..."
cat requirements.txt
fi
Length of output: 636
Script:
#!/bin/bash
# Let's check the specific versions of dependencies to verify Python 3.13 compatibility
# First, let's check if there's any Python version constraints in pyproject.toml
echo "Checking Python version constraints in pyproject.toml..."
rg "python_version|python_requires|requires-python" pyproject.toml -A 2
# Then, let's check for any setup.py that might have version constraints
echo -e "\nChecking for Python version constraints in setup.py..."
if [ -f "setup.py" ]; then
rg "python_requires|requires-python" setup.py -A 2
fi
# Let's also check the specific versions of direct dependencies
echo -e "\nChecking specific versions in requirements files..."
fd "requirements.*\.txt$" -x cat {}
Length of output: 1013
.github/workflows/merge.yml (4)
8-8
: Verify PR title - version number mismatch
The PR title mentions Python 3.123, but the change implements Python 3.13. This appears to be a typo in the PR title.
Consider updating the PR title to correctly reflect Python 3.13.
8-8
: LGTM - Python version update
The update to Python 3.13 looks good, pending the verification checks above. The workflow structure remains unchanged and appropriate for the publishing process.
8-8
: Verify Python 3.13 compatibility with GitHub Actions
Let's verify the compatibility of Python 3.13 with GitHub Actions and the setup-python action.
✅ Verification successful
Let me gather more specific information about Python 3.13 support.
Python 3.13 is compatible and properly configured
The codebase is already well-configured for Python 3.13:
- The project's pyproject.toml explicitly supports Python 3.13 in its classifiers
- Black and Ruff tools are configured for Python 3.13 target
- Mypy is configured for Python 3.13
- The workflow uses actions/setup-python@v5 which is the latest version supporting Python 3.13
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check setup-python action versions and their Python support
# Get the latest release info for setup-python action
echo "Checking setup-python action releases..."
gh api repos/actions/setup-python/releases/latest
# Check workflow runs in the repository using Python 3.13
echo "Checking existing workflow runs with Python 3.13..."
gh run list --workflow=merge.yml --json conclusion,name,headBranch,status | jq '.[] | select(.name=="Latest release")'
Length of output: 6055
Script:
#!/bin/bash
# Check the Python version specification in the workflow file
echo "Checking Python setup in workflow file..."
cat .github/workflows/merge.yml
# Check if there are any Python version constraints in requirements or setup files
echo -e "\nChecking Python version constraints in project files..."
fd -e txt -e toml -e cfg -e ini -e yaml -e yml | xargs grep -l "python" 2>/dev/null | xargs cat 2>/dev/null
Length of output: 13170
Line range hint 27-31
: Verify dependencies compatibility with Python 3.13
The workflow uses setup-python@v5. Let's ensure all dependencies and actions are compatible with Python 3.13.
✅ Verification successful
Python 3.13 compatibility is properly configured
The project is fully configured for Python 3.13 compatibility:
pyproject.toml
explicitly lists Python 3.13 support in classifiers- Project requires Python >=3.12.0 which includes 3.13
- All tools (black, mypy, ruff) are configured for Python 3.13
- No version-specific dependencies that would conflict with Python 3.13
- Workflow files correctly use Python 3.13 as DEFAULT_PYTHON
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for Python version constraints in project dependencies
# Check pyproject.toml for Python version constraints
echo "Checking Python version constraints in pyproject.toml..."
if [ -f "pyproject.toml" ]; then
cat pyproject.toml | grep -A 5 "python_requires"
fi
# Check requirements files for any version-specific dependencies
echo "Checking requirements files for version constraints..."
fd -e txt -e in requirements | xargs cat 2>/dev/null | grep -i "python_version"
Length of output: 386
Script:
#!/bin/bash
# Let's check for any Python-related files and dependencies more thoroughly
# Check for setup.py, setup.cfg, or pyproject.toml
echo "=== Python Project Configuration Files ==="
fd "setup\.py|setup\.cfg|pyproject\.toml"
# Look for requirements files
echo -e "\n=== Requirements Files ==="
fd "requirements"
# Check content of setup.py if it exists
echo -e "\n=== Setup.py Content (if exists) ==="
if [ -f "setup.py" ]; then
cat setup.py
fi
# Check for tox.ini which might have Python version specs
echo -e "\n=== Tox Configuration (if exists) ==="
if [ -f "tox.ini" ]; then
cat tox.ini
fi
# Check GitHub workflow files for Python version references
echo -e "\n=== GitHub Workflow Python Version References ==="
rg "python-version" .github/workflows/
Length of output: 4265
Script:
#!/bin/bash
# Let's check the content of configuration files and requirements for version constraints
# Check pyproject.toml content
echo "=== pyproject.toml Content ==="
cat pyproject.toml
# Check setup.cfg content
echo -e "\n=== setup.cfg Content ==="
cat setup.cfg
# Check requirements files content
echo -e "\n=== requirements_test.txt Content ==="
cat requirements_test.txt
echo -e "\n=== requirements_commit.txt Content ==="
cat requirements_commit.txt
# Check for Python version environment variable
echo -e "\n=== DEFAULT_PYTHON Environment Variable in Workflows ==="
rg "DEFAULT_PYTHON" .github/workflows/
Length of output: 14914
.pre-commit-config.yaml (1)
Line range hint 13-83
: Verify hook configurations for Python 3.13 compatibility
Several hooks might benefit from updates to fully support Python 3.13:
pyupgrade
andpython-typing-update
use--py39-plus
flags- Consider updating hook versions to their latest releases for better Python 3.13 support
Let's check for newer versions of these hooks:
pyproject.toml (3)
51-51
: Verify tool compatibility with Python 3.13
The black and ruff configurations are set to target Python 3.13. Let's ensure these tools support this version.
Run this script to check the latest supported Python versions in the tools' dependencies:
Also applies to: 219-219
✅ Verification successful
Python 3.13 is supported by both black and ruff
Based on the PyPI classifiers, both black and ruff explicitly declare support for Python 3.13 in their latest versions. The target-version configuration in pyproject.toml is valid and compatible.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check tool compatibility with Python 3.13
# Get the latest versions and their Python support
echo "Checking black..."
curl -s https://pypi.org/pypi/black/json | jq -r '.info.classifiers[] | select(contains("Programming Language :: Python"))'
echo "Checking ruff..."
curl -s https://pypi.org/pypi/ruff/json | jq -r '.info.classifiers[] | select(contains("Programming Language :: Python"))'
Length of output: 952
Line range hint 189-209
: Verify MyPy compatibility and type checking settings
The MyPy configuration is set to Python 3.13 with strict type checking enabled. Let's verify:
- MyPy's support for Python 3.13
- Any potential type checking changes needed for Python 3.13 compatibility
Run this script to check MyPy's Python version support:
✅ Verification successful
MyPy configuration is compatible with Python 3.13
The verification confirms that MyPy officially supports Python 3.13 as shown in its PyPI classifiers. The strict type checking settings are standard MyPy configurations that are version-agnostic, and the codebase shows minimal typing usage with no Python 3.13-specific type hints that could cause compatibility issues.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check MyPy compatibility with Python 3.13
echo "Checking MyPy Python version support..."
curl -s https://pypi.org/pypi/mypy/json | jq -r '.info.classifiers[] | select(contains("Programming Language :: Python"))'
# Look for any Python 3.13-specific type hints in the codebase
echo "Checking for Python 3.13-specific type hints..."
rg "typing\." .
Length of output: 692
7-7
:
Version constraints need revision
There are several inconsistencies in the version-related changes:
- The PR title mentions Python 3.123, but the changes show 3.13. Please clarify the intended Python version.
- The
requires-python = ">=3.12.0"
constraint should be updated to reflect the minimum Python version requirement for this release. - Consider if a minor version bump (1.6.0 -> 1.6.1) is sufficient for a major Python version update.
Let's verify the Python version requirements across the project:
Also applies to: 18-18, 28-28
✅ Verification successful
Version constraints are correctly aligned with project changes
Based on the search results, the version-related changes in pyproject.toml
are consistent with the project's direction:
- The CHANGELOG.md clearly shows this is a Python 3.13 update, not 3.123 (the PR title appears to have a typo).
- The
requires-python = ">=3.12.0"
constraint is correct as it maintains compatibility with both Python 3.12 and 3.13, which is confirmed by:- CHANGELOG entries showing support for both versions
- The python-venv.sh script showing both versions (3.12, 3.13) are supported
- The minor version bump (1.6.1) is appropriate as Python version support is being added without breaking changes.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check Python version requirements across the project
# Look for Python version references in workflow files and other configs
rg -g "!pyproject.toml" "3\.1[23]" .
Length of output: 8356
.github/workflows/verify.yml (1)
8-8
: Verify Python 3.13 support in GitHub Actions
The workflow is being updated to use Python 3.13. Please ensure that:
- Python 3.13 is officially supported by GitHub Actions' setup-python action
- All dependencies are compatible with Python 3.13
✅ Verification successful
Python 3.13 update is safe to proceed
Based on the comprehensive analysis of the codebase:
- The project explicitly declares Python 3.13 support in pyproject.toml's classifiers and requires-python fields
- GitHub Actions setup-python@v5 action is used, which supports Python 3.13
- All workflow files consistently use Python 3.13
- The project has proper test coverage (>94%) and type checking with mypy configured for Python 3.13
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for potential compatibility issues with Python 3.13
# Check setup.py and requirements files for version constraints
rg -l "python_requires|requires-python|Python ::|Framework ::"
# Look for version-specific code
rg "sys.version|python_version"
Length of output: 152
Script:
#!/bin/bash
# Check the content of pyproject.toml to understand version requirements
cat pyproject.toml
# Check GitHub Actions workflow files for any other Python version references
rg -l "python-version|python_version" .github/workflows/
Length of output: 10845
Script:
#!/bin/bash
# Check the content of workflow files to see Python version configurations
cat .github/workflows/verify.yml
cat .github/workflows/merge.yml
# Check if there are any other workflow files with Python setup
fd -e yml -e yaml . .github/workflows/
Length of output: 17267
@@ -5,7 +5,7 @@ name: Latest commit | |||
|
|||
env: | |||
CACHE_VERSION: 11 | |||
DEFAULT_PYTHON: "3.12" | |||
DEFAULT_PYTHON: "3.13" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Python version 3.13 is not yet supported by Home Assistant core
The verification shows that Home Assistant core currently requires Python >=3.12.0 in its pyproject.toml, and there's no evidence of an upcoming move to Python 3.13. While there are some compatibility packages prepared for Python 3.13 in the constraints file, the core itself is not yet ready for this version. This change should be reverted to maintain compatibility with Home Assistant core.
.github/workflows/verify.yml
: ChangeDEFAULT_PYTHON: "3.13"
back to a supported version (3.12)- Same change needed at lines 176 and 216
🔗 Analysis chain
Verify compatibility with Home Assistant core
Since this PR is titled "Bump python to 3.123 following core 2024.12", please ensure that:
- This aligns with Home Assistant core's Python version requirements
- All constraints from Home Assistant core are compatible
Also applies to: 176-176, 216-216
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check Home Assistant core compatibility
# Check for Python version requirements in HA core constraints
curl -s https://raw.githubusercontent.com/home-assistant/core/dev/homeassistant/package_constraints.txt | grep -i "python_version"
# Check for any Python version specific dependencies
curl -s https://raw.githubusercontent.com/home-assistant/core/dev/requirements_test.txt | grep -i "python_version"
Length of output: 382
Script:
#!/bin/bash
# Let's check the core repository's Python version requirements more comprehensively
# Check pyproject.toml in core for Python version
curl -s https://raw.githubusercontent.com/home-assistant/core/dev/pyproject.toml | grep -A 5 "python ="
# Check setup.py in core for Python version
curl -s https://raw.githubusercontent.com/home-assistant/core/dev/setup.py | grep -A 5 "python_requires"
# Check if there are any recent commits mentioning Python 3.13
curl -s "https://api.github.com/repos/home-assistant/core/commits?per_page=10" | jq -r '.[] | select(.commit.message | contains("3.13")) | .commit.message'
Length of output: 629
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #656 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 20 20
Lines 3393 3393
=========================================
Hits 3393 3393 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/verify.yml
(3 hunks)
🧰 Additional context used
📓 Learnings (1)
.github/workflows/verify.yml (1)
Learnt from: CoMPaTech
PR: plugwise/python-plugwise#656
File: .github/workflows/verify.yml:176-176
Timestamp: 2024-11-28T19:48:51.051Z
Learning: In this project, we align our supported Python versions with HA-core. When HA-core moves to a new Python version (e.g., Python 3.13), we update our testing matrix accordingly and discontinue testing for the previous version.
🪛 yamllint (1.35.1)
.github/workflows/verify.yml
[error] 176-176: syntax error: expected ',' or ']', but got ''
(syntax)
🔇 Additional comments (2)
.github/workflows/verify.yml (2)
8-8
:
Revert Python version update until HA core supports 3.13
Based on the current Home Assistant core requirements (Python >=3.12.0), this change is premature. We should maintain alignment with HA core's Python version support.
- DEFAULT_PYTHON: "3.13"
+ DEFAULT_PYTHON: "3.12"
Line range hint 201-205
: Verify HA core constraints compatibility
The workflow installs dependencies with HA core constraints. We should verify that all dependencies are compatible with the Python version in use.
✅ Verification successful
Python version compatibility is properly configured
The workflow is correctly configured for HA core compatibility:
- Uses Python 3.12 and 3.13 in test matrix, which covers HA core's requirement of Python >=3.12.0
- Default Python version is set to 3.13, which is forward-compatible with the special dependencies that activate on Python >=3.13
- The workflow uses
uv
for dependency management which respects version constraints
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify compatibility with HA core constraints
# Check HA core's Python version requirements
curl -s https://raw.githubusercontent.com/home-assistant/core/dev/pyproject.toml | grep -A 5 "python ="
# Check if any dependencies have Python version constraints
curl -s https://raw.githubusercontent.com/home-assistant/core/dev/homeassistant/package_constraints.txt | grep -i "python_version"
Length of output: 634
Script:
#!/bin/bash
# Check Python version used in the workflow
grep -A 5 "python-version" .github/workflows/verify.yml
# Check if there's a requirements file that might contain version constraints
fd requirements.txt --exec cat {}
Length of output: 6601
Script:
#!/bin/bash
# Check the DEFAULT_PYTHON env variable value
grep "DEFAULT_PYTHON" .github/workflows/verify.yml
# Check setup.py for Python version requirements
fd setup.py --exec cat {}
Length of output: 1772
.github/workflows/verify.yml
Outdated
@@ -173,7 +173,7 @@ jobs: | |||
needs: commitcheck | |||
strategy: | |||
matrix: | |||
python-version: ["3.12"] | |||
python-version: ["3.13" "3.12"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix syntax error in Python version matrix
There's a syntax error in the matrix definition - missing comma between versions.
- python-version: ["3.13" "3.12"]
+ python-version: ["3.12"]
Note: As per the previous discussion about aligning with HA core, we should maintain only Python 3.12 testing for now.
Also applies to: 216-216
🧰 Tools
🪛 yamllint (1.35.1)
[error] 176-176: syntax error: expected ',' or ']', but got ''
(syntax)
Quality Gate passedIssues Measures |
@@ -1,5 +1,9 @@ | |||
# Changelog | |||
|
|||
## v1.6.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a version-bump? Nothing changes to the actual code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pyproject.toml
changed indicating compatibility with 3.13 - hence 1.60 would only be displayed as compatible with 3.12 - as such bumping the version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah OK :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Chores
pyproject.toml
and updated Python requirements.