kylebarron commented on PR #750:
URL: 
https://github.com/apache/datafusion-python/pull/750#issuecomment-2221797838

   👋 I'm also building Python-Rust-Arrow libraries and thought it might be 
useful to chime in.
   
   Ultimately it's a personal preference, so I can't blame you if you all 
choose the polars route of duplicating the Python API in Python code, but I 
personally agree with @datapythonista that a pyi file is less maintenance 
overhead than duplicating the Python API, and I like having the Python 
docstring right next to the Rust code implementing it.
   
   I thought it might be helpful to show a library that goes the other route 
but still has types and nice documentation. 
[arro3](https://github.com/kylebarron/arro3) is a minimal Python library to 
represent Arrow data in Python, with the following overview:
   
   - Write a Python docstring on the Rust class or method docstring, 
[example](https://github.com/kylebarron/arro3/blob/227c505714865064389d626c7fe3d79e8bd315c0/pyo3-arrow/src/array.rs#L155-L168).
   - [This does use a pyi file for 
types](https://github.com/kylebarron/arro3/blob/main/arro3-core/python/arro3/core/_rust.pyi).
 
   - [Install the Python library into the current 
environment](https://github.com/kylebarron/arro3/blob/227c505714865064389d626c7fe3d79e8bd315c0/.github/workflows/docs-core.yml#L60)
 when building the docs
   - Build docs using mkdocs and mkdocstrings. It's nice that this will use the 
pyi file for the deployed docs.
   - [Deployed docs contain the original 
docstring](https://kylebarron.dev/arro3/core/latest/api/array/#arro3.core.Array.from_arrow),
 with nice formatting (I prefer mkdocs and mkdocstrings over sphinx; I find it 
a lot simpler and with a better end-user UI)
   
   One downside is that `help()` doesn't include the python types from inside 
Python, since help doesn't look at the pyi files. (Though IDEs like vscode will 
still use the pyi files)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to