44
55# Managed Python
66
7- Bootstrap ` uv ` and a managed Python runtime to a configurable prefix. Provides a predictable Python environment for Claude Code customisation scripts and other tools .
7+ Bootstrap ` uv ` and a managed Python runtime to a configurable prefix. Provides a predictable, isolated Python environment for scripts and tools across Linux, macOS, and Windows .
88
99## How it works
1010
@@ -39,40 +39,42 @@ Expand-Archive managed-python.zip
3939
4040``` bash
4141./install.sh \
42- --prefix ~ /.claude /redmatter/python \
42+ --prefix ~ /.local /redmatter/python \
4343 --min-python 3.10 \
4444 --uv-env REDMATTER_UV \
4545 --python-env REDMATTER_PYTHON
4646
47- source ~ /.claude /redmatter/python/env.sh
47+ source ~ /.local /redmatter/python/env.sh
4848```
4949
5050** Windows (PowerShell):**
5151
5252``` powershell
5353.\install.ps1 `
54- -Prefix "$env:USERPROFILE\.claude \redmatter\python" `
54+ -Prefix "$env:USERPROFILE\.local \redmatter\python" `
5555 -MinPython "3.10" `
5656 -UvEnv "REDMATTER_UV" `
5757 -PythonEnv "REDMATTER_PYTHON"
5858
59- . "$env:USERPROFILE\.claude \redmatter\python\env.ps1"
59+ . "$env:USERPROFILE\.local \redmatter\python\env.ps1"
6060```
6161
6262> [ !NOTE]
6363> If your system blocks PowerShell scripts (` running scripts is disabled on this system ` ), use
6464> ` install.bat ` to install, then load the environment using one of the options below depending on your shell.
6565>
6666> ** PowerShell** — evaluate ` env.ps1 ` as a string (bypasses script execution policy):
67+ >
6768> ``` powershell
68- > install.bat -Prefix "$env:USERPROFILE\.claude \redmatter\python" -MinPython "3.10" -UvEnv "REDMATTER_UV" -PythonEnv "REDMATTER_PYTHON"
69- > Invoke-Expression (Get-Content "$env:USERPROFILE\.claude \redmatter\python\env.ps1" -Raw)
69+ > install.bat -Prefix "$env:USERPROFILE\.local \redmatter\python" -MinPython "3.10" -UvEnv "REDMATTER_UV" -PythonEnv "REDMATTER_PYTHON"
70+ > Invoke-Expression (Get-Content "$env:USERPROFILE\.local \redmatter\python\env.ps1" -Raw)
7071> ```
7172>
7273> **CMD** — use `call` to load `env.bat` into the current session:
74+ >
7375> ```bat
74- > install.bat -Prefix "%USERPROFILE%\.claude \redmatter\python" -MinPython "3.10" -UvEnv "REDMATTER_UV" -PythonEnv "REDMATTER_PYTHON"
75- > call "%USERPROFILE%\.claude \redmatter\python\env.bat"
76+ > install.bat -Prefix "%USERPROFILE%\.local \redmatter\python" -MinPython "3.10" -UvEnv "REDMATTER_UV" -PythonEnv "REDMATTER_PYTHON"
77+ > call "%USERPROFILE%\.local \redmatter\python\env.bat"
7678> ```
7779>
7880> To remove the restriction permanently, run in an elevated PowerShell prompt:
@@ -82,13 +84,13 @@ source ~/.claude/redmatter/python/env.sh
8284
8385```bash
8486./install.sh \
85- --prefix ~/.claude /redmatter/python \
87+ --prefix ~/.local /redmatter/python \
8688 --min-python 3.10 \
8789 --uv-env REDMATTER_UV \
8890 --python-env REDMATTER_PYTHON \
8991 --quiet
9092
91- source ~/.claude /redmatter/python/env.sh
93+ source ~/.local /redmatter/python/env.sh
9294"$REDMATTER_PYTHON" /path/to/script.py
9395```
9496
@@ -110,7 +112,7 @@ source ~/.claude/redmatter/python/env.sh
110112" $REDMATTER_PYTHON " /path/to/script.py
111113
112114# Run a script with dependencies (pyproject.toml in app dir)
113- " $REDMATTER_UV " run --project ~ /.claude/my- app my-script.py
115+ " $REDMATTER_UV " run --project /path/to/ app my-script.py
114116
115117# Install a package into the shared venv (use sparingly)
116118" $REDMATTER_UV " pip install --python " $REDMATTER_PYTHON " some-package
@@ -149,7 +151,7 @@ version = "1.0.0"
149151uv_version = " 0.10.6"
150152
151153[install ]
152- prefix = " /home/user/.claude /redmatter/python"
154+ prefix = " /home/user/.local /redmatter/python"
153155min_python = " 3.10"
154156uv_env = " REDMATTER_UV"
155157python_env = " REDMATTER_PYTHON"
@@ -159,13 +161,15 @@ shell_profile = false
159161## Idempotency
160162
161163Re-running ` install.sh ` with the same args is always safe:
164+
162165- uv download skipped if pinned version already installed
163166- venv creation skipped if ` venv/bin/python ` already works
164167- All generated files (` env.sh ` , ` env.ps1 ` , ` bin/ ` , ` distro.toml ` ) are always regenerated (cheap, ensures correctness)
165168
166169## Versioning
167170
168171` distro.toml ` ` version ` tracks the managed-python configuration itself:
172+
169173- ** Patch** (1.0.x) — no-op fixes
170174- ** Minor** (1.x.0) — new flags, new generated files, non-breaking additions
171175- ** Major** (x.0.0) — breaking layout change; delete prefix dir and reinstall
0 commit comments