Build the venv from the distribution's Python instead of uv
The backend now targets 3.11, which is what Raspberry Pi OS ships, so there is nothing left for uv to solve. It was only ever there to obtain a 3.13 the distro does not have, and it brought its own problems: the download had to be matched to the Pi's 32-bit userland by hand, and no armv7 wheel exists for a 3.13 ABI, so Pillow was compiled from source and needed image headers installed alongside. apt for the interpreter, python3 -m venv, pip for the rest - and piwheels then supplies prebuilt armhf wheels for the native dependencies. A venv cannot be migrated between interpreters (it holds absolute paths into the one that made it), and `creates:` would keep the old one forever, so check what built it and rebuild when it does not match the current python3. That is what carries a device off the uv-installed 3.13 without hand-holding. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,9 +5,12 @@ Deploys the MusicMouse backend (`python-backend/`) and its built web frontend.
|
||||
- Checks out `musicmouse_version` from `pi_musicmouse_repo` to `/opt/musicmouse`, then
|
||||
**fails early** if that checkout has no `python-backend/pyproject.toml` - see
|
||||
"Which version" below.
|
||||
- Installs a pinned `uv` release and uses it to create `/opt/musicmouse/.venv` with
|
||||
Python `pi_musicmouse_python_version` (the backend needs 3.12+ for PEP 695 syntax;
|
||||
Raspbian Bookworm's apt python3 is only 3.11) and `pip install` the backend into it.
|
||||
- Creates `/opt/musicmouse/.venv` from the distribution's own `python3` and pip-installs
|
||||
the backend into it. The backend targets the Python that Raspberry Pi OS ships (3.11
|
||||
on Bookworm) precisely so this step stays boring: apt and piwheels have prebuilt
|
||||
armhf wheels for the native dependencies, so nothing has to be compiled on the Pi.
|
||||
If the venv was built by a different interpreter than the current `python3`, it is
|
||||
thrown away and rebuilt.
|
||||
- Builds the frontend (`web/`) on the *control machine* (delegated to `localhost`, not
|
||||
the Pi - no Node/npm is installed on the Pi) and syncs `web/dist` over.
|
||||
- Installs `/media/musicmouse/config.yml` from `files/config-<inventory_hostname>.yml`
|
||||
|
||||
Reference in New Issue
Block a user