Embed standalone Python in CLIP instead of relocatable venv#30
Merged
Embed standalone Python in CLIP instead of relocatable venv#30
Conversation
Replace `uv venv --relocatable` with copying the full standalone Python (python-build-standalone via uv) into CLIP directories. This eliminates the dependency on the base Python installation path via pyvenv.cfg, making CLIPs truly portable to target machines without Python installed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Run a quick check that the copied python.exe actually works before proceeding with pip install. Gives a clear error if the copy is broken (e.g. due to antivirus interference or stale state). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Python 3.14+ can fail with "failed to locate pyvenv.cfg" (exit 106) when running a copied standalone interpreter. Creating a python314._pth file puts Python in isolated path mode, bypassing venv detection entirely while correctly setting up stdlib paths. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…bility Python 3.14+ requires pyvenv.cfg to exist (exit 106 without it). The ._pth file uses isolated path mode to skip site.py, avoiding RuntimeWarnings about unexpected sys.prefix. The ._pth file now lists Lib\site-packages explicitly instead of using import site. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The pyvenv.cfg needs home= to avoid warnings from Python's path initialization. The ._pth file (without import site) prevents site.py RuntimeWarnings about unexpected sys.prefix. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Parameterize CLIP and uv_util tests across all supported Python versions via SUPPORTED_PYTHON_VERSIONS constant, and add CI matrix for 3.11/3.12/3.13. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pass Path(self.project_dir, self.dist_dir) instead of the bare relative self.dist_dir so uv build writes the wheel and the subsequent glob both resolve to the same absolute path under the target project directory. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Generate make_venv.bat on Windows, make_venv.sh (chmod 755) on Linux/Mac.
Linux script uses python{major.minor} and venv/bin/ paths.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
uv venv --relocatablewith copying the full standalone Python (python-build-standalone via uv) directly into CLIP directoriespyvenv.cfg, making CLIPs truly portable to target machines without Python installedpython.exenow lives at the CLIP root (notScripts/python.exe), matching the python-build-standalone layoutChanges
pyship/uv_util.py: Addedcopy_standalone_python()(copies full Python + removesEXTERNALLY-MANAGEDmarker), addedsystemflag touv_pip_install(), removeduv_venv_create()pyship/clip.py: Usescopy_standalone_python()instead ofuv_venv_create(), targetspython.exeat clip rootpyship/launcher_stub.py: C# template updated to findpython.exeat clip rootpyship/launcher/launcher.py: Standalone launcher updated for rootpython.exepyship/create_launcher.py: Diagnostic.batupdated for rootpython.exeTest plan
test_copy_standalone_python— verifies standalone Python copy, nopyvenv.cfg,EXTERNALLY-MANAGEDremovedtest_uv_pip_install— installs package into standalone Python with--systemtest_create_clip— CLIP haspython.exeat roottest_launcher_stub_gui_exe_writes_log— C# stub findspython.exeat clip roottest_pyship/test_check_app_output— full integration (24 passed, 1 skipped)🤖 Generated with Claude Code