From 2fe6e2bd002eccc338cc7c453fc77b8a91d525e2 Mon Sep 17 00:00:00 2001 From: Andre Date: Wed, 17 Jun 2026 23:21:06 +0200 Subject: [PATCH] fix(pyproject): declare runtime deps + build-system so `pip install -e .` works MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The README's `pip install -e .` fails two ways on a clean machine: 1. No `[build-system]` / package-discovery config, so the editable build aborts with a setuptools "package discovery" error. 2. Even built, the dashboard can't run: `sensor_head.dashboard` is a FastAPI app served by uvicorn, and the BME688 fallback imports `adafruit_bme680`, but none of fastapi / uvicorn / adafruit-blinka / adafruit-circuitpython-bme680 were declared — so a fresh install crashes on first import (`No module named 'fastapi'` / `'board'`). Also: `bme68x` was a hard dependency, but it compiles against Bosch's proprietary license-gated BSEC2 SDK and isn't installable on a plain machine — which made the documented install impossible to complete anywhere without the SDK. Changes: - Add `[build-system]` (setuptools) + `[tool.setuptools.packages.find]`. - Declare the real runtime deps: fastapi, uvicorn, adafruit-blinka, adafruit-circuitpython-bme680. - Move `bme68x` to an optional `[bsec]` extra. environment.py already falls back to adafruit-circuitpython-bme680 (raw T/RH/P/gas, no IAQ) when BSEC2 is absent, so the base install is now functional everywhere; `pip install -e .[bsec]` opts into full IAQ where the SDK/egg is available. Verified: `pip install -e . --no-deps` now builds the editable wheel and `import sensor_head` succeeds. The full dependency set + dashboard were verified live on a Raspberry Pi 5 (no BSEC2: adafruit fallback serves BME688 T/RH/P/gas + MLX90640 thermal; with the BSEC2 egg dropped in: full IAQ/CO2eq/VOC). Co-Authored-By: Claude Opus 4.8 --- pyproject.toml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a5237c9..54c7ab9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,7 @@ +[build-system] +requires = ["setuptools>=64", "wheel"] +build-backend = "setuptools.build_meta" + [project] name = "sensor-head" version = "0.1.0" @@ -6,13 +10,29 @@ requires-python = ">=3.11" dependencies = [ "mcp>=1.26.0", + # Dashboard HTTP server (sensor_head.dashboard is a FastAPI app run by uvicorn) + "fastapi", + "uvicorn", "smbus2>=0.4.3", + # CircuitPython/Blinka stack for I2C sensor access (board/busio + drivers) + "adafruit-blinka", "adafruit-circuitpython-mlx90640", + # BME688 without BSEC2 — raw T/RH/P/gas fallback (environment.py uses this when + # the proprietary `bme68x` BSEC2 build is unavailable). Keeps the base install + # functional on any machine. + "adafruit-circuitpython-bme680", "adafruit-servokit", - "bme68x", "numpy", "pillow", ] [project.optional-dependencies] dev = ["pytest", "ruff"] +# Full BSEC2 air quality (IAQ / CO2-equivalent / VOC). `bme68x` compiles against +# Bosch's proprietary, license-gated BSEC2 SDK, so it is NOT installable on a plain +# machine — install it only where the SDK/egg is available. The dashboard degrades +# gracefully to adafruit-circuitpython-bme680 (raw values, no IAQ) when it's absent. +bsec = ["bme68x"] + +[tool.setuptools.packages.find] +include = ["sensor_head*"]