Skip to content

Commit 79da8e4

Browse files
mivertowskiclaude
andcommitted
build: add 'notebooks' optional-dependency extra; harden empty-key test
- pyproject: [project.optional-dependencies].notebooks = matplotlib/seaborn/ networkx/numpy/jupyter/ipykernel so the example notebooks run via 'pip install vynco[notebooks]' or 'uv run --extra notebooks ...'. - notebooks/README: document the extra + the Professional-tier requirement. - test_empty_api_key_raises_config_error: delenv VYNCO_API_KEY so it stays hermetic when the key is exported for the live suite. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 723da12 commit 79da8e4

5 files changed

Lines changed: 2182 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ Tooling:
7272

7373
- Reproducible route-gap diff at `scripts/api_gap.py`.
7474
- Opt-in live smoke suite (`uv run pytest -m live`, gated on `VYNCO_API_KEY`).
75+
- All `examples/` are now tier-resilient (`examples/_common.py`): a section whose
76+
endpoint the key's tier doesn't unlock is skipped with a note instead of crashing.
77+
- `notebooks` optional-dependency extra (`pip install "vynco[notebooks]"`) bundling
78+
matplotlib/seaborn/networkx/numpy/jupyter for the example notebooks.
7579

7680
### Fixed
7781

notebooks/README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,26 @@ Jupyter notebooks that produce publication-ready charts from the VynCo API. Ever
44

55
## Setup
66

7+
The charting/runtime dependencies are bundled in the `notebooks` extra:
8+
79
```bash
8-
pip install vynco matplotlib seaborn networkx jupyter
10+
pip install "vynco[notebooks]" # or: uv sync --extra notebooks
911
export VYNCO_API_KEY=vc_live_your_api_key
10-
jupyter lab
12+
jupyter lab # or: uv run --extra notebooks jupyter lab
1113
```
1214

1315
Or execute headlessly:
1416

1517
```bash
1618
jupyter nbconvert --to notebook --execute notebooks/<name>.ipynb --output <name>.ipynb
19+
# with uv:
20+
uv run --extra notebooks jupyter nbconvert --to notebook --execute notebooks/<name>.ipynb --output <name>.ipynb
1721
```
1822

23+
> Most notebooks call analytics, AI, and methodology endpoints, so they need a
24+
> **Professional** (or higher) API key to run end-to-end; on a lower tier those
25+
> cells return `ForbiddenError`.
26+
1927
## Notebooks
2028

2129
### [swiss_market_analytics.ipynb](swiss_market_analytics.ipynb) — Market landscape

pyproject.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ dependencies = [
2121
"pydantic>=2.0",
2222
]
2323

24+
[project.optional-dependencies]
25+
# Charting/runtime deps for the example notebooks under notebooks/.
26+
# Install with: pip install "vynco[notebooks]" (or uv sync --extra notebooks)
27+
notebooks = [
28+
"matplotlib>=3.7",
29+
"seaborn>=0.13",
30+
"networkx>=3.0",
31+
"numpy>=1.24",
32+
"jupyter>=1.0",
33+
"ipykernel>=6.0",
34+
]
35+
2436
[project.urls]
2537
Homepage = "https://github.com/VynCorp/vc-python"
2638
Documentation = "https://docs.vynco.ch"

tests/test_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
# ---------------------------------------------------------------------------
1717

1818

19-
def test_empty_api_key_raises_config_error():
19+
def test_empty_api_key_raises_config_error(monkeypatch):
20+
# An empty key falls back to the env var, so null it to keep this hermetic
21+
# even when VYNCO_API_KEY is exported (e.g. for the live suite).
22+
monkeypatch.delenv("VYNCO_API_KEY", raising=False)
2023
with pytest.raises(vynco.ConfigError, match="empty"):
2124
vynco.Client("")
2225

0 commit comments

Comments
 (0)