Commit 05806b2
authored
chore: bring examples under pyright (#43)
VS Code's Pylance surfaces type errors on the example files because
they're outside pyright's `[tool.pyright].include` (currently src,
tests). Pylance reads the project config, sees the example file isn't
in scope, falls back to inferred typing that loses pydantic / openai
SDK type info, and emits unknown-member squiggles.
Two changes:
- pyproject.toml: extend pyright's include to ["src", "tests",
"examples"] so the project-wide check covers them and Pylance
inherits the same scope.
- examples/00-hello-world/main.py: with pyright now seeing the
example, the trace() observer's `event.post_state.sources` access
becomes a real error. `NodeEvent.post_state` is typed as the base
`State`, not the subclass `PipelineState`. Adding an
`isinstance(event.post_state, PipelineState)` check narrows the
type for static checkers and acts as a defensive guard against any
foreign-state observer event the engine might dispatch.
All other examples (01-05) come up pyright-clean under project-wide
context. Confirmed via uv run pyright = 0 errors after the changes.1 parent 2ecb7b1 commit 05806b2
2 files changed
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
182 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
183 | 187 | | |
184 | 188 | | |
185 | 189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
0 commit comments