bcc-ui-theme / docs /ADOPTION.md
Annie Voigt
Claude Opus 5.5
docs: 0.1.0 released at 6a43c17 β€” real pin line in every repin diff; genomics applied on dev
6e4f0da
|
Raw History Blame Contribute Delete
8.69 kB
# Adopting bcc-ui-theme
Status as of 2026-10-15: **0.1.0 is released** β€” HF commit `6a43c17`
(`anne-voigt/bcc-ui-theme`, tag `v0.1.0`), wheel sha256 `f8414b3d…b36d2c`.
`pdac-genomics-agent` has adopted it on its **dev Space only** for Annie's look
(Annie, 2026-10-15 decision queue, D4). No other consumer is re-pinned; each
diff in `docs/repin/` carries the real pin line.
---
## 1. Order of work
1. **Release the wheel** β€” `scripts/release.sh`, which prints the pin line.
2. **Re-pin one consumer** and deploy it to its *dev* Space only.
3. Look at it. Adopt the rest once the look is agreed.
4. `pdac-genomics-agent` goes **first** (Annie, 2026-10-15): its dev Space is
private and admin-only, so the look can be judged where no user sees it. It
has no other claim to the slot (Β§3).
5. `DecoupleRpy_Agent` should be **last**, because it is the only app whose
appearance actually changes (Β§4).
6. `lit-agent` adopts **now, on gradio 5.50**, via `Blocks(theme=…, css=…)` β€”
it does not wait for its gradio 6 migration (Β§5).
## 2. The call site β€” version-dependent, and not silent
**Corrected 2026-09-22.** This section previously said the constructor form
"silently disappears" on 6.x. It does not. gradio 6.0 *deprecated* `theme`/`css`
on `Blocks()`; `__init__` stashes the value in `_deprecated_css` /
`_deprecated_theme`, warns, and `launch()` back-fills it β€”
```python
css = css if css is not None else self._deprecated_css # gradio 6.18 blocks.py:2728
```
β€” so the stylesheet is still served. Measured against both pinned versions:
| | `gr.Blocks(...)` | `demo.launch(...)` |
|---|---|---|
| gradio 5.50 | accepted, warns | `TypeError` β€” declares neither, no `**kwargs` |
| gradio 6.18 | accepted, warns, **and served** | accepted |
`Blocks()` is the one form that works on both majors; `launch()` is 6.x-only.
Use `launch()` on 6.x anyway β€” forward path, one less boot warning β€” but that is
maintenance, not a fix for a broken page. Nothing here can lose a stylesheet
without also raising or warning.
```python
# gradio 6.x β€” the five Space apps
with gr.Blocks(title="…") as demo:
...
demo.launch(theme=theme(), css=CSS)
# gradio 5.x β€” lit-agent, until it migrates
with gr.Blocks(title="…", theme=theme(), css=CSS) as demo:
...
demo.launch()
```
### Verifying an adoption
Accepting the argument is not the same as serving the stylesheet, and the
`Blocks` object is not evidence either way β€” under the constructor form
`demo.css` and `demo.theme` both read `None` while the page is styled. Check the
served page:
```bash
curl -s https://<space>.hf.space/ | grep -c 'bcc-caveat {'
```
⚠ **Grep a CSS declaration, never a bare class name.** The moment an app sets
`elem_classes=["bcc-caveat"]` β€” the whole point of adopting the class β€” that
string lands in the gradio config JSON on every build, styled or not, and a
`grep -c 'bcc-caveat'` returns non-zero regardless. That is exactly how the
genomics `vs-raw-json` probe gave a false pass in the 2026-09-22 inventory.
Match something only the stylesheet can emit (a selector with its brace, or a
declaration such as `max-height: 460px`). Copy the selector exactly as
`_css.py` writes it β€” `.bcc-caveat {`, with the space. The 2026-09-22 form of
this command (`'bcc-caveat{'`) returned 0 on a page that was serving the
stylesheet (genomics, 2026-10-15). On gradio 6 the stylesheet arrives in the
page's config JSON, not a static `<style>` tag, and on a private Space a bare
`curl` sees only the sign-in page β€” use that repo's authenticated smoke.
## 3. pdac-genomics-agent
Its app-specific `_CSS` (the `#vs-raw-json` height cap) has been served on every
deploy; it moved from `Blocks()` to `launch()` in `7bf96b7` / `78cef2d` as a
deprecation cleanup with no behaviour change. Adoption therefore fixes nothing
there: it appends `_CSS` to the shared stylesheet, `css=CSS + _CSS`, and adds
`theme=theme()` at the same `launch()` call. The cap names an `elem_id` that app
owns, so it stays out of the shared stylesheet.
The episode's one durable lesson is in Β§2: judge an adoption from the served
page, never from the `Blocks` object.
## 4. DecoupleRpy_Agent is the one visible change
It is the only app in the fleet with a theme today: `gr.themes.Monochrome` with
Google-hosted Inter and JetBrains Mono, plus eleven lines of CSS hiding the
gradio footer, plus `demo.load(js=…)` that strips the `dark` class and rewrites
the URL to `?__theme=light`.
Adopting the shared theme therefore *changes how that app looks* β€” every other
adoption is a move from stock gradio and is close to purely additive. Review it
with Annie before merging.
Two parts to retire deliberately:
- **The footer CSS** can be kept verbatim: `from bcc_ui_theme import FOOTER_CSS`
and concatenate, `css=CSS + FOOTER_CSS`. It is out of the shared stylesheet so
the choice stays explicit, not inherited.
- **The forced-light-mode JS should be deleted, not ported.** It overrides the
user's own theme choice on that one app; with this theme the app renders
correctly in both modes, so there is nothing left for it to fix. The same
`demo.load(js=…)` also hides gradio branding β€” if that is still wanted, keep
only those lines and drop the `__theme` rewrite.
## 5. lit-agent: adopt now on 5.50, migrate later (Annie's call, 2026-09-25)
lit-agent pins `gradio>=5,<6` (5.50.0); the other five pin 6.18.0. It adopts on
5.50 like everyone else β€” `Blocks(theme=…, css=…)` at its existing
`gr.Blocks(title=…)` call site (`ui.py`) β€” and that line keeps working unchanged
after a later gradio-6 migration. Nothing about the theme waits on the migration.
**This reverses the 2026-09-22 ordering, which said migrate first.** That
sequence rested on the premise that no call site works on both majors. The
premise was wrong (Β§2): `Blocks(theme=…, css=…)` is accepted on 5.50 *and* 6.18,
proven by `make test-both`. When the constraint fell away the ordering was left
resting on two arguments that do not actually support it:
- *One call site across the whole fleet instead of two.* As of 2026-09-25 **no
Space has adopted at all** β€” there is no `theme=` call site anywhere in the
six repos β€” so there is no uniformity to preserve, only one to create later.
- *gradio 5.50 emits a Google Fonts `preconnect` on every page load; 6.18
dropped it.* True and worth having, but it is a reason to **migrate**, not a
reason to migrate **first**. It arrives whenever the migration happens.
Both are reasons to do the migration. Neither is a reason to hold the shared
look hostage to it β€” particularly here, where the migration touches the Space
that runs the Monday digest to OHSU PIs and needs the `lit-agent-monday-check`
rehearsal, while the theme cannot reach the email at all: lit-agent's digest is
inline-styled HTML built in `pipeline/digest/`, and `ui.py` imports one text
helper from it (`provenance_sentence`) and nothing else.
Not chosen: having all six adopt via `Blocks()` for immediate uniformity. That
would move five healthy 6.18 call sites onto an API gradio has already
deprecated, buying cosmetic consistency at the price of a six-way rewrite when
it is removed. The five adopt via `launch()`; lit-agent uses `Blocks()` until it
migrates, and may harmonise afterwards as optional tidying, not a required fix.
Adoption everywhere still waits on Annie approving the look. The migration
itself is not this package's work.
## 6. Re-pin diffs
Per-consumer diffs are in `docs/repin/`. Two different mechanics, because the
fleet is not uniform:
| repo | mechanism | python |
|---|---|---|
| pdac-analysis-orchestrator | `requirements.in` β†’ `uv pip compile` | 3.13 |
| pdac-subtype-agent | `requirements.in` β†’ `uv pip compile` | 3.11 |
| DecoupleRpy_Agent | `requirements.in` β†’ `uv pip compile` | 3.11 |
| pdac-genomics-agent | `requirements.in` β†’ `uv pip compile` (since 2026-09-30) | 3.11 |
| pdac-spatial-agent | `requirements.in` β†’ `uv pip compile` | 3.12 |
| lit-agent | hand-pinned `requirements.txt` | β€” |
Rechecked 2026-10-15: every compiled repo's header line in `requirements.txt` is
the exact command, `--python-platform linux` included β€” copy it from there rather
than from this table. A single scripted re-pin across the fleet would still
mangle lit-agent: it has no `requirements.in`, so a compile step would either
fail or overwrite a hand-curated file. Edit that one by hand.
**The `--python-version` matters.** Compiling the orchestrator's list under 3.11
(or a specialist's under 3.13) resolves a different dependency set and produces
a `requirements.txt` that does not match the Space's runtime.