Skip to content

Implement pip bootstrap in Python virtual environment - #14767

Closed
bytesByHarsh wants to merge 1 commit into
mavlink:masterfrom
bytesByHarsh:uv_support
Closed

Implement pip bootstrap in Python virtual environment#14767
bytesByHarsh wants to merge 1 commit into
mavlink:masterfrom
bytesByHarsh:uv_support

Conversation

@bytesByHarsh

Copy link
Copy Markdown
Contributor

Added a function to ensure pip is installed in a Python virtual environment

Primarily if the virtual environment is managed via uv.

Added function to ensure pip is installed in Python virtual environment
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 32.65%. Comparing base (f29efd3) to head (8395d85).
⚠️ Report is 241 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14767      +/-   ##
==========================================
+ Coverage   25.47%   32.65%   +7.18%     
==========================================
  Files         769      784      +15     
  Lines       65912    67564    +1652     
  Branches    30495    31292     +797     
==========================================
+ Hits        16788    22066    +5278     
+ Misses      37285    30620    -6665     
- Partials    11839    14878    +3039     
Flag Coverage Δ
unittests 32.65% <ø> (+7.18%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 477 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9d2f173...8395d85. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Build Results

Platform Status

Platform Status Details
Linux Passed View
Windows Passed View
MacOS Passed View
Android Passed View

All builds passed.

Pre-commit

Check Status Details
pre-commit Failed (non-blocking) View

Pre-commit hooks: 0 passed, 0 failed, 0 skipped.

Test Results

linux-coverage-integration: 37 passed, 0 skipped
linux-coverage-unit: 117 passed, 0 skipped
linux-sanitizers-integration: 20 passed, 0 skipped
linux-sanitizers-unit: 117 passed, 0 skipped
Total: 291 passed, 0 skipped

Code Coverage

Coverage Baseline Change
69.4% 69.4% -0.0%

Artifact Sizes

Artifact Size Δ from master
QGroundControl 221.79 MB -4.40 MB (decrease)
QGroundControl-aarch64 179.33 MB -0.00 MB (decrease)
QGroundControl-installer-AMD64 137.83 MB -0.43 MB (decrease)
QGroundControl-installer-AMD64-ARM64 80.37 MB -0.19 MB (decrease)
QGroundControl-installer-ARM64 109.12 MB +0.01 MB (increase)
QGroundControl-linux 87.04 MB -78.73 MB (decrease)
QGroundControl-mac 87.03 MB No change
QGroundControl-x86_64 191.57 MB -0.00 MB (decrease)
Total size decreased by 83.74 MB

Updated: 2026-08-03 10:47:47 UTC • Commit: 8395d85 • Triggered by: Android

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds pip bootstrapping to QGroundControl’s CMake-managed Python environment for MAVLink generation.

Changes:

  • Detects missing pip and installs it through ensurepip.
  • Adds failure diagnostics and applies the check to existing venv paths.
Suppressed comments (1)

cmake/modules/PythonVenv.cmake:114

  • For a stale existing venv without pip, this sync runs first. If uv is unavailable, install_python.py immediately invokes python -m pip and the configure fails before _qgc_ensure_pip can repair the environment. Bootstrap before the sync as well, while retaining the post-sync check in case syncing removes pip.
    _qgc_ensure_pip("${_qgc_venv_python}")

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 70 to +71
_qgc_sync_venv_if_stale("${_qgc_venv_python}")
_qgc_ensure_pip("${_qgc_venv_python}")
@DonLakeFlyer

DonLakeFlyer commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

I'm not sure I want some sort of hybrid support for an externally created environment. I'd rather just have a clear failure when it doesn't work. To me it just creates additional maintenance surface area.

@DonLakeFlyer

Copy link
Copy Markdown
Contributor

Thanks @bytesByHarsh for identifying this problem — the failure mode is real and worth fixing.

We've decided to take a different approach in #14784: since QGC's own tooling always creates .venv with pip seeded (uv venv --seed), a pip-less venv can only come from outside QGC's bootstrap. Rather than having CMake silently install pip into a venv it didn't create, configure now fails fast with a clear, actionable message. Closing this in favor of that replacement.

If you have strong disagreement with this direction, please comment here on why — happy to discuss.

@DonLakeFlyer

Copy link
Copy Markdown
Contributor

In reality the idea what QGC would automatically fix an environment which it didn't create itself doesn't seem like the greatest idea.

DonLakeFlyer added a commit to DonLakeFlyer/qgroundcontrol that referenced this pull request Aug 8, 2026
A hand-rolled 'uv venv' (without --seed) creates a pip-less venv. QGC
reuses it and configure later dies inside the mavlink CPM build with an
opaque 'Python pip not found' error. Detect the missing pip up front and
fail with instructions instead.

Replaces mavlink#14767, which auto-bootstrapped pip via ensurepip; a read-only
diagnostic avoids CMake silently mutating a user-managed venv.
DonLakeFlyer added a commit that referenced this pull request Aug 8, 2026
A hand-rolled 'uv venv' (without --seed) creates a pip-less venv. QGC
reuses it and configure later dies inside the mavlink CPM build with an
opaque 'Python pip not found' error. Detect the missing pip up front and
fail with instructions instead.

Replaces #14767, which auto-bootstrapped pip via ensurepip; a read-only
diagnostic avoids CMake silently mutating a user-managed venv.
DonLakeFlyer added a commit that referenced this pull request Aug 9, 2026
A hand-rolled 'uv venv' (without --seed) creates a pip-less venv. QGC
reuses it and configure later dies inside the mavlink CPM build with an
opaque 'Python pip not found' error. Detect the missing pip up front and
fail with instructions instead.

Replaces #14767, which auto-bootstrapped pip via ensurepip; a read-only
diagnostic avoids CMake silently mutating a user-managed venv.
@bytesByHarsh
bytesByHarsh deleted the uv_support branch August 10, 2026 09:48
@bytesByHarsh

Copy link
Copy Markdown
Contributor Author

Yes, agreed! #14784 is better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants