Skip to content

[Python] Pre-generate pyarrow.compute members #28290

Closed as not planned
Closed as not planned

Description

@asfimport

Static analysis tools (e.g. pylint) don't recognize simple members like pyarrow.compute.equal, they report is as missing. Generating file (well a file imported by this file I assume) https://github.com/apache/arrow/blob/master/python/pyarrow/compute.py instead of runtime wrapping of the functions would improve the developer experience.

Reporter: Adam Lippai / @alippai

Original Issue Attachments:

PRs and other links:

Note: This issue was originally created as ARROW-12526. Please see the migration documentation for further details.

Activity

  1. asfimport commented on Apr 24, 2021

    @asfimport
    Author

    Adam Lippai / @alippai:
    A quick question regarding this topic: if we generate code do we push it to the GitHub repo or do we just create it on the fly upon a release? 

  2. asfimport commented on Apr 26, 2021

    @asfimport
    Author

    Joris Van den Bossche / @jorisvandenbossche:
    In general, we commit generated code, I think.

    Wondering, would something like ARROW-10316 also already help? Although I suppose not for static tools, that probably only makes the interactive use nicer.

  3. asfimport commented on Apr 26, 2021

    @asfimport
    Author
  4. asfimport commented on Apr 26, 2021

    @asfimport
    Author

    Antoine Pitrou / @pitrou:
    I would be fine with generating the file. We would need to commit it to the repository.

    Generating the file would also allow generation to be more expensive without fear of growing import times.

  5. asfimport commented on May 12, 2021

    @asfimport
    Author
  6. asfimport commented on May 12, 2021

    @asfimport
    Author

    Adam Lippai / @alippai:
    Note: using *.pyi files would help the typing info and autocomplete, but not the import times. I assume we'd prefer full code generation, right?

  7. asfimport commented on May 12, 2021

    @asfimport
    Author

    Antoine Pitrou / @pitrou:
    Probably, yes.

  8. asfimport commented on Dec 16, 2021

    @asfimport
    Author

    Antoine Pitrou / @pitrou:
    @alippai Can you show an example invocation of pylint or another such utility?

  9. asfimport commented on May 8, 2022

    @asfimport
    Author

    Kevin Crouse:
    I was pointed to this issue because I was similarly interested in allowing pythonic documentation to be written for functions in which docs are autogenerated from the Arrow C++ details. As a result, I've written out the code to do both of these things for the pyarrow.compute module: krcrouse/arrow@master...krcrouse:generate-pyarrow-compute-and-improve-docs 

    Major points:

    • creates python/docs/additions tree where the reStructrued text docs that include the sections to overwrite. Using raw reSt so that code block examples can be tested using doctest - see the README for more verbose details

    • pyarrow.docutils (or maybe should be _docutils) provides functions to processes python/docs/additions and return a data structure of the components per function.

    • python/scripts/generate_sources.py uses pyarrow.docutils and writes out the code for the compute functions in pyarrow/generated/compute.py. All of the logic from the release-branch pyarrow.compute module that dynamically generated the compute functions has been moved to this script.

      • I didn't check the generated file into the repo because I generally do not include generated files that would be generated by the build process should be in source control, but I realize there are other perspectives on this
    • pyarrow.compute now imports from pyarrow.generated.compute for all of the autogenerated compute bindings. Override and custom functions are still defined here.

    • The old pyarrow._compute_docstrings is gone because its purpose is subsumed in the above.

    • I've updated the tests so that they work with the above changes.

       

      Below I've attached the pyarrow/generated/compute.py file that is currently created by generate_source.py as of commit 13c2b0e 

       

       

  10. asfimport commented on May 10, 2022

    @asfimport
    Author

    Antoine Pitrou / @pitrou:
    [~krcrouse] Thank you for doing this! This is really interesting. May you perhaps open a draft PR with you changes, to make it easier to add questions and comments?

  11. asfimport commented on Jun 2, 2022

    @asfimport
    Author

    Kevin Crouse:
    I haven't seen any comments on the PR or here, so maybe they didn't get auto-linked? If so, sorry - I've used Jira in the past with Bitbucket but not Github.

    The PR is here:

    #13126

  12. asfimport commented on Jun 2, 2022

    @asfimport
    Author

    Antoine Pitrou / @pitrou:
    Sorry Kevin. The PR was auto-linked above, it's just that noone got around to take a look yet.

  13. github-actions commented on Jan 21, 2026

    @github-actions

    This issue has been marked as stale because it has had no activity in the past 365 days. Please remove the stale label or comment below, or this issue will be closed in 14 days. If this improvement is still desired but has no current owner, please add the 'Status: needs champion' label.

  14. added
    Status: stale-warning
    on Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: PythonStatus: stale-warningType: enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions