Skip to content

Commit 166bc20

Browse files
committed
Nicer CLI example
1 parent bef163f commit 166bc20

3 files changed

Lines changed: 47 additions & 0 deletions

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ Use `wildedge run` to execute an existing Python entrypoint with WildEdge runtim
3434
wildedge run --dsn "https://<secret>@ingest.wildedge.dev/<key>" -- python app.py
3535
```
3636

37+
End-to-end CLI wrapper example:
38+
39+
```bash
40+
WILDEDGE_DSN="https://<secret>@ingest.wildedge.dev/<key>" \
41+
wildedge run --print-startup-report --integrations timm -- \
42+
python examples/cli/cli_wrapper_example.py
43+
```
44+
45+
See `examples/cli/cli_wrapper_example.py` for a script that has no WildEdge SDK calls in user code.
46+
Use `examples/cli/run_cli_wrapper_example.sh` for a ready-to-run command wrapper.
47+
3748
Module entrypoints are supported:
3849

3950
```bash
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# /// script
2+
# requires-python = ">=3.10"
3+
# dependencies = ["wildedge-sdk", "torch", "timm"]
4+
#
5+
# [tool.uv.sources]
6+
# wildedge-sdk = { path = "..", editable = true }
7+
# ///
8+
"""CLI wrapper example.
9+
10+
Run:
11+
WILDEDGE_DSN="https://<secret>@ingest.wildedge.dev/<key>" \
12+
wildedge run --print-startup-report --integrations timm -- \
13+
python examples/cli_wrapper_example.py
14+
"""
15+
16+
import timm
17+
import torch
18+
19+
model = timm.create_model("resnet18", pretrained=False).eval()
20+
batch = torch.randn(1, 3, 224, 224)
21+
22+
with torch.inference_mode():
23+
output = model(batch)
24+
25+
print("output shape:", tuple(output.shape))
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
if [[ -z "${WILDEDGE_DSN:-}" ]]; then
5+
echo "WILDEDGE_DSN is required. Example:" >&2
6+
echo ' export WILDEDGE_DSN="https://<secret>@ingest.wildedge.dev/<key>"' >&2
7+
exit 1
8+
fi
9+
10+
wildedge run --print-startup-report --integrations timm -- \
11+
python examples/cli/cli_wrapper_example.py

0 commit comments

Comments
 (0)