Skip to content

Commit 9d4d487

Browse files
authored
Merge pull request #12 from opensource-observer/styling-fixes
chore: document styling and apply some small fixes to insights notebooks
2 parents d3d4926 + 26a17c7 commit 9d4d487

5 files changed

Lines changed: 36 additions & 4 deletions

File tree

notebooks/claude.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,24 @@ Never pin a marimo version. The top of every notebook file must have:
3737

3838
```python
3939
__generated_with = "unknown"
40-
app = marimo.App(width="full")
40+
app = marimo.App(width="full", css_file="styles/root.css")
4141
```
4242

43+
The `css_file` path is relative to the notebook file. Use the correct variant:
44+
- Root notebooks (`notebooks/*.py`): `css_file="styles/root.css"`
45+
- Data notebooks (`notebooks/data/**/*.py`): `css_file="../../styles/data.css"`
46+
- Insight notebooks (`notebooks/insights/*.py`): `css_file="../styles/insights.css"`
47+
48+
CSS is built from `notebooks/styles/base.css` + variant partials by `scripts/build_css.py`. Run `uv run scripts/build_css.py` after editing any CSS source file.
49+
50+
### Filter ecosystem queries
51+
52+
When querying `oso.stg_opendevdata__ecosystems` and listing/ranking multiple ecosystems, always add:
53+
```sql
54+
WHERE e.is_crypto = 1 AND e.is_category = 0
55+
```
56+
This filters out ODD's internal category ecosystems. Not needed when filtering by a specific ecosystem name (e.g., `WHERE e.name = 'Ethereum'`).
57+
4358
### Use Trino SQL
4459
All queries run against a Trino data warehouse via pyoso. Write Trino-compatible SQL:
4560
- `DATE_TRUNC('month', dt)` not `DATE_TRUNC(dt, MONTH)`

notebooks/insights/defi-builder-journeys.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,8 @@ def transform_pipeline_composition(
13281328

13291329

13301330
@app.cell(hide_code=True)
1331-
def section_conclusion(mo):
1331+
def section_conclusion(mo, pipeline_by_eco):
1332+
# pipeline_by_eco dependency ensures this renders after all content cells
13321333
mo.accordion({
13331334
"Metrics & Definitions": mo.md("""
13341335
- Ecosystem Classification:

notebooks/insights/developer-lifecycle.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ def _categorize(label):
152152
'body{font-size:14px;color:#0f172a;padding:4px}'
153153
'.ddp-select{padding:4px 8px;border:1px solid #e2e8f0;border-radius:4px;font-size:0.8125em;color:#0f172a;background:#fff;cursor:pointer;outline:none}'
154154
'.ddp-select-label{font-size:0.6875em;color:#64748b;display:block;margin-bottom:2px}'
155+
'.ddp-stat-row{display:flex;gap:12px;margin:12px 0}'
156+
'.ddp-stat-box{border:1px solid #e2e8f0;border-radius:6px;padding:12px 16px;flex:1;min-width:120px}'
157+
'.ddp-stat-value{font-size:1.5em;font-weight:600;letter-spacing:-0.02em;color:#0f172a;line-height:1.2}'
158+
'.ddp-stat-label{font-size:0.6875em;font-weight:500;color:#64748b;text-transform:uppercase;letter-spacing:0.03em;margin-bottom:4px}'
159+
'.ddp-stat-caption{font-size:0.75em;color:#64748b;margin-top:4px}'
155160
'</style></head><body>'
156161
f'{_sel_html}'
157162
'<div id="stats" style="margin-bottom:12px"></div>'
@@ -251,6 +256,11 @@ def ecosystem_comparison_tabs(ACTIVE_LABELS, CHURNED_LABELS, DORMANT_LABELS, FT_
251256
'body{font-size:14px;color:#0f172a;padding:4px}'
252257
'.ddp-select{padding:4px 8px;border:1px solid #e2e8f0;border-radius:4px;font-size:0.8125em;color:#0f172a;background:#fff;cursor:pointer;outline:none}'
253258
'.ddp-select-label{font-size:0.6875em;color:#64748b;display:block;margin-bottom:2px}'
259+
'.ddp-stat-row{display:flex;gap:12px;margin:12px 0}'
260+
'.ddp-stat-box{border:1px solid #e2e8f0;border-radius:6px;padding:12px 16px;flex:1;min-width:120px}'
261+
'.ddp-stat-value{font-size:1.5em;font-weight:600;letter-spacing:-0.02em;color:#0f172a;line-height:1.2}'
262+
'.ddp-stat-label{font-size:0.6875em;font-weight:500;color:#64748b;text-transform:uppercase;letter-spacing:0.03em;margin-bottom:4px}'
263+
'.ddp-stat-caption{font-size:0.75em;color:#64748b;margin-top:4px}'
254264
'</style></head><body>'
255265
f'{_sel_html}'
256266
'<div id="chart"></div>'

notebooks/insights/developer-report-2025.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def header_title(mo):
1111

1212

1313
@app.cell(hide_code=True)
14-
def header_accordion(mo):
14+
def header_accordion(mo, _report_complete):
1515
mo.accordion({
1616
"Metrics & Definitions": mo.md("""
1717
- **Time period**: January 2015 to December 2025 (full historical data)
@@ -1634,7 +1634,8 @@ def comparison_chart(df_all, mo, pd):
16341634
)
16351635
_src = _html_mod.escape(_inner, quote=True)
16361636
mo.Html(f'<iframe srcdoc="{_src}" class="ddp-chart-frame" scrolling="no"></iframe>')
1637-
return
1637+
_report_complete = True
1638+
return (_report_complete,)
16381639

16391640

16401641
if __name__ == "__main__":

notebooks/insights/developer-retention.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,11 @@ def _stat(value, label, caption=''):
262262
'body{font-size:14px;color:#0f172a;padding:4px}'
263263
'.ddp-select{padding:4px 8px;border:1px solid #e2e8f0;border-radius:4px;font-size:0.8125em;color:#0f172a;background:#fff;cursor:pointer;outline:none}'
264264
'.ddp-select-label{font-size:0.6875em;color:#64748b;display:block;margin-bottom:2px}'
265+
'.ddp-stat-row{display:flex;gap:12px;margin:12px 0}'
266+
'.ddp-stat-box{border:1px solid #e2e8f0;border-radius:6px;padding:12px 16px;flex:1;min-width:120px}'
267+
'.ddp-stat-value{font-size:1.5em;font-weight:600;letter-spacing:-0.02em;color:#0f172a;line-height:1.2}'
268+
'.ddp-stat-label{font-size:0.6875em;font-weight:500;color:#64748b;text-transform:uppercase;letter-spacing:0.03em;margin-bottom:4px}'
269+
'.ddp-stat-caption{font-size:0.75em;color:#64748b;margin-top:4px}'
265270
'</style></head><body>'
266271
f'{_sel_html}'
267272
'<div id="stats" style="margin-bottom:12px"></div>'

0 commit comments

Comments
 (0)