-
Notifications
You must be signed in to change notification settings - Fork 7
Python 3.13 #781
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
Python 3.13 #781
Conversation
WalkthroughThe pull request includes updates to various configuration files and scripts to change the Python version from 3.12 to 3.13. This modification affects GitHub Actions workflows, type checking configurations, and project metadata. Additionally, the changelog reflects support for Python 3.13 and introduces new features and breaking changes related to climate entities. The Changes
Possibly related PRs
Suggested labels
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 (4)
.github/workflows/test.yml (1)
Line range hint
1-64: Consider adding Python version matrix testingThe workflow currently tests only with Python 3.13. To ensure broader compatibility, consider adding a matrix strategy to test against multiple Python versions (e.g., 3.11, 3.12, and 3.13).
Here's a suggested modification:
jobs: ha-core-prepare: runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.11", "3.12", "3.13"] name: Setup for HA-core (release) steps: - name: Check out committed code uses: actions/checkout@v4.2.2 - - name: Set up Python ${{ env.DEFAULT_PYTHON }} + - name: Set up Python ${{ matrix.python-version }} id: python uses: actions/setup-python@v5 with: - python-version: ${{ env.DEFAULT_PYTHON }} + python-version: ${{ matrix.python-version }}.github/workflows/core_next.yml (1)
6-6: Consider updating the cache versionThe
CACHE_VERSIONshould be incremented when making significant changes like updating the Python version to ensure a clean cache.- CACHE_VERSION: 1009 + CACHE_VERSION: 1010 # Incremented for Python 3.13 upgradeCHANGELOG.md (2)
Line range hint
1-8: Version number discrepancy detected.The PR objectives mention version 55 but the changelog shows ongoing changes under version 51.6. Please clarify the version numbering and ensure it aligns with semantic versioning practices.
8-8: Consider expanding the changelog entry.The current entry is minimal compared to previous entries. Consider adding:
- Specific changes required for Python 3.13 support
- Any dependency updates
- Impact on existing functionality
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (7)
.github/workflows/core_next.yml(1 hunks).github/workflows/test.yml(1 hunks)CHANGELOG.md(1 hunks)hacs.json(1 hunks)mypy.ini(1 hunks)pyproject.toml(3 hunks)scripts/python-venv.sh(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- hacs.json
- mypy.ini
🔇 Additional comments (7)
scripts/python-venv.sh (1)
4-4:
Caution: Python 3.13 is currently in alpha
Python 3.13 is currently in alpha stage and not recommended for production use. This could lead to compatibility issues and unexpected behavior.
Consider:
- Waiting for the stable release of Python 3.13
- Adding appropriate warnings in documentation
- Ensuring all dependencies support Python 3.13
Let's verify the Python version compatibility with your dependencies:
.github/workflows/test.yml (2)
6-7: Verify cache version bump requirements
The cache version (27) remains unchanged. This is correct if the cache structure hasn't changed, but let's verify if any Python 3.13-specific dependencies would require a cache version bump.
✅ Verification successful
Cache version bump not required
Based on the inspection of pyproject.toml, while there is a Python 3.13 requirement, there are no structural changes to the dependencies that would necessitate a cache invalidation. The project only has two direct dependencies (homeassistant and plugwise), and there's no evidence of changes in dependency specifications that would require a cache version bump.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for any dependency changes that might require cache invalidation
rg -A 5 "dependencies|requires" pyproject.toml
Length of output: 483
Script:
#!/bin/bash
# Check the git history for recent changes in dependency specifications
git diff -U0 HEAD~5..HEAD pyproject.toml
# Look for any changes in requirements files
fd requirements.txt --exec cat {}
Length of output: 273
8-8:
Caution: Python 3.13 is currently in alpha stage
Using Python 3.13 in CI might lead to stability issues as it's currently in alpha. Consider:
- Keeping 3.12 as the default while testing 3.13 in parallel
- Waiting for at least the beta release before making it the default
Let's verify Home Assistant's Python version compatibility:
.github/workflows/core_next.yml (1)
9-9: Caution: Python 3.13 is currently in alpha stage
Testing against Python 3.13 alpha in CI workflows might lead to unstable builds due to:
- Potential bugs in the Python implementation
- Incompatible dependencies that haven't been updated for 3.13
- Breaking changes that might be introduced before the final release
Consider:
- Adding a comment explaining the early adoption rationale
- Running parallel workflows with both 3.12 and 3.13 during the transition period
Let's check the Python version compatibility in the project dependencies:
✅ Verification successful
Let me gather more information about the Python version usage in the codebase and Home Assistant's compatibility:
Based on the gathered information, I can now provide the final response:
Python 3.13 upgrade is intentional and aligned with HA Core
The Python 3.13 upgrade in the workflow is appropriate because:
- The CHANGELOG indicates explicit support for "python 3.13 / HA-Core 2024.12"
- The project's
pyproject.tomlalready specifies Python 3.13 as the target version - This is in the
core_next.ymlworkflow specifically designed for testing against HA-core development branch
The early adoption is intentional and well-documented, making the original concern about alpha status less critical. The workflow serves its purpose of validating compatibility with upcoming HA Core releases.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check Python version requirements in project dependencies
# Look for Python version specifications in key project files
echo "Checking Python version specifications in project files..."
rg -l "python.*3\.1[23]"
echo -e "\nChecking pyproject.toml for dependencies..."
if [ -f "pyproject.toml" ]; then
cat pyproject.toml | grep -A 10 "dependencies"
fi
Length of output: 777
Script:
#!/bin/bash
# Check Python version requirements in Home Assistant integration
echo "Checking manifest.json for HA integration requirements..."
fd manifest.json --exec cat {}
echo -e "\nChecking GitHub workflow files for Python version references..."
fd -e yml -e yaml -p "workflow" --exec grep -l "python" {} \; | while read -r file; do
echo -e "\n=== $file ==="
cat "$file" | grep -A 2 "python"
done
echo -e "\nChecking recent changes in CHANGELOG.md..."
if [ -f "CHANGELOG.md" ]; then
head -n 20 CHANGELOG.md
fi
Length of output: 1609
pyproject.toml (2)
24-27: LGTM! New classifiers enhance package metadata
The added classifiers provide better package categorization and align with the project's status.
37-37: LGTM! Pylint configuration is consistent
The pylint Python version update aligns with the project's Python requirement.
CHANGELOG.md (1)
8-8: Verify Python 3.13 compatibility testing.
Please ensure thorough testing has been performed with Python 3.13. Consider adding details about:
- Compatibility testing results
- Any breaking changes or deprecation warnings
- Minimum required Python 3.13 version (alpha/beta/rc/final)
| set -eu | ||
|
|
||
| pyversions=(3.12) | ||
| pyversions=(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.
🛠️ Refactor suggestion
Add fallback Python versions
The script currently only tries Python 3.13. Consider adding fallback versions (3.12, 3.11) to ensure the script works in environments where 3.13 isn't available yet.
Here's the suggested change:
-pyversions=(3.13)
+pyversions=(3.13 3.12 3.11)This ensures:
- Script attempts to use 3.13 first
- Falls back to stable versions if 3.13 isn't available
- Broader compatibility across different environments
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| pyversions=(3.13) | |
| pyversions=(3.13 3.12 3.11) |
| description = "Plugwise beta custom-component" | ||
| readme = "README.md" | ||
| requires-python = ">=3.12" | ||
| requires-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 3.13 requirement needs revision
The requirement of Python >=3.13 is problematic for several reasons:
- Python 3.13 is still in development and not yet released
- The codebase doesn't show any usage of Python 3.13-specific features
- No CI configuration was found to test against Python 3.13
- The project is marked as "Development Status :: 4 - Beta" which suggests it should use stable Python versions
Recommendations:
- Revert to a stable Python version requirement (e.g., ">=3.11,<3.14")
- Add explicit documentation if any Python 3.13 features are required
- Set up CI testing for all supported Python versions
🔗 Analysis chain
Verify Python 3.13 compatibility
The Python requirement has been updated to >=3.13, which is a significant change as Python 3.13 is still in development.
Consider:
- Adding an upper bound to the Python version requirement (e.g.,
>=3.13,<3.14) - Documenting any Python 3.13-specific features being used
- Adding CI tests for Python 3.13
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for any potential compatibility issues in the codebase
rg "# Python 3\.12" -g '!pyproject.toml'
# Check for version-specific imports or features
ast-grep --pattern 'import typing' -l | xargs rg "Python 3\.1[23]"
Length of output: 217
Script:
#!/bin/bash
# Check Python version specific features or requirements in the codebase
rg "Python 3\.1[23]" --type py
# Look for potential Python 3.13 specific features
rg "match.*case" --type py
rg "type.*TypeVar" --type py
rg "from typing import" --type py
# Check tox.ini or setup.cfg for Python version configurations
fd "tox.ini|setup.cfg" --exec cat {}
# Check CI configuration files for Python version settings
fd "\.github/workflows/.*yml$" --exec cat {}
Length of output: 812
Script:
#!/bin/bash
# Check the current Python version requirement
cat pyproject.toml
# Check for any test configurations or requirements
fd "requirements.*\.txt$" --exec cat {}
# Check for any GitHub Actions workflow that specifies Python versions
fd "\.github/workflows" --exec rg "python-version" {}
Length of output: 21172
pyproject.toml
Outdated
| [project] | ||
| name = "plugwise-beta" | ||
| version = "0.51.6" | ||
| version = "0.56.0a0" |
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
Based on the information gathered from the CHANGELOG and manifest.json, I can now provide a final response:
Version number needs to be aligned with manifest.json
The version bump to 0.56.0a0 in pyproject.toml is inconsistent with manifest.json which shows version 0.55.0. The alpha designation (a0) also indicates this is a pre-release version, which should be coordinated with the ongoing changes for Python 3.13 support.
Please:
- Align version numbers between pyproject.toml and manifest.json
- Consider using 0.55.1 or 0.55.0a0 instead, as 0.56.0 represents a larger version jump
- Confirm if alpha status is intended, as this indicates pre-release code
🔗 Analysis chain
Version number requires clarification
The version bump from 0.51.6 to 0.56.0a0 is significant and seems to conflict with the PR description which mentions version 55. Additionally, the alpha designation (a0) indicates this is a pre-release version.
Please clarify:
- The expected version number (55 vs 56)
- Whether this should be an alpha release
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if this is the first alpha release by looking for previous versions
git log -1 --pretty=format:%H -- pyproject.toml | xargs git show | grep "version = "
Length of output: 0
Script:
#!/bin/bash
# Let's try a different approach to check version history
git log -p pyproject.toml | grep -A 1 -B 1 "version = "
# Also check for any tags that might indicate version history
git tag -l "v*" --sort=-v:refname | head -n 5
# Look for version references in other key files
fd "setup.py|CHANGELOG|HISTORY" --type f --exec cat {}
Length of output: 37614
Script:
#!/bin/bash
# Check for version references in other key files
fd "setup.cfg|manifest.json|__init__.py" --type f --exec cat {}
Length of output: 6412
|
PW-beta is at v0.55.0 at the moment. Oh sh*t I forgot to keep Let's aim for v0.55.1 for the coming update. |
bouwew
left a comment
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.
Looking good!
Please change the version in pyproject.toml to 0.55.0, and put the change under ## Ongoing in the CHANGELOG.
I'll add another PR for the backend update to v1.6.1 and bump the version to v0.55.1 in that PR.
|
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 (2)
CHANGELOG.md(1 hunks)pyproject.toml(3 hunks)
🔇 Additional comments (5)
pyproject.toml (3)
6-6: Python 3.13 requirement needs revision
Referencing the previous review comment about the Python version requirement being problematic as Python 3.13 is still in development.
37-37:
Pylint Python version configuration needs revision
The pylint Python version is set to 3.13, which aligns with the project's Python requirement. However, this should be reconsidered along with the Python version requirement.
-py-version = "3.13"
+py-version = "3.12"Likely invalid or redundant comment.
24-28:
Review Python 3.13 classifier
The classifier "Programming Language :: Python :: 3.13" might be premature as Python 3.13 is still in development. Consider removing this classifier until Python 3.13 is officially released.
"Intended Audience :: Testers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
- "Programming Language :: Python :: 3.13",
"Topic :: Home Automation",Likely invalid or redundant comment.
CHANGELOG.md (2)
3-8: LGTM! Latest changes are well documented.
The changelog entries for Python 3.13 support and ongoing changes are properly formatted and include relevant information.
Line range hint 1-1000: Verify the referenced Issue #776.
The changelog mentions a bugfix for Issue #776, but the details of the issue and its fix are not provided.
✅ Verification successful
The issue #776 exists and is open, describing a bug where switching the regulation mode to 'Off' causes the control_state nodes to be deleted. This matches with the changelog entry "Bugfix for Issue #776". Let me verify if this fix has been implemented in the codebase.
Let me check the actual implementation of the fix by looking at the recent changes in the relevant files.
Let me try a different approach to check the implementation.
Let me try one final verification approach to understand the fix implementation.
Based on the code review, I can now provide a final response about Issue #776:
Bug fix for control_state disappearing when regulation mode is off has been verified
The fix is implemented in the climate.py file where the regulation mode and control state handling is properly managed:
- When switching regulation mode to "off", the code now preserves the previous mode:
if hvac_mode == HVACMode.OFF:
await self.coordinator.api.set_regulation_mode(hvac_mode)
elif self.hvac_mode == HVACMode.OFF:
await self.coordinator.api.set_regulation_mode(self._previous_mode)- The control_state is properly tracked and maintained:
if (control_state := self.device.get(CONTROL_STATE)) in (
HVACAction.COOLING, HVACAction.HEATING, HVACAction.PREHEATING
):
return cast(HVACAction, control_state)🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if issue #776 exists and its status
gh issue view 776 --json title,state,body
Length of output: 1234
Script:
#!/bin/bash
# Check for recent changes related to control_state and regulation mode
rg -A 5 "control_state|regulation_mode" --type py
Length of output: 8215
Script:
#!/bin/bash
# Check recent commits related to control_state and regulation mode
git log -p --since="1 month ago" | grep -A 10 -B 10 "control_state\|regulation_mode"
Length of output: 0
Script:
#!/bin/bash
# Check the implementation in the climate.py file where regulation mode and control state are handled
ast-grep --pattern $'async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
$$$
await self.coordinator.api.set_regulation_mode($$$)
$$$' custom_components/plugwise/climate.py
Length of output: 192
Script:
#!/bin/bash
# Check the full climate.py file content to understand the regulation mode and control state handling
cat custom_components/plugwise/climate.py
Length of output: 11729
| [project] | ||
| name = "plugwise-beta" | ||
| version = "0.51.6" | ||
| version = "0.55.0" |
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.
Version number needs to be updated to 0.55.1
According to the PR comments, the version should be 0.55.1 instead of 0.55.0.
-version = "0.55.0"
+version = "0.55.1"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| version = "0.55.0" | |
| version = "0.55.1" |
|
I don't think there is anything left to mitigate with coderabbit, right @bouwew? I think we can just close them and merge? |



Update py313 + bumped pyproject still at 51.6 when we are at 55?
Summary by CodeRabbit
Release Notes
New Features
Breaking Changes
Updates