From 5c05e3c5bdabc9864d4923c41bf0d057d7768b0f Mon Sep 17 00:00:00 2001 From: Adam Zsarnoczay <33822153+zsarnoczay@users.noreply.github.com> Date: Mon, 13 Jul 2026 22:35:49 -0700 Subject: [PATCH] fix(explorer): make `uv sync` install the web deps for Streamlit Cloud Streamlit Community Cloud installs deps with `uv sync` when a uv.lock is present (it ignores requirements.txt), and `uv sync` pulls the base package + default groups but NOT optional-dependency extras -- so the deployed app got the core library without Streamlit/scipy/etc. and crashed on `import scipy`. Add a `deploy` default dependency-group referencing the `explorer` extra (single source of truth) so a plain `uv sync` installs the web stack. Dependency groups are dev-time only, so `pip install simcenter-dlml` stays lightweight (verified: scipy/streamlit appear only under extras in the wheel metadata). --- pyproject.toml | 12 ++++++++++++ requirements.txt | 17 ----------------- uv.lock | 8 ++++++++ 3 files changed, 20 insertions(+), 17 deletions(-) delete mode 100644 requirements.txt diff --git a/pyproject.toml b/pyproject.toml index a47a3783..ad682d1b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -96,6 +96,18 @@ Homepage = "https://github.com/NHERI-SimCenter/DamageAndLossModelLibrary" Documentation = "https://nheri-simcenter.github.io/DamageAndLossModelLibrary/" Repository = "https://github.com/NHERI-SimCenter/DamageAndLossModelLibrary" +# Streamlit Community Cloud installs dependencies with `uv sync` when a uv.lock +# is present, and `uv sync` installs the base package plus DEFAULT GROUPS but NOT +# optional-dependency extras. Expose the web deps as a default group that simply +# references the `explorer` extra (single source of truth), so the deployed app +# gets everything it needs. This does not affect the published wheel: dependency +# groups are dev-time only, so `pip install simcenter-dlml` stays lightweight. +[dependency-groups] +deploy = ["simcenter-dlml[explorer]"] + +[tool.uv] +default-groups = ["deploy"] + [tool.hatch.build.targets.wheel] packages = ["src/dlml"] exclude = [ diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 68e1ef72..00000000 --- a/requirements.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Streamlit Community Cloud installs this file (point the app's main file at -# src/dlml/web/app.py). We install the dlml package EDITABLE (`-e .`) so the -# deployed app tracks the repo checkout — a UI change is picked up by -# redeploying the branch, with no PyPI release needed — and `-e .` also pulls -# the core deps (pandas / numpy / jsonschema). -# -# The web (`explorer`) dependencies are listed explicitly below rather than via -# `.[explorer]`: on Cloud, pip installed the package but did NOT pull the extras -# requested against the local path, so the app crashed on `import scipy`. -# Keep this list in sync with the `explorer` extra in pyproject.toml. -# (`qdrant-client[fastembed]` pulls onnxruntime, so this targets Python >=3.10.) --e . -streamlit>=1.48.0 -plotly -colorlover -scipy -qdrant-client[fastembed]>=1.14.0 diff --git a/uv.lock b/uv.lock index 192f56a6..095c71be 100644 --- a/uv.lock +++ b/uv.lock @@ -5027,6 +5027,11 @@ test = [ { name = "pytest-cov" }, ] +[package.dev-dependencies] +deploy = [ + { name = "simcenter-dlml", extra = ["explorer"] }, +] + [package.metadata] requires-dist = [ { name = "codespell", marker = "extra == 'lint'" }, @@ -5056,6 +5061,9 @@ requires-dist = [ ] provides-extras = ["explorer", "test", "lint", "doc", "dev"] +[package.metadata.requires-dev] +deploy = [{ name = "simcenter-dlml", extras = ["explorer"] }] + [[package]] name = "six" version = "1.17.0"