You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 872afb6
Browse filesBrowse the repository at this point in the historyBrowse files
docs: give each docstring claim one canonical home
The extension docstrings and the FFI guide had grown the same six claims 3-5
times each, in wording that had already started to drift. `with_extensions` was
123 lines — the longest docstring in the package by 30 — and most of it argued
a design rather than stating a contract.
Routes each recurring claim to one home and leaves a one-line pointer
elsewhere. Session sharing and context lifetime move onto the `SessionContext`
class docstring, since they are properties of the type and that is exactly why
five methods had each reworded them. The `None`-vs-`fallback` contract moves
onto `SessionPlannerExportable`, since it is a return-value contract of one
method. The two-phase rationale, the objects-not-capsules argument, and the
codec-order argument stay in the guide, which owns the "why".
The duck-type-the-session rule moves from `QueryPlannerExportable` to
`LogicalExtensionCodecExportable`, which is already the designated `session`
reference for that family and where the codec protocols were pointing for it
anyway. It also gains the fact the old text was missing: across the protocol
this argument is not always a session, so duck-typing it is not a style
preference.
Not every docstring shrank. `__datafusion_query_planner__` was 4 lines with no
example while `set_query_planner` told callers to capture the fallback through
it, so it grew to 25. Several others grew by gaining the `Args`/`Returns`/
`Raises` sections they were missing, and by trading `+SKIP` examples for
runnable ones — a `SessionContext` satisfies the capsule-getter protocols, so
its own exported capsule stands in for a library's without a build step. The
total across these sixteen docstrings is roughly flat, at 577 lines before and
629 after; what changed is that the rationale left and the contract arrived.
The 21 lines of `dataclasses.fields` rationale on
`SessionExtensionComponents.__post_init__` become comments in the method body.
That is the fix rather than touching `autoapi_options`: `__post_init__` is a
*special* member, so dropping `private-members` would not hide it, and dropping
`special-members` would delete the entire `__datafusion_*__` reference surface.
`conf.py` now records why that setting is deliberately left alone, and
de-duplicates the four re-exported `extensions` classes the way it already did
for `DataFrame` and `SessionContext`.
Adds `python/tests/test_docstrings.py`, which is what would have caught the
123-liner: a 95-line ceiling with no waiver list, a doctest-presence check over
the extension protocol, and a check that a docstring naming the guide actually
links it. The last two each found a real defect on first run.
Also fixes what this branch made newly load-bearing in the serialization
surface: `plan.py`'s single-backtick RST rendered `LogicalExtensionCodec` and
friends as italics rather than links into the new API, and the `global_ctx()`
fallback in `Expr.from_bytes` now silently yields a context with no extension
codecs, which before this branch lost only registrations.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments