fix: decouple Python venv setup from npm install postinstall

The three Python services (PatientDataExtractorService, PaymentOCRService,
SeleniumService) provisioned their venvs via postinstall, chained into
root's own postinstall. A failure in any one of them aborted the whole
npm install, which could leave unrelated Node deps (e.g. Backend's sharp)
uninstalled — silently breaking the app with no indication why.

Renamed each service's postinstall to an explicit "setup" script, added a
root "npm run setup:python" to run all three, and documented it as its
own step in the README instead of an automatic install-time side effect.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ff
2026-07-31 10:49:06 -04:00
co-authored by Claude Sonnet 5
parent 55d798b45f
commit 9885a3d35b
6 changed files with 16 additions and 12 deletions
+8 -2
View File
@@ -212,9 +212,15 @@ npm install
### Step 11 — Install Python dependencies
Python dependencies are installed automatically by `npm install` (Step 10) via each service's `postinstall` script. Each service creates its own `.venv` virtual environment — no manual pip commands needed.
```sh
npm run setup:python
```
> This approach is required on Debian 13+ where system-wide pip installs are blocked (PEP 668).
This creates a `.venv` virtual environment inside each Python service (`PatientDataExtractorService`, `PaymentOCRService`, `SeleniumService`) and installs its `requirements.txt` into it — no manual pip commands needed.
> This venv approach is required on Debian 13+ where system-wide pip installs are blocked (PEP 668).
This is a separate, explicit step rather than an `npm install` `postinstall` hook on purpose: if Python/pip setup fails on a given machine (missing system Python, no network access, a pip resolution error), it won't also abort or corrupt the Node.js dependency install for the other apps. Re-run `npm run setup:python` any time you need to rebuild these virtual envs (e.g. after moving/renaming the project folder, since venvs bake in absolute paths).
### Step 12 — Set up environment variables