Skip to content

Commit a05b9bc

Browse files
committed
docs: add refactoring opportunities to avoid private API usage in AGENTS.md
1 parent a9a06bc commit a05b9bc

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

AGENTS.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,25 @@ This repository contains Python bindings for Rust's DataFusion.
2323
- The repository mixes Python and Rust; ensure changes build for both languages.
2424
- If adding new dependencies, update `pyproject.toml` and run `uv sync --dev --no-install-package datafusion`.
2525

26+
## Refactoring opportunities
27+
- Avoid using private or low-level APIs when a stable, public helper exists. For example,
28+
automated refactors should spot and replace uses:
29+
30+
```python
31+
# Before (uses private/low-level API)
32+
# PyArrow example
33+
reader = pa.RecordBatchReader._import_from_c_capsule(
34+
df.__arrow_c_stream__()
35+
)
36+
37+
# After (use public API)
38+
reader = pa.RecordBatchReader.from_stream(df)
39+
```
40+
41+
Look for call chains that invoke `_import_from_c_capsule` with `__arrow_c_stream__()`
42+
and prefer `from_stream(df)` instead. This improves readability and avoids
43+
relying on private PyArrow internals that may change.
44+
2645
## Helper Functions
2746
- `python/datafusion/io.py` offers global context readers:
2847
- `read_parquet`

0 commit comments

Comments
 (0)