Skip to content

hash deps for penv lib update#449

Merged
Jason2866 merged 4 commits into
developfrom
upd_idf_comp
Mar 30, 2026
Merged

hash deps for penv lib update#449
Jason2866 merged 4 commits into
developfrom
upd_idf_comp

Conversation

@Jason2866
Copy link
Copy Markdown

@Jason2866 Jason2866 commented Mar 30, 2026

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
    • Centralized the Python dependency specification used for ESP-IDF virtual environments.
    • Installation flow now computes and reuses a single dependency set for environment creation and package installation.
    • Virtual environment freshness detection improved by hashing and persisting dependency specs so environments are reliably invalidated and refreshed when dependencies change.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d299c410-1f7a-40df-b94e-43dd4a82b83d

📥 Commits

Reviewing files that changed from the base of the PR and between b800765 and c51740d.

📒 Files selected for processing (1)
  • builder/frameworks/espidf.py

📝 Walkthrough

Walkthrough

Centralized ESP-IDF Python dependency specifiers in _get_python_deps(), added dependency-hash tracking to venv freshness checks, and updated venv creation/install flow to compute, pass, and persist the deps hash in pio-idf-venv.json.

Changes

Cohort / File(s) Summary
ESP-IDF Python Dependencies & Venv Invalidation
builder/frameworks/espidf.py
Added _get_python_deps() to centralize Python dependency specs; refactored install_python_deps() to accept deps; updated _is_venv_outdated() to take deps and compare a stable deps_hash (sha256 over sorted JSON); compute deps once during venv creation, pass into checks and install, and persist deps_hash in pio-idf-venv.json alongside version metadata; emit warning when deps change.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hop through deps both new and old,
I hash their names and keep them bold,
No stale venvs hiding in the glen,
I store their fingerprint, snug as a den,
A happy build — hop on again! 🥕

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is vague and uses non-descriptive technical jargon ('hash deps for penv lib update') that doesn't clearly convey the main change to a teammate scanning history. Use a clearer title that describes the main change, such as 'Add dependency hash tracking to ESP-IDF venv freshness check' or similar.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch upd_idf_comp

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@Jason2866
Copy link
Copy Markdown
Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 30, 2026

✅ Actions performed

Full review triggered.

Copy link
Copy Markdown

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

🧹 Nitpick comments (1)
builder/frameworks/espidf.py (1)

2111-2135: Optional: pass resolved deps into install_python_deps to keep a single in-run source of truth.

Not a bug, but this avoids re-fetching deps and guarantees the hashed deps and installed deps are identical within the same execution.

♻️ Proposed refactor
-def install_python_deps():
+def install_python_deps(deps=None):
     UV_EXE = _get_uv_exe()
+    deps = deps or _get_python_deps()
@@
-    deps = _get_python_deps()
-
     python_exe_path = get_python_exe()
@@
-        install_python_deps()
+        install_python_deps(deps)

Also applies to: 2253-2260

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@builder/frameworks/espidf.py` around lines 2111 - 2135, Change
install_python_deps to accept an optional parameter (e.g., resolved_deps=None)
and use that instead of always calling _get_python_deps(); if resolved_deps is
None then call _get_python_deps() as a fallback. Update references inside
install_python_deps (including the hashed deps usage and validation against
_get_installed_uv_packages) to read from the resolved_deps variable. Apply the
same optional-parameter pattern to the other similar helper/function block
around the later occurrence (the block using _get_python_deps at the other
location) so both places can reuse a single in-run source of truth when
provided. Ensure callers that rely on current behavior continue to work by
defaulting the parameter to None.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@builder/frameworks/espidf.py`:
- Around line 2111-2135: Change install_python_deps to accept an optional
parameter (e.g., resolved_deps=None) and use that instead of always calling
_get_python_deps(); if resolved_deps is None then call _get_python_deps() as a
fallback. Update references inside install_python_deps (including the hashed
deps usage and validation against _get_installed_uv_packages) to read from the
resolved_deps variable. Apply the same optional-parameter pattern to the other
similar helper/function block around the later occurrence (the block using
_get_python_deps at the other location) so both places can reuse a single in-run
source of truth when provided. Ensure callers that rely on current behavior
continue to work by defaulting the parameter to None.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e5f10205-e7b3-445c-a907-bba1c7bbf3bc

📥 Commits

Reviewing files that changed from the base of the PR and between b800765 and dd1b878.

📒 Files selected for processing (1)
  • builder/frameworks/espidf.py

@Jason2866
Copy link
Copy Markdown
Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 30, 2026

✅ Actions performed

Full review triggered.

@Jason2866 Jason2866 merged commit 886323f into develop Mar 30, 2026
1 check passed
@Jason2866 Jason2866 deleted the upd_idf_comp branch March 30, 2026 11:00
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