Skip to content

Embed standalone Python in CLIP instead of relocatable venv#30

Merged
jamesabel merged 15 commits intomainfrom
embed-standalone-python
Feb 20, 2026
Merged

Embed standalone Python in CLIP instead of relocatable venv#30
jamesabel merged 15 commits intomainfrom
embed-standalone-python

Conversation

@jamesabel
Copy link
Owner

Summary

  • Replace uv venv --relocatable with copying the full standalone Python (python-build-standalone via uv) directly 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
  • python.exe now lives at the CLIP root (not Scripts/python.exe), matching the python-build-standalone layout

Changes

  • pyship/uv_util.py: Added copy_standalone_python() (copies full Python + removes EXTERNALLY-MANAGED marker), added system flag to uv_pip_install(), removed uv_venv_create()
  • pyship/clip.py: Uses copy_standalone_python() instead of uv_venv_create(), targets python.exe at clip root
  • pyship/launcher_stub.py: C# template updated to find python.exe at clip root
  • pyship/launcher/launcher.py: Standalone launcher updated for root python.exe
  • pyship/create_launcher.py: Diagnostic .bat updated for root python.exe
  • Tests + docs: Updated to match new layout

Test plan

  • test_copy_standalone_python — verifies standalone Python copy, no pyvenv.cfg, EXTERNALLY-MANAGED removed
  • test_uv_pip_install — installs package into standalone Python with --system
  • test_create_clip — CLIP has python.exe at root
  • test_launcher_stub_gui_exe_writes_log — C# stub finds python.exe at clip root
  • test_pyship / test_check_app_output — full integration (24 passed, 1 skipped)

🤖 Generated with Claude Code

jamesabel and others added 15 commits February 14, 2026 11:16
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>
@jamesabel jamesabel merged commit ecec3a3 into main Feb 20, 2026
2 of 3 checks passed
@jamesabel jamesabel deleted the embed-standalone-python branch February 20, 2026 05:17
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