Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] Add __getattr__ to pyarrow.compute for typing #43285

Open
randolf-scholz opened this issue Jul 16, 2024 · 1 comment · May be fixed by #43288
Open

[Python] Add __getattr__ to pyarrow.compute for typing #43285

randolf-scholz opened this issue Jul 16, 2024 · 1 comment · May be fixed by #43288

Comments

@randolf-scholz
Copy link

Describe the enhancement requested

When type-checking with pyright, the module pyarrow.compute raises tons of errors of the form

error: "sum" is not a known attribute of module "pyarrow.compute" (reportAttributeAccessIssue)

One can use the useLibraryCodeForTypes=false option to suppress these, but it's not configurable on a per-module basis.

The problem is that these are dynamically generated via

_make_global_functions()

A workaround until stubs are available would be to add a module-level __getattr__ function:

if TYPE_CHECKING:
    def __getattr__(self, name: str, /) -> Any: ...

See: microsoft/pyright#3909 (comment)

Component(s)

Python

@kou kou changed the title [typing] add __getattr__ to pyarrow.compute [Python] Add __getattr__ to pyarrow.compute for typing Jul 16, 2024
@zen-xu
Copy link

zen-xu commented Sep 6, 2024

please install pyarrow-stubs

pip install 'pyarrow-stubs>=17.2'
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants