Skip to content

Commit 9dfd0a4

Browse files
darinkishoreclaude
andcommitted
ci,docs: build+test dsrs-dspy against DSPy; exclude dspy-py from miri
miri cannot interpret an embedded CPython, so the PyO3 crate is excluded there; it is covered by the build, test, clippy, and new python-adapter jobs instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent af825a7 commit 9dfd0a4

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

.github/workflows/qol.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,23 @@ jobs:
3535
toolchain: nightly-2026-01-25
3636
components: miri
3737
- run: cargo miri setup
38-
- run: cargo miri test --all-features
38+
# dspy-py is a PyO3 extension; its tests embed CPython, which miri cannot interpret.
39+
- run: cargo miri test --all-features --workspace --exclude dspy-py
40+
41+
python-adapter:
42+
name: Python Adapter (dsrs-dspy)
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v4
46+
- uses: dtolnay/rust-toolchain@stable
47+
with:
48+
toolchain: 1.90.0
49+
- uses: astral-sh/setup-uv@v5
50+
- name: Build wheel and run adapter tests against DSPy
51+
run: |
52+
uv venv .venv
53+
VIRTUAL_ENV=$PWD/.venv uv pip install ./crates/dspy-py dspy pytest
54+
.venv/bin/pytest crates/dspy-py/tests/python/ -q
3955
4056
clippy:
4157
name: Clippy Lint

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,26 @@ println!("Sentiment: {}", analysis.sentiment);
353353
println!("Summary: {}", summary.summary);
354354
```
355355

356+
## 🐍 Using DSRs from Python (DSPy)
357+
358+
DSRs's BAML-style schema rendering and JSONish parsing are available to
359+
[DSPy](https://github.com/stanfordnlp/dspy) as a drop-in adapter, via the
360+
`dsrs-dspy` PyO3 package in [`crates/dspy-py`](crates/dspy-py):
361+
362+
```bash
363+
uv add "dsrs-dspy @ git+https://github.com/krypticmouse/DSRs@main#subdirectory=crates/dspy-py"
364+
```
365+
366+
```python
367+
import dspy
368+
from dsrs_dspy import DSRSBAMLAdapter
369+
370+
dspy.configure(lm=dspy.LM("openai/gpt-5.2"), adapter=DSRSBAMLAdapter())
371+
```
372+
373+
Building from git requires a Rust toolchain. See
374+
[`crates/dspy-py/README.md`](crates/dspy-py/README.md) for details.
375+
356376
## 🧪 Testing
357377

358378
Run the test suite:

0 commit comments

Comments
 (0)