Skip to content

Full uv path #227

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
Jul 15, 2025
Merged

Full uv path #227

merged 2 commits into from
Jul 15, 2025

Conversation

Jason2866
Copy link

@Jason2866 Jason2866 commented Jul 14, 2025

Description:

hopefully fixes Windows uv install issues. Adding Python virtual env scripts directory to Windows path

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

  • Refactor
    • Improved handling of Python and related tool executable paths for better reliability across platforms.
    • Centralized Python executable path management for more consistent behavior.
    • Enhanced logic for locating and running required tools such as esptool and uv.

No user-facing features or interface changes were introduced in this update.

Copy link

coderabbitai bot commented Jul 14, 2025

Walkthrough

The update refactors how Python and related tool executable paths are managed by introducing a global variable for the Python executable and new helper functions for resolving full paths to esptool and uv. It unifies subprocess command invocations to use these resolved paths and updates function signatures accordingly.

Changes

File(s) Change Summary
builder/main.py Centralized Python executable path using a global variable; added helpers for resolving esptool and uv paths; updated subprocess calls to use resolved paths; modified function signatures for setup_python_paths and install_esptool to remove the environment parameter; improved Windows/Unix path handling.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant MainScript
    participant PythonExe
    participant UV
    participant Esptool

    User->>MainScript: Run build/setup
    MainScript->>PythonExe: Resolve Python executable path
    MainScript->>UV: Use _get_uv_executable_path to resolve path
    MainScript->>Esptool: Use _get_esptool_executable_path to resolve path
    MainScript->>PythonExe: Run pip/uv/esptool commands via subprocess
    PythonExe-->>MainScript: Return output/status
    UV-->>MainScript: Return output/status
    Esptool-->>MainScript: Return output/status
Loading

Possibly related PRs

  • call esptool with full path #226: Centralizes Python executable path handling and introduces helpers for resolving tool executable paths, similar to the approach in this PR.

Poem

In a warren of code, a path once unclear,
Now Python and friends are always near.
With helpers to guide uv and esptool too,
The subprocesses march, knowing just what to do.
🐇✨ Paths resolved, the build hops true!

✨ Finishing Touches
  • 📝 Generate Docstrings

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 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 14, 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 2c603d4 and 3be232e.

📒 Files selected for processing (1)
  • builder/main.py (12 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Jason2866
PR: pioarduino/platform-espressif32#225
File: builder/main.py:99-108
Timestamp: 2025-07-13T20:03:29.654Z
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.
builder/main.py (1)
Learnt from: Jason2866
PR: pioarduino/platform-espressif32#225
File: builder/main.py:99-108
Timestamp: 2025-07-13T20:03:29.654Z
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). (16)
  • GitHub Check: build (macos-15, examples/tasmota)
  • GitHub Check: build (macos-15, examples/espidf-arduino-C6-ULP-blink)
  • GitHub Check: build (macos-15, examples/espidf-blink)
  • GitHub Check: build (windows-latest, examples/espidf-peripherals-usb)
  • GitHub Check: build (windows-latest, examples/espidf-http-request)
  • GitHub Check: build (macos-15, examples/arduino-blink)
  • GitHub Check: build (windows-latest, examples/espidf-blink)
  • GitHub Check: build (windows-latest, examples/espidf-arduino-blink)
  • GitHub Check: build (windows-latest, examples/espidf-storage-sdcard)
  • GitHub Check: build (windows-latest, examples/espidf-exceptions)
  • GitHub Check: build (windows-latest, examples/espidf-hello-world)
  • GitHub Check: build (windows-latest, examples/tasmota)
  • GitHub Check: build (windows-latest, examples/arduino-matter-light)
  • GitHub Check: build (windows-latest, examples/arduino-NimBLE-ext_client)
  • GitHub Check: build (windows-latest, examples/arduino-wifiscan)
  • GitHub Check: build (windows-latest, examples/arduino-blink)
🔇 Additional comments (8)
builder/main.py (8)

84-108: Function refactored to use global PYTHON_EXE variable.

The implementation correctly validates the Python executable and includes a timeout for the subprocess call. The lack of error handling for the subprocess is intentional based on project conventions.


111-144: Well-designed helper function for cross-platform executable path resolution.

The function correctly handles platform-specific differences and provides a sensible fallback mechanism.


146-169: Clean wrapper functions for specific executables.

Good use of the DRY principle by delegating to the generic _get_executable_path function.


199-236: Correctly implements the fix for Windows uv installation issues.

The implementation properly:

  1. Resolves the uv executable path
  2. Updates the path after installation
  3. Adds the Scripts directory to PATH on Windows

This directly addresses the PR objective.


329-367: Function properly refactored to use global state and helper functions.

The implementation correctly uses the new helper functions and returns the resolved esptool path.


371-371: Proper handling of esptool binary path with space support.

Good practice to handle paths with spaces by adding quotes when necessary.

Also applies to: 754-758


918-918: Consistent use of global PYTHON_EXE variable.


1046-1046: Good modernization to f-string formatting.

@Jason2866 Jason2866 merged commit 8e2a364 into develop Jul 15, 2025
68 checks passed
@Jason2866 Jason2866 deleted the full_uv_path branch July 15, 2025 10:05
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