Commit cbfa652
docs(ipc): explain why _resolve_ctx imports SessionContext lazily
The `# noqa: PLC0415` flag silenced ruff's "import outside top-level"
lint but didn't say why the import was placed there in the first place.
Add a comment naming the actual reason: `datafusion/__init__.py`
imports `datafusion.ipc` before `datafusion.context`, so a module-top
import would force `datafusion.context` to load mid-init of
`datafusion.ipc`. The cycle is benign today (`context.py` only pulls
`expr.py` at module scope, and neither pulls `ipc.py` back), but a
single new import added to `context.py`'s transitive dependency tree
could turn this into a real circular import. Deferring keeps
`datafusion.ipc` import-order-independent.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 865d9df commit cbfa652
1 file changed
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
162 | 169 | | |
163 | 170 | | |
164 | 171 | | |
0 commit comments