Skip to content

Conversation

@CoMPaTech
Copy link
Member

@CoMPaTech CoMPaTech commented Nov 29, 2024

Update py313 + bumped pyproject still at 51.6 when we are at 55?

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced support for zone-based climate entities for Adam in version 0.55.0.
  • Breaking Changes

    • Existing device-based climate entities will be replaced by new zone-based climate entities in version 0.55.0.
  • Updates

    • Updated Python version requirement from 3.12 to 3.13 across various configurations.
    • Incremented project version to 0.55.0, indicating a new release.
    • Enhanced project metadata with additional classifiers for better categorization.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 29, 2024

Walkthrough

The 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 hacs.json file is also updated to require a newer version of Home Assistant. Overall, the changes ensure compatibility with the latest Python version and enhance project documentation.

Changes

File Path Change Summary
.github/workflows/core_next.yml Updated DEFAULT_PYTHON from "3.12" to "3.13".
.github/workflows/test.yml Updated DEFAULT_PYTHON from "3.12" to "3.13".
CHANGELOG.md Added entry for Python 3.13 support; noted breaking change for climate entities in version 0.55.0.
hacs.json Changed homeassistant version requirement from "2024.11.0" to "2024.12.0".
mypy.ini Updated python_version from 3.12 to 3.13.
pyproject.toml Incremented version from 0.51.6 to 0.55.0; updated Python requirement to >=3.13; added classifiers.
scripts/python-venv.sh Changed pyversions from 3.12 to 3.13.

Possibly related PRs

  • Fix mypy dev issue (for beta) #692: Updates mypy.ini to change the Python version from 3.11 to 3.12, relevant to the main PR's updates.
  • Improve config_flow coding #736: Improves configuration flow in custom_components/plugwise/config_flow.py, relevant for compatibility with the updated Python version.
  • Downstreaming Core PR #126896 #750: Modifies custom_components/plugwise/config_flow.py, enhancing its functionality and control flow, related to the Python version updates in the main PR.
  • Fixing issue #776 #779: Changes to custom_components/plugwise/climate.py may be affected by the Python version updates in the main PR.

Suggested labels

enhancement, needs_upstreaming

🐇 In the meadow, hopping free,
Python's version changed with glee.
From three point twelve to thirteen bright,
Our workflows now take flight!
With climate zones and updates grand,
Plugwise thrives across the land! 🌼


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@CoMPaTech CoMPaTech added downstreaming Things that are changed on HA-core side and to be applied to -beta dependencies Pull requests that update a dependency file labels Nov 29, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 testing

The 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 version

The CACHE_VERSION should 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 upgrade
CHANGELOG.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

📥 Commits

Reviewing files that changed from the base of the PR and between 9dc010d and 6d29c65.

📒 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: ⚠️ Potential issue

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:

  1. Waiting for the stable release of Python 3.13
  2. Adding appropriate warnings in documentation
  3. 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: ⚠️ Potential issue

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:

  1. Keeping 3.12 as the default while testing 3.13 in parallel
  2. 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:

  1. Adding a comment explaining the early adoption rationale
  2. 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.toml already specifies Python 3.13 as the target version
  • This is in the core_next.yml workflow 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)
Copy link
Contributor

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:

  1. Script attempts to use 3.13 first
  2. Falls back to stable versions if 3.13 isn't available
  3. 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.

Suggested change
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"
Copy link
Contributor

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:

  1. Adding an upper bound to the Python version requirement (e.g., >=3.13,<3.14)
  2. Documenting any Python 3.13-specific features being used
  3. 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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

⚠️ Potential issue

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:

  1. Align version numbers between pyproject.toml and manifest.json
  2. Consider using 0.55.1 or 0.55.0a0 instead, as 0.56.0 represents a larger version jump
  3. 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:

  1. The expected version number (55 vs 56)
  2. 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

@CoMPaTech CoMPaTech marked this pull request as ready for review November 29, 2024 12:42
@CoMPaTech CoMPaTech requested a review from a team as a code owner November 29, 2024 12:42
@bouwew
Copy link
Contributor

bouwew commented Nov 29, 2024

PW-beta is at v0.55.0 at the moment. Oh sh*t I forgot to keep pyproject.toml updated :(

Let's aim for v0.55.1 for the coming update.

Copy link
Contributor

@bouwew bouwew left a 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.

@sonarqubecloud
Copy link

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 6d29c65 and 507346e.

📒 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: ⚠️ Potential issue

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: ⚠️ Potential issue

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:

  1. 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)
  1. 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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

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.

Suggested change
version = "0.55.0"
version = "0.55.1"

@CoMPaTech
Copy link
Member Author

I don't think there is anything left to mitigate with coderabbit, right @bouwew? I think we can just close them and merge?

@bouwew bouwew merged commit f1740cf into main Nov 29, 2024
8 checks passed
@bouwew bouwew deleted the py313 branch November 29, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file downstreaming Things that are changed on HA-core side and to be applied to -beta

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants