Skip to content

fix: run ui-web page assembly on the project's pinned Python - #599

Merged
gloryfromca merged 2 commits into
EverMind-AI:mainfrom
insuffer:fix/build_ui_uv_python
Sep 23, 2026
Merged

gloryfromca merged 2 commits into
EverMind-AI:mainfrom
insuffer:fix/build_ui_uv_python

Conversation

@insuffer

Copy link
Copy Markdown

What

make build-ui assembled the served page with a bare python3, which
resolves to whatever interpreter is first on PATH. On a stock macOS
(no Command Line Tools ahead of /usr/bin/python3 = 3.9.6) the
documented self-hosting recipe make install-deps && make build-ui
died after the vite build had already succeeded:

File "ui-web/build.py", line 198, in main
    (dist / "index.html").write_text(out, encoding="utf-8", newline="")
TypeError: write_text() got an unexpected keyword argument 'newline'

Path.write_text(newline=...) exists from Python 3.10, while pyproject
requires-python is >=3.12 and every other Makefile target already
runs its Python through uv. build-ui was the one caller that bypassed
the pinned interpreter.

Change

One line in the Makefile: run the script through
uv run --frozen --python $(PYTHON_VERSION) python ui-web/build.py,
the same form install.sh already uses for this script (and already
documents the rationale for). No source, test, or dependency changes.

ui-web/build.py itself is untouched: its newline="" write needs
3.10+, but that half of the fix sits under the ui-web freeze, so this PR
takes the Makefile half only, as the issue suggests.

CI keeps its bare python3 (the ubuntu runners provide a working one
through setup-python / the runner image); this PR changes the documented
local path only.

Verification

Reproduced the failure with Python 3.9.13 (the stock-macOS analogue):

$ python3.9 ui-web/build.py
TypeError: write_text() got an unexpected keyword argument 'newline'
(exit 1)

Then ran the changed target's commands in order, on Windows with
uv 0.12.17 and Python 3.12.7:

npm ci --prefix ui-web
npm run --prefix ui-web build
uv run --frozen --python 3.12 python ui-web/build.py    -> exit 0
-> built dist/index.html (1,496,450 bytes)

Artifact checks:

sha256 ui-web/dist/index.html = a1068871929266cfe746b5f321eb7faed2158785c8b19d4984783099b4c23181
  (byte-identical to the pre-change output on 3.12)
node ui-web/scripts/check-page.mjs             -> OK (3 scripts parse)
node ui-web/scripts/count-shared-globals.mjs   -> OK
node ui-web/scripts/check-css.mjs              -> OK
node ui-web/scripts/check-class-namespace.mjs  -> OK
dist/index.html carries 0 CR bytes (LF-only artifact)

Repo gates on this commit:

scripts/check_source_language.py HEAD~1..HEAD  -> pass
scripts/check_commit_messages.py HEAD~1..HEAD  -> pass

Based on main at 87f3928.

Closes #526

AI disclosure: this PR was drafted with AI assistance (ZCode agent,
model step-5-preview); the reproduction, commands, and results above
were produced by it. The diff is one line; please review before merging.

build-ui assembled the served page with a bare `python3`, which resolves
to whatever interpreter is first on PATH. On a stock macOS that is 3.9,
where Path.write_text(newline=...) does not exist, so the documented
`make build-ui` recipe died with a TypeError at ui-web/build.py line 198
after the vite build had already succeeded.

pyproject requires-python is >=3.12 and every other Makefile target
already runs its Python through uv; build-ui was the one caller that
bypassed the pinned interpreter. Run the script through
`uv run --frozen --python $(PYTHON_VERSION)`, matching install.sh, which
already documents why the page assembly takes its Python from uv.

Verified: reproduced the TypeError with Python 3.9.13 (exit 1); with
uv + Python 3.12.7 the exact command builds dist/index.html, the
artifact is byte-identical to the pre-change output on 3.12 (sha256
a1068871929266cfe746b5f321eb7faed2158785c8b19d4984783099b4c23181),
check-page.mjs and the other page gates pass, and the artifact carries
zero CR bytes.

ui-web/build.py itself is untouched: its newline="" write needs 3.10+,
but that half of the fix sits under the ui-web freeze and stays for
maintainers.
@insuffer

Copy link
Copy Markdown
Author

Hi — first contribution here: a one-line fix so the ui-web page assembly runs on the project's pinned Python instead of whatever is first on PATH. The Commit lint, CI, and Docs workflow runs are waiting for fork approval — could a maintainer approve them so the checks can run? Thanks!

@gloryfromca
gloryfromca merged commit 47398f4 into EverMind-AI:main Sep 23, 2026
5 checks passed
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.

fix(ui-web): build.py needs Python 3.10+ for one keyword, so the documented from-source build fails on a stock macOS python3

3 participants