Title: [Python] type checkers broken for pyarrow.compute and other sub-modules since PyArrow 24.0+ · Issue #49831 · apache/arrow · GitHub
Open Graph Title: [Python] type checkers broken for pyarrow.compute and other sub-modules since PyArrow 24.0+ · Issue #49831 · apache/arrow
X Title: [Python] type checkers broken for pyarrow.compute and other sub-modules since PyArrow 24.0+ · Issue #49831 · apache/arrow
Description: Describe the bug, including details regarding any error messages, version, and platform. Consider the following snippet: docker run \ --rm \ -it python:3.13 \ bash pip install 'pyarrow>=24.0' 'mypy' cat > test.py < Open Graph Description: Describe the bug, including details regarding any error messages, version, and platform. Consider the following snippet: docker run \ --rm \ -it python:3.13 \ bash pip install 'pyarrow>=24.0' 'mypy...
X Description: Describe the bug, including details regarding any error messages, version, and platform. Consider the following snippet: docker run \ --rm \ -it python:3.13 \ bash pip install 'pyarrow>=24.0...
Opengraph URL: https://github.com/apache/arrow/issues/49831
X: @github
Domain: github.com
Links:
Viewport: width=device-width
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Python] type checkers broken for pyarrow.compute and other sub-modules since PyArrow 24.0+","articleBody":"### Describe the bug, including details regarding any error messages, version, and platform.\n\nConsider the following snippet:\n\n```shell\ndocker run \\\n --rm \\\n -it python:3.13 \\\n bash\n\npip install 'pyarrow\u003e=24.0' 'mypy'\n\ncat \u003e test.py \u003c\u003cEOF\nimport pyarrow as pa\nimport pyarrow.compute as pa_compute\n\ndef all_ones(arr) -\u003e bool:\n return pa_compute.all(pa_compute.equal(arr, 1))\n\nif __name__ == \"__main__\":\n X = pa.array([1, 1, 1])\n print(f\"all ones?: {all_ones(X)}\")\nEOF\n```\n\nThis is totally plausible `pyarrow` code and works as expected.\n\n```console\n$ python ./test.py\nall ones?: True\n```\n\nBut `mypy` complains about it referencing things that don't exist in `pyarrow`\n\n```console\n$ mypy --version\nmypy 1.20.2 (compiled: yes)\n\n$ mypy ./test.py\ntest.py:5: error: Module has no attribute \"all\" [attr-defined]\ntest.py:5: error: Module has no attribute \"equal\" [attr-defined]\nFound 2 errors in 1 file (checked 1 source file)\n```\n\n## Notes\n\nSimilar errors are not surfaced by type checkers like `mypy` on `pyarrow\u003c24`, so I strongly suspect this is related to something new in the 24.0 release. Possibly the introduction of type-checking infrastructure (a `py.typed` file and `.pyi` stubs), around #48618\n\nMaybe the `.pyi` stub file(s) are incomplete? At https://mypy.readthedocs.io/en/stable/stubs.html#creating-a-stub, I see:\n\n\u003e _If a directory contains both a `.py` and a `.pyi` file for the same module, the `.pyi` file takes precedence._\n\nOr maybe `mypy` does not handle well situations where things are added to `globals` at import time like this?\n\nhttps://github.com/apache/arrow/blob/acd8e442939b5fbf90d0cd65ca506514ec3851c4/python/pyarrow/compute.py#L343\n\nThanks for your time and consideration.\n\n### Component(s)\n\nPython","author":{"url":"https://github.com/jameslamb","@type":"Person","name":"jameslamb"},"datePublished":"2026-04-21T21:27:31.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/49831/arrow/issues/49831"}
route-pattern /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) route-controller voltron_issues_fragments route-action issue_layout fetch-nonce v2:b2b49f26-bf67-1885-5db7-e49acfa178d1 current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id B984:3026F0:227F21A:31598E4:6A4BE830 html-safe-nonce e51ae4d7395e410fbac31069fb9adc5f12227ff2ead2a6428ed834303cfc0dcd visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTg0OjMwMjZGMDoyMjdGMjFBOjMxNTk4RTQ6NkE0QkU4MzAiLCJ2aXNpdG9yX2lkIjoiNzU2NjQzMzg5NzA1MjYyOTA0MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 visitor-hmac 90fee2ad8a7b5caa58193d63a64b2d77097bec86c0fd314fe1f5047ef30732e1 hovercard-subject-tag issue:4305382489 github-keyboard-shortcuts repository,issues,copilot google-site-verification Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I octolytics-url https://collector.github.com/github/collect analytics-location / fb:app_id 1401488693436528 apple-itunes-app app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/apache/arrow/49831/issue_layout twitter:image https://opengraph.githubassets.com/018a975ed6b6cee5c6e45447395e6ff7a63a33eefdf0e625134c6aae656423a1/apache/arrow/issues/49831 twitter:card summary_large_image og:image https://opengraph.githubassets.com/018a975ed6b6cee5c6e45447395e6ff7a63a33eefdf0e625134c6aae656423a1/apache/arrow/issues/49831 og:image:alt Describe the bug, including details regarding any error messages, version, and platform. Consider the following snippet: docker run \ --rm \ -it python:3.13 \ bash pip install 'pyarrow>=24.0' 'mypy... og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username jameslamb hostname github.com expected-hostname github.com None 0f5d3ba365b3985d75c32a5957c8635488d58dcf027ae6ae958eee7edaa306a2 turbo-cache-control no-preview go-import github.com/apache/arrow git https://github.com/apache/arrow.git octolytics-dimension-user_id 47359 octolytics-dimension-user_login apache octolytics-dimension-repository_id 51905353 octolytics-dimension-repository_nwo apache/arrow octolytics-dimension-repository_public true octolytics-dimension-repository_is_fork false octolytics-dimension-repository_network_root_id 51905353 octolytics-dimension-repository_network_root_nwo apache/arrow turbo-body-classes logged-out env-production page-responsive disable-turbo false browser-stats-url https://api.github.com/_private/browser/stats browser-errors-url https://api.github.com/_private/browser/errors release f24da9b76b42d77b0bb458f810509565e9ba5f1a ui-target full theme-color #1e2327 color-scheme light dark
URLs of crawlers that visited me.