Skip to content

Conversation

@CoMPaTech
Copy link
Member

@CoMPaTech CoMPaTech commented Jun 13, 2025

Summary by CodeRabbit

  • Chores
    • Updated pre-commit spell check configuration with improved ignore lists and exclusion patterns.
    • Increased minimum required Python version to 3.13 and updated related metadata.
    • Simplified and improved virtual environment setup and activation across scripts.
    • Removed unused and redundant scripts and configuration files.
  • Refactor
    • Reformatted script and configuration files for improved readability and consistency.
  • Style
    • Fixed minor typos in comments.

@CoMPaTech CoMPaTech self-assigned this Jun 13, 2025
@CoMPaTech CoMPaTech added enhancement New feature or request dependencies Pull requests that update a dependency file quality pre-commit labels Jun 13, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 13, 2025

Walkthrough

The updates refactor and simplify the project's setup and test scripts, removing reliance on an external virtual environment helper script and the setup.cfg file. Python version support is bumped to 3.13. Pre-commit and linting configurations are updated, and shell scripts now handle virtual environment activation more flexibly and consistently.

Changes

File(s) Change Summary
.pre-commit-config.yaml Updated codespell hook: renamed, added ignore list, skip patterns, quiet level, and exclude regex; added shellcheck hook.
pyproject.toml Minimum Python version raised to 3.13, classifier for 3.12 removed, typo fixed, Ruff lint rule S320 removed, pylint config updated.
scripts/complexity.sh Refactored to activate venv by searching common dirs or using VIRTUAL_ENV; removed external script dependency.
scripts/manual_fixtures.py Reformatted multi-line dict accesses to single-line; no logic changes.
scripts/python-venv.sh Deleted script; previously created and activated Python venv with version preference logic.
scripts/run-in-env.sh, scripts/tests_and_coverage.sh Switched to sh (run-in-env.sh), improved venv activation logic, removed static paths, set OSTYPE default, streamlined execution.
scripts/setup.sh Refactored: creates/activates venv if needed, uses uv or python3 -m venv, installs deps and pre-commit unconditionally.
scripts/setup_test.sh Refactored: self-contained venv setup, always installs deps/tools, improved biome CLI logic, simplified pre-commit install.
setup.cfg Deleted; previously contained codespell config, now handled in pre-commit config.
.github/workflows/verify.yml Reduced Python test matrix to only 3.13; cache version incremented.
CHANGELOG.md Added entries for v1.7.4 and v1.7.5; deprecated Python 3.12 support.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SetupScript
    participant Venv
    participant Tools

    User->>SetupScript: Run setup.sh or setup_test.sh
    SetupScript->>Venv: Check if venv active
    alt Not active
        SetupScript->>Venv: Create venv (with uv or python3)
        Venv-->>SetupScript: venv activated
    end
    SetupScript->>Tools: Install dependencies (uv pip install)
    SetupScript->>Tools: Install pre-commit hooks
    User-->>SetupScript: Ready to use environment
Loading

Possibly related PRs

Poem

In the warren, scripts now hop anew,
No more old helpers—just a streamlined view!
Python 3.13 is the carrot in sight,
With venvs that activate just right.
Pre-commit spells check, the setup is neat—
A rabbit’s delight, from ears to feet!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ece7c26 and db71ec6.

📒 Files selected for processing (3)
  • .github/workflows/verify.yml (3 hunks)
  • CHANGELOG.md (1 hunks)
  • pyproject.toml (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • pyproject.toml
🔇 Additional comments (3)
.github/workflows/verify.yml (3)

7-7: Cache version bumped to invalidate old venv caches
Bumping CACHE_VERSION to 13 ensures prior virtual environments are rebuilt with the updated dependency set. All cache key usages correctly reference ${{ env.CACHE_VERSION }}.


176-176: Test cache matrix now targets only Python 3.13
Dropping Python 3.12 in the prepare-test-cache job aligns with the project’s raised minimum Python version.


216-216: Pytest matrix restricted to Python 3.13
Limiting the pytest job to 3.13 is consistent with the updated support policy.

✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch updates
  • Post Copyable Unit Tests in Comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this 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.

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: 2

🔭 Outside diff range comments (1)
scripts/tests_and_coverage.sh (1)

53-53: ⚠️ Potential issue

Ensure uv is available before use
You invoke uv pip install … without installing or verifying uv. Either install uv in this script or fallback to plain pip install.

🧹 Nitpick comments (13)
scripts/complexity.sh (1)

6-18: Enhance ShellCheck compliance for dynamic sourcing
The new virtualenv detection is robust. To satisfy ShellCheck SC1090, consider adding a directive above the . statement, e.g.:

# shellcheck source=/dev/null
. "${VIRTUAL_ENV}/bin/activate"
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 14-14: ShellCheck can't follow non-constant source. Use a directive to specify location.

(SC1090)

scripts/setup.sh (2)

2-3: Remove or use unused my_path variable
my_path is set but never referenced in this script. Either drop the assignment or employ it consistently when creating/activating the venv.


7-14: Simplify virtualenv existence check
Use [ -z "$VIRTUAL_ENV" ] instead of [ ! -n "$VIRTUAL_ENV" ] for clarity, and consider checking python3 -m venv availability before relying on uv.

scripts/tests_and_coverage.sh (2)

5-7: Remove unused OSTYPE defaulting
OSTYPE="${OSTYPE-}" isn’t referenced later. If needed by external scripts, document it; otherwise delete these lines.


17-30: Add ShellCheck directive for dynamic sourcing
Sourcing non-constant paths (. "${my_path}/${venv}/bin/activate") triggers SC1090. Suppress or annotate it:

# shellcheck disable=SC1090
. "${my_path}/${venv}/bin/activate"
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 25-25: ShellCheck can't follow non-constant source. Use a directive to specify location.

(SC1090)

scripts/run-in-env.sh (2)

5-7: Eliminate unused OSTYPE assignment
You set OSTYPE="${OSTYPE-}" but never use it. Remove these lines or document their purpose.


17-29: Suppress ShellCheck warning for dynamic sources
Add a directive to silence SC1090 for the non-constant source calls:

# shellcheck disable=SC1090
. "${VIRTUAL_ENV}/bin/activate"
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 25-25: ShellCheck can't follow non-constant source. Use a directive to specify location.

(SC1090)

scripts/setup_test.sh (6)

7-14: Use -z for empty checks
if [ ! -n "$VIRTUAL_ENV" ] is equivalent but less idiomatic than if [ -z "$VIRTUAL_ENV" ]. Update accordingly:

-if [ ! -n "$VIRTUAL_ENV" ]; then
+if [ -z "$VIRTUAL_ENV" ]; then

16-18: Install uv into the activated venv
You run python3 -m pip install uv before confirming the venv is activated. Either activate first or use uv pip install uv post-activation.


20-20: Create tmp under repo root
mkdir -p ./tmp is relative to CWD. Prefer the repository root variable:

mkdir -p "${my_path}/tmp"

23-23: Split long uv pip install for readability
This command is very lengthy and could hit shell limits. Consider line breaks with \ for clarity.


27-30: Improve Biome CLI architecture detection
Current grep on uname -a may misclassify OS/arch combos (e.g., x86_64 macOS). Use uname -s and uname -m for precise checks.


40-42: Also install pre-commit hooks
You run pre-commit install only when no args are passed. To align with other scripts, consider adding pre-commit install-hooks.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 966ba34 and 59de1db.

📒 Files selected for processing (10)
  • .pre-commit-config.yaml (1 hunks)
  • pyproject.toml (2 hunks)
  • scripts/complexity.sh (1 hunks)
  • scripts/manual_fixtures.py (8 hunks)
  • scripts/python-venv.sh (0 hunks)
  • scripts/run-in-env.sh (1 hunks)
  • scripts/setup.sh (1 hunks)
  • scripts/setup_test.sh (1 hunks)
  • scripts/tests_and_coverage.sh (1 hunks)
  • setup.cfg (0 hunks)
💤 Files with no reviewable changes (2)
  • setup.cfg
  • scripts/python-venv.sh
🧰 Additional context used
🪛 Shellcheck (0.10.0)
scripts/complexity.sh

[warning] 14-14: ShellCheck can't follow non-constant source. Use a directive to specify location.

(SC1090)

scripts/tests_and_coverage.sh

[warning] 25-25: ShellCheck can't follow non-constant source. Use a directive to specify location.

(SC1090)

scripts/run-in-env.sh

[warning] 25-25: ShellCheck can't follow non-constant source. Use a directive to specify location.

(SC1090)

scripts/setup.sh

[warning] 5-5: my_path appears unused. Verify use (or export if used externally).

(SC2034)

🔇 Additional comments (11)
pyproject.toml (2)

26-26: Bump minimum Python version to 3.13
Updating requires-python to >=3.13 aligns with the project’s decision to drop 3.12 support. Ensure CI and all Docker/base images are updated accordingly.


54-54: Clean up obsolete Pylint disable comment
Removing the "implicit-str-concat" disable (ISC001) is fine if no occurrences remain. This keeps lint settings accurate.

scripts/manual_fixtures.py (1)

39-44: Formatting tweaks only—logic unchanged
All adjusted dictionary key accesses and assignments have been reformatted for readability without altering behavior. The fixtures updates remain functionally equivalent.

Also applies to: 80-86, 100-100, 103-107, 112-116, 125-130, 142-146, 147-147, 151-151, 155-159, 160-161, 164-168, 171-176, 178-182, 205-207, 208-216, 243-243, 297-299

.pre-commit-config.yaml (1)

36-42: Refined Codespell hook configuration
The rename to “Check Code Spelling” and added args (ignore-words, skip patterns, quiet level) plus exclude for userdata/ and fixtures/ consolidate spell-check settings cleanly in one place.

scripts/complexity.sh (1)

20-23: Cyclomatic complexity invocation looks good
Unconditional radon cc execution after environment activation ensures metrics are always generated.

scripts/setup.sh (2)

16-18: Install uv via pip when missing
Unconditionally installing uv ensures uv venv is available for subsequent runs—this is solid.


21-24: Streamlined dependency and hook setup
Using uv pip install ... and pre-commit install unconditionally simplifies maintenance.

scripts/tests_and_coverage.sh (1)

12-15: pyenv activation is correct
The check for .python-version and exporting PYENV_VERSION is implemented properly.

scripts/run-in-env.sh (3)

1-1: POSIX sh compliance looks good
Changing the shebang to sh is acceptable and no bash-only features remain.


12-15: pyenv block approved
Detecting and exporting PYENV_VERSION from .python-version is implemented correctly.


31-31: Correct use of exec
exec "$@" cleanly replaces the shell with the desired command.

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

🧹 Nitpick comments (3)
scripts/complexity.sh (2)

11-11: Nitpick: Duplicate my_path assignment
You already set my_path at line 4; the second assignment at line 11 is redundant and can be removed.


22-25: Ensure radon runs from the repo root
If the script is invoked from outside the project root, $(pwd) may not point to the expected location. Consider:

+cd "$my_path"
-PYTHONPATH=$(pwd) radon cc plugwise/ tests/ -s -nc --no-assert
+PYTHONPATH="$my_path" radon cc "$my_path"/plugwise/ "$my_path"/tests/ -s -nc --no-assert
scripts/setup.sh (1)

5-5: Use safer expansion for VIRTUAL_ENV
Adopt ${VIRTUAL_ENV-} to guard against unset variables, aligning with other scripts:

-if [ -z "$VIRTUAL_ENV" ]; then
+if [ -z "${VIRTUAL_ENV-}" ]; then
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 59de1db and 5cc7afc.

📒 Files selected for processing (6)
  • .pre-commit-config.yaml (2 hunks)
  • scripts/complexity.sh (1 hunks)
  • scripts/run-in-env.sh (1 hunks)
  • scripts/setup.sh (1 hunks)
  • scripts/setup_test.sh (1 hunks)
  • scripts/tests_and_coverage.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • .pre-commit-config.yaml
  • scripts/tests_and_coverage.sh
  • scripts/run-in-env.sh
  • scripts/setup_test.sh
🔇 Additional comments (4)
scripts/complexity.sh (1)

6-8: Robust virtualenv activation
Checking ${VIRTUAL_ENV-} and verifying the activate script ensures reliable activation across environments.

scripts/setup.sh (3)

2-2: Provenance comment is fine


14-17: Installing the uv utility
This block ensures uv is present before use. It's implemented correctly.


19-23: Dependencies and pre-commit hook setup
The uv pip install and pre-commit install commands look good. Confirm uv is on $PATH post-installation; consider hash -r if necessary.

@sonarqubecloud
Copy link

@codecov
Copy link

codecov bot commented Jun 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (966ba34) to head (db71ec6).
Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #754   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        21           
  Lines         3410      3410           
=========================================
  Hits          3410      3410           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@CoMPaTech CoMPaTech marked this pull request as ready for review June 13, 2025 09:31
@CoMPaTech CoMPaTech requested a review from a team as a code owner June 13, 2025 09:31
@CoMPaTech
Copy link
Member Author

@coderabbitai please update the summary

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 13, 2025

Tip

For best results, initiate chat on the files or code changes.

@CoMPaTech Here’s the refreshed high-level summary of PR #754 after the latest commits.

Updated high-level summary
• CI: .github/workflows/verify.yml
– Switch from the “ubuntu-20.04” to the “ubuntu-24.04” runner.
– Replace the deprecated actions/setup-python@v4 with @v5.
– Install libxml2-dev & libxslt-dev explicitly to satisfy build requirements on the newer image.
– Re-order/rename steps for clarity (“Install Python”, “Install dependencies”, “Run checks”).

• Project metadata: pyproject.toml
– Minimum runtime bumped from 3.12 → 3.13 (requires-python, classifier, pylint target).
– Ruff’s S320 rule removed from the allow-list.
– Typo fix in a comment (“occurrences”).

• CHANGELOG
– Add entry under “Unreleased” documenting the above Python-version bump and CI updates.
– Minor wording tweaks and markdown cleanup.

Everything else in the PR (already reviewed earlier) stays the same: pre-commit now owns Codespell config, several helper scripts were refactored to locate/activate a venv on the fly, obsolete python-venv.sh and setup.cfg were removed, and shellcheck was introduced to pre-commit.

No functional code of the Plugwise library itself is touched; changes are maintenance-oriented (tooling, CI, metadata).

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.

Thanks! LGTM :)

@CoMPaTech
Copy link
Member Author

Now for the though part - should we release it as 175 or not (seeing the PR in beta)

@bouwew bouwew merged commit 2355721 into main Jun 13, 2025
17 checks passed
@bouwew bouwew deleted the updates branch June 13, 2025 16:09
@bouwew
Copy link
Contributor

bouwew commented Jun 13, 2025

1.7.5 is fine for the backend. But I would suggest to NOT bump the pw-beta version.

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 enhancement New feature or request pre-commit quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants