jorisvandenbossche commented on PR #51680:
URL: https://github.com/apache/arrow/pull/51680#issuecomment-6014608120

   > I suppose we could generate stubs for compute kernels with stubgen
   
   Maybe I am not familiar enough with how this all works, but why do we need 
stubs for python files? Why not add type annotations in compute.py itself? Or 
the problem for this file specifically is that it contains dynamically 
generated functions, and type checkers need to get that information statically?
   
   Then we can still only provide a stub file for compute.py, and do inline 
annotations for the other python files?
   
   
   
   
   > Both dynamic and cython/python stubs will be included into git without 
docstrings (we agreed on this somewhere in or in vicinity of #32609). We will 
want to use our [existing docstring populating 
script](https://github.com/apache/arrow/blob/main/python/scripts/update_stub_docstrings.py)
 or `docstring-adder` to inject docstrings into stubs at wheel build time.
   
   Why would we explicitly remove docstrings first (since the stubgen can 
include them) to then re-inject them with some build time magic? Is that for 
reducing the size of the git tracked sources? (as long as the files are 
auto-generated, this might not be too much of a problem?)
   
   (I checked mentions of "docstring" in 
https://github.com/apache/arrow/issues/32609, but those are all rather about 
_wanting_ docstrings)
   
   > cover the dynamically generated surface (kernels) with manual stubs
   
   I think we could relatively easily also generate those stubs? (we already 
generate the python code with signature on the fly, then we can also generate 
annotations on the fly and save that with some extra script to a file)
   
   
   > What I'm a little worried about is potential namespaces (dynamic, cython 
and python) overlap which might require extra logic. If this logic gets too 
complex I would be against using the mix of auto-generated and manual stubs 
(and slightly prefer manual-only). This would be to keep maintenance cost of 
stubs as low as possible.
   
   I think the goal should be "no manual stubs" if we go stubgen(-pyx)


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to