Skip to content

Version check for tool-esp_install (renamed tl-install) and auto install version listed in platform.json #237

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

Merged
merged 18 commits into from
Jul 30, 2025

Conversation

Jason2866
Copy link

@Jason2866 Jason2866 commented Jul 29, 2025

Description:

Related issue (if applicable): fixes #

Checklist:

  • The pull request is done against the latest develop branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR, more changes are allowed when changing boards.json
  • I accept the CLA

Summary by CodeRabbit

  • New Features

    • Improved management of the ESP tool installer, ensuring the correct version is installed automatically.
    • Enhanced version checking and installation process for the ESP tool package.
  • Bug Fixes

    • Improved error logging for package installation and version issues.
  • Chores

    • Updated package naming and version information for the ESP tool installer.

Copy link

coderabbitai bot commented Jul 29, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes rename the "tl-install" package to "tool-esp_install" in the platform configuration, update its version and URL, and introduce comprehensive version checking and installation logic for this tool within the Espressif32Platform class. Several new helper methods are added to manage installation, version comparison, and path resolution.

Changes

Cohort / File(s) Change Summary
Platform Package Declaration Update
platform.json
Renamed "tl-install" package to "tool-esp_install", added "package-version", and updated version URL.
Tool Installation Logic & Version Management
platform.py
Added constants and methods for tool version checking, comparison, extraction, and installation; updated installer configuration and tool path methods; improved logging.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Espressif32Platform
    participant PackageManager

    User->>Espressif32Platform: Initialize platform / configure installer
    Espressif32Platform->>Espressif32Platform: _check_tl_install_version()
    alt tool-esp_install not present or version mismatch
        Espressif32Platform->>Espressif32Platform: _install_tl_install(version)
        Espressif32Platform->>PackageManager: Install tool-esp_install
        PackageManager-->>Espressif32Platform: Installation result
    end
    Espressif32Platform->>User: Proceed with installer configuration
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

A package renamed, a version anew,
The installer’s logic now strong and true.
With checks and installs that know what to do,
Espressif hops forward, its tools in a queue.
🐇✨
Code carrots abound, for reviewers to chew!

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch wip_tl_version

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 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 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.

@Jason2866
Copy link
Author

@coderabbitai full review

Copy link

coderabbitai bot commented Jul 29, 2025

✅ Actions performed

Full review triggered.

Copy link

@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
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71d2832 and cc78327.

📒 Files selected for processing (2)
  • platform.json (1 hunks)
  • platform.py (7 hunks)
🧰 Additional context used
🧠 Learnings (1)
platform.py (1)

Learnt from: Jason2866
PR: #225
File: builder/main.py:99-108
Timestamp: 2025-07-13T20:03:29.695Z
Learning: In the ESP32 platform builder, the subprocess call to get site-packages directory in setup_python_paths() function is intentionally left without error handling because if this basic Python operation fails, it indicates a fundamental system issue that would cause the entire build process to fail anyway.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (18)
  • GitHub Check: build (macos-15, examples/espidf-ulp-riscv)
  • GitHub Check: build (macos-15, examples/espidf-ulp)
  • GitHub Check: build (macos-15, examples/espidf-http-request)
  • GitHub Check: build (ubuntu-latest, examples/espidf-arduino-matter-light)
  • GitHub Check: build (windows-latest, examples/espidf-blink)
  • GitHub Check: build (ubuntu-latest, examples/espidf-ulp-riscv)
  • GitHub Check: build (macos-15, examples/arduino-blink)
  • GitHub Check: build (windows-latest, examples/tasmota)
  • GitHub Check: build (windows-latest, examples/espidf-arduino-blink)
  • GitHub Check: build (windows-latest, examples/arduino-matter-light)
  • GitHub Check: build (ubuntu-latest, examples/espidf-peripherals-usb)
  • GitHub Check: build (windows-latest, examples/arduino-NimBLE-ext_client)
  • GitHub Check: build (ubuntu-latest, examples/espidf-http-request)
  • GitHub Check: build (windows-latest, examples/arduino-wifiscan)
  • GitHub Check: build (ubuntu-latest, examples/espidf-arduino-blink)
  • GitHub Check: build (ubuntu-latest, examples/espidf-blink)
  • GitHub Check: build (ubuntu-latest, examples/arduino-zigbee-light)
  • GitHub Check: build (ubuntu-latest, examples/arduino-blink)
🔇 Additional comments (8)
platform.json (1)

98-104: LGTM! Package rename follows established naming conventions.

The rename from "tl-install" to "tool-esp_install" aligns with the platform's naming pattern where tool packages use the "tool-" prefix. The addition of "package-version" field and updated URL are consistent with other tool packages in the configuration.

platform.py (7)

36-36: Good use of constant for package name.

Defining tl_install_name as a constant improves maintainability and reduces the risk of typos when referencing the package name throughout the code.


213-231: Version comparison logic is appropriate.

The method correctly handles both direct version strings and URL-based versions, extracting the semantic version for comparison. The string equality check is sufficient for semantic version comparison.


232-254: Well-implemented version extraction logic.

The method robustly handles both URL-based and direct version strings. The regex pattern correctly extracts semantic versions, and the fallback ensures the method doesn't fail even with unexpected formats.


324-325: Consistent use of constant.

Good update to use the tl_install_name constant instead of the hardcoded string, maintaining consistency with the package rename.


565-582: Improved installer configuration with version checking.

The addition of version checking before proceeding with the installer configuration is a good improvement. This ensures the correct version is installed before use.

However, note the continued pattern of modifying the package's optional status at line 579, which may cause inconsistency with the platform configuration.


616-616: Fixed error message formatting.

Good catch on fixing the extra space in the error message.


286-286: No action needed for pm.install(version) usage
The pm.install method accepts either a plain version (using the instance’s predefined package name) or a full URL, matching its use elsewhere in the codebase (e.g. installing via tl_path in platform.py and framework URLs in arduino.py). This call is correct as is.

@Jason2866 Jason2866 changed the title Wip tl version Version check for tool-esp_install (renamed tl-install) and auto install version listed in platform.json Jul 29, 2025
@Jason2866
Copy link
Author

@coderabbitai full review

Copy link

coderabbitai bot commented Jul 30, 2025

✅ Actions performed

Full review triggered.

Copy link

@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
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71d2832 and 00d06cf.

📒 Files selected for processing (2)
  • platform.json (1 hunks)
  • platform.py (9 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: Jason2866
PR: pioarduino/platform-espressif32#237
File: platform.py:200-201
Timestamp: 2025-07-29T11:35:26.182Z
Learning: In platform.py, the `tool-esp_install` package intentionally transitions from mandatory to optional status after successful installation. Initially it's needed and mandatory for installation, but becomes optional once installed since it's no longer required for subsequent operations. Setting `self.packages[tl_install_name]["optional"] = True` after version verification is the intended design pattern.
platform.json (1)

Learnt from: Jason2866
PR: #237
File: platform.py:200-201
Timestamp: 2025-07-29T11:35:26.182Z
Learning: In platform.py, the tool-esp_install package intentionally transitions from mandatory to optional status after successful installation. Initially it's needed and mandatory for installation, but becomes optional once installed since it's no longer required for subsequent operations. Setting self.packages[tl_install_name]["optional"] = True after version verification is the intended design pattern.

platform.py (2)

Learnt from: Jason2866
PR: #237
File: platform.py:200-201
Timestamp: 2025-07-29T11:35:26.182Z
Learning: In platform.py, the tool-esp_install package intentionally transitions from mandatory to optional status after successful installation. Initially it's needed and mandatory for installation, but becomes optional once installed since it's no longer required for subsequent operations. Setting self.packages[tl_install_name]["optional"] = True after version verification is the intended design pattern.

Learnt from: Jason2866
PR: #225
File: builder/main.py:99-108
Timestamp: 2025-07-13T20:03:29.695Z
Learning: In the ESP32 platform builder, the subprocess call to get site-packages directory in setup_python_paths() function is intentionally left without error handling because if this basic Python operation fails, it indicates a fundamental system issue that would cause the entire build process to fail anyway.

🪛 Ruff (0.12.2)
platform.py

315-315: f-string without any placeholders

Remove extraneous f prefix

(F541)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: build (macos-15, examples/espidf-arduino-C6-ULP-blink)
  • GitHub Check: build (macos-15, examples/espidf-storage-sdcard)
  • GitHub Check: build (macos-15, examples/espidf-arduino-matter-light)
  • GitHub Check: build (macos-15, examples/arduino-wifiscan)
  • GitHub Check: build (macos-15, examples/arduino-blink)
  • GitHub Check: build (windows-latest, examples/arduino-rmt-blink)
  • GitHub Check: build (windows-latest, examples/espidf-hello-world)
  • GitHub Check: build (windows-latest, examples/espidf-peripherals-uart)
  • GitHub Check: build (windows-latest, examples/espidf-peripherals-usb)
  • GitHub Check: build (windows-latest, examples/espidf-arduino-littlefs)
  • GitHub Check: build (windows-latest, examples/arduino-NimBLE-ext_client)
  • GitHub Check: build (windows-latest, examples/espidf-exceptions)
  • GitHub Check: build (windows-latest, examples/espidf-coap-server)
  • GitHub Check: build (windows-latest, examples/arduino-usb-keyboard)
  • GitHub Check: build (windows-latest, examples/arduino-wifiscan)
  • GitHub Check: build (ubuntu-latest, examples/espidf-ulp)
  • GitHub Check: build (ubuntu-latest, examples/espidf-hello-world)
  • GitHub Check: build (ubuntu-latest, examples/espidf-arduino-blink)
  • GitHub Check: build (ubuntu-latest, examples/espidf-arduino-matter-light)
  • GitHub Check: build (ubuntu-latest, examples/arduino-blink)
🔇 Additional comments (7)
platform.json (1)

98-104: Package rename and version specification look good!

The rename from "tl-install" to "tool-esp_install" is properly implemented with the addition of the package-version field for version checking. The non-optional status aligns with the intended design where the tool is mandatory during initial installation.

platform.py (6)

36-36: New constant and helper functions are well-implemented!

The tl_install_name constant and the new helper functions safe_remove_file and safe_copy_directory follow the established patterns in the codebase with proper error handling through the safe_file_operation decorator.

Also applies to: 113-120, 154-161


181-230: Version checking logic is comprehensive and well-structured!

The _check_tl_install_version method properly handles all cases: missing installation, version mismatch, and correct version. The transition to optional status after verification aligns with the documented design pattern.


231-272: Version comparison and extraction logic is robust!

The methods handle both URL-based and direct version formats effectively. The regex pattern r'v(\d+\.\d+\.\d+)' correctly extracts semantic versions from URLs.


348-351: Good use of the constant instead of hardcoded string!

The update to use tl_install_name instead of hardcoded "tl-install" improves maintainability.


589-612: Installer configuration properly integrates version checking!

The _configure_installer method correctly:

  1. Performs version checking/installation first
  2. Handles legacy tl-install cleanup
  3. Uses the new constant throughout
  4. Provides appropriate error handling and logging

646-646: Good catch on the logging message fix!

The error message now correctly indicates it's about reading package data.

@Jason2866 Jason2866 merged commit ec4b554 into develop Jul 30, 2025
68 checks passed
@Jason2866 Jason2866 deleted the wip_tl_version branch July 30, 2025 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant