Skip to content

install pioarduino core in penv #254

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 2 commits into from
Aug 9, 2025
Merged

install pioarduino core in penv #254

merged 2 commits into from
Aug 9, 2025

Conversation

Jason2866
Copy link

@Jason2866 Jason2866 commented Aug 9, 2025

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

  • Chores
    • Updated dependency handling to support installing packages directly from URLs.
    • Adjusted package installation logic to bypass version checks for certain packages when already installed.

Copy link

coderabbitai bot commented Aug 9, 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 update modifies how the "platformio" dependency is specified and installed. Instead of using a version constraint, it now references a direct GitHub archive URL. The installation logic is adjusted to bypass version checks for "platformio" and to handle direct URL or VCS package specifications correctly when constructing the pip install list.

Changes

Cohort / File(s) Change Summary
Dependency Handling & Installation Logic
builder/main.py
Changed "platformio" dependency from a version string to a GitHub URL; updated logic to skip version checks for "platformio"; improved package list construction to support direct URLs and VCS installs.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Builder
    participant Pip

    User->>Builder: Run dependency installation
    Builder->>Builder: Check installed packages
    alt platformio present
        Builder->>Builder: Skip version check for platformio
    else platformio not present
        Builder->>Builder: Add platformio (from URL) to install list
    end
    Builder->>Builder: Process other dependencies
    alt Dependency is URL/VCS
        Builder->>Builder: Add URL/VCS spec directly to install list
    else
        Builder->>Builder: Add "name+version" to install list
    end
    Builder->>Pip: Install all packages from constructed list
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇
A hop to GitHub, a leap through the cloud,
Platformio’s path is now URL-proud.
No more version checks to slow the race,
Just direct installs, a streamlined pace.
With smarter logic and dependencies tight,
The builder now hops with code done right!
🌱✨

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

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

Support

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

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 Aug 9, 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

🧹 Nitpick comments (1)
builder/main.py (1)

248-255: Good: direct URL/VCS specs handled; generalize earlier to avoid future crashes

The install list logic correctly passes direct specs (http/https/git+/file) straight to pip. However, get_packages_to_install still assumes all non-platformio specs are semver constraints. If another dep later uses a direct URL/VCS, semantic_version.Spec(spec) will raise.

Recommended:

  • Add a small helper is_direct_spec(spec) and use it both in get_packages_to_install and here.
  • In get_packages_to_install: if is_direct_spec(spec), either (a) always reinstall only when missing, or (b) parse an expected version (when possible) similarly to platformio; otherwise skip version checks.

Example helper (outside these lines):

def is_direct_spec(spec: str) -> bool:
    return isinstance(spec, str) and spec.startswith(("http://", "https://", "git+", "file://"))

Then in get_packages_to_install:

for package, spec in deps.items():
    if package not in installed_packages:
        yield package
    elif is_direct_spec(spec):
        # Consider extracting/validating version when possible, else accept installed
        continue
    # ... existing semver Spec logic ...

This keeps behavior consistent and future-proof.

Please confirm that uv pip list reports the package name as "platformio" when installing from the given GitHub zip (to ensure installed_packages reflects it correctly).

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 355f503 and 05e1750.

📒 Files selected for processing (1)
  • builder/main.py (3 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 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.
Learnt from: Jason2866
PR: pioarduino/platform-espressif32#252
File: builder/frameworks/espidf.py:1382-1388
Timestamp: 2025-08-08T09:50:01.956Z
Learning: Preference in pioarduino/platform-espressif32 (builder/frameworks/espidf.py): Avoid using {"name": "boot"} as a sentinel when resolving the default app partition offset. Instead, call parttool.py with --partition-boot-default directly (and optionally fall back to factory/ota_0) to prevent confusion with non-existent CSV names.
Learnt from: Jason2866
PR: pioarduino/platform-espressif32#199
File: examples/arduino-blink/platformio.ini:81-83
Timestamp: 2025-06-26T09:56:30.658Z
Learning: In examples/arduino-blink/platformio.ini, the different lib_ignore configurations across environments (some including wifi, some not, different syntax styles) are intentional test cases, not inconsistencies that need to be fixed.
📚 Learning: 2025-07-29T11:35:26.182Z
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.

Applied to files:

  • builder/main.py
⏰ 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/arduino-NimBLE-ext_client)
  • GitHub Check: build (windows-latest, examples/espidf-http-request)
  • GitHub Check: build (macos-15, examples/arduino-blink)
  • GitHub Check: build (macos-15, examples/arduino-zigbee-light)
  • GitHub Check: build (windows-latest, examples/espidf-storage-sdcard)
  • GitHub Check: build (windows-latest, examples/espidf-coap-server)
  • GitHub Check: build (ubuntu-latest, examples/espidf-ulp)
  • GitHub Check: build (windows-latest, examples/espidf-exceptions)
  • GitHub Check: build (windows-latest, examples/arduino-matter-light)
  • GitHub Check: build (windows-latest, examples/arduino-zigbee-switch)
  • GitHub Check: build (ubuntu-latest, examples/espidf-storage-sdcard)
  • GitHub Check: build (ubuntu-latest, examples/espidf-ulp-lp)
  • GitHub Check: build (windows-latest, examples/arduino-wifiscan)
  • GitHub Check: build (ubuntu-latest, examples/espidf-arduino-blink)
  • GitHub Check: build (ubuntu-latest, examples/tasmota)
  • GitHub Check: build (ubuntu-latest, examples/espidf-arduino-matter-light)
  • GitHub Check: build (ubuntu-latest, examples/espidf-arduino-C6-ULP-blink)
  • GitHub Check: build (ubuntu-latest, examples/arduino-NimBLE-ext_client)
  • GitHub Check: build (ubuntu-latest, examples/arduino-wifiscan)
  • GitHub Check: build (ubuntu-latest, examples/arduino-blink)
🔇 Additional comments (1)
builder/main.py (1)

52-52: Inconsistent Enforcement of Pinned PlatformIO Version

You’ve pinned PlatformIO in python_deps to the v6.1.18 archive URL, but in get_packages_to_install (builder/main.py:152–155) you skip re-installing “platformio” if any version is already present. This allows an out-of-sync core to persist despite your URL pin.

Please clarify your intended behavior and adjust accordingly:

  • Enforce the exact v6.1.18 core by parsing the URL version and yielding platformio when the installed version doesn’t match.
  • Always reinstall from the URL (remove or rethink the elif package == "platformio": continue branch).
  • Or accept any installed PlatformIO version (in which case the URL pin should be documented as “initial bootstrap only”).

Files/Lines to Review:

  • builder/main.py: python_deps entry at line 52
  • builder/main.py: get_packages_to_install branch at lines 152–155

@Jason2866 Jason2866 merged commit 7f5adc2 into develop Aug 9, 2025
1 check passed
@Jason2866 Jason2866 deleted the pioarduino_core branch August 9, 2025 17:45
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