Skip to content

Commit 81916a4

Browse files
rustyconoverclaude
andcommitted
docs(home): split "See it in action" into compact scalar + table snippets
The homepage showcased the full 75-line combined worker, which is heavy for a teaser. Now it shows just the scalar function and just the table function as two focused snippets, extracted from examples/calc_worker.py via pymdownx snippet sections (markers are stripped, so the full-file embeds in the tutorial/catalogs stay clean). Links to the tutorial for the complete worker. Verified: section markers don't leak into full-file embeds; calc_worker still serves; doc tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent c092f6e commit 81916a4

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

docs/index.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,21 @@ Built by [🚜 Query.Farm](https://query.farm).
1818

1919
## See it in action
2020

21-
A complete worker — a scalar function and a table function — in one file:
21+
A **scalar** function — one row in, one row out:
2222

2323
```python
24-
--8<-- "examples/calc_worker.py"
24+
--8<-- "examples/calc_worker.py:scalar"
2525
```
2626

27-
The `# /// script` block is [inline script metadata](https://packaging.python.org/en/latest/specifications/inline-script-metadata/):
28-
`uv run calc_worker.py` provisions an isolated environment with `vgi-python` and runs the worker —
29-
no virtualenv to create.
27+
A **table** function — generate rows from an argument:
28+
29+
```python
30+
--8<-- "examples/calc_worker.py:table"
31+
```
32+
33+
Drop both into a `Worker`, add an [inline-script-metadata](https://packaging.python.org/en/latest/specifications/inline-script-metadata/)
34+
header, and `uv run` it — no virtualenv, nothing to `pip install`. (The
35+
[tutorial](tutorial/index.md) builds the complete file step by step.)
3036

3137
```sql
3238
INSTALL vgi FROM community;

examples/calc_worker.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
)
3030

3131

32+
# --8<-- [start:scalar]
3233
class Double(ScalarFunction):
3334
"""Double each input value (one row in, one row out)."""
3435

@@ -41,6 +42,10 @@ def compute(
4142
return pc.multiply(value, 2)
4243

4344

45+
# --8<-- [end:scalar]
46+
47+
48+
# --8<-- [start:table]
4449
@dataclass(slots=True, frozen=True, kw_only=True)
4550
class SeriesArgs:
4651
"""Arguments for :class:`Series` (one positional ``count``)."""
@@ -67,6 +72,9 @@ def process(cls, params: ProcessParams[SeriesArgs], state: None, out: OutputColl
6772
out.finish()
6873

6974

75+
# --8<-- [end:table]
76+
77+
7078
class CalcWorker(Worker):
7179
"""A worker exposing the ``calc`` catalog with both functions."""
7280

0 commit comments

Comments
 (0)