') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); [Python] Add typing to arrow using pyarrow-stubs with tests coverage by rok · Pull Request #43 · rok/arrow · GitHub
Skip to content

[Python] Add typing to arrow using pyarrow-stubs with tests coverage - #43

Draft
rok wants to merge 2 commits into
mainfrom
add-pyarrow-stubs-fix-tests
Draft

[Python] Add typing to arrow using pyarrow-stubs with tests coverage#43
rok wants to merge 2 commits into
mainfrom
add-pyarrow-stubs-fix-tests

Conversation

@rok

@rokrok commented Jul 28, 2025

Copy link
Copy Markdown
Owner

NOTE: this is preliminary prototype work to be used for discussion and not ready to merge to arrow/main.

This builds on top of #42 and adds type annotation coverage for pytest tests.

rokand others added 2 commits July 28, 2025 17:31
* Add typing to arrow using stubs
* GH-7: [Python] Fix invalid-context-manager error (#30)
* Add py.typed file to signify that the library is typed
See the relevant PEP https://peps.python.org/pep-0561
* Prepare `pyarrow-stubs` for history merging
MINOR: [Python] Prepare `pyarrow-stubs` for history merging
Co-authored-by: ZhengYu, Xu <zen-xu@outlook.com>
* Add `ty` configuration and suppress error codes
* One line per rule
* Add licence header from original repo for all `.pyi` files
* Revert "Add licence header from original repo for all `.pyi` files"
This reverts commit 1631f39.
* Prepare for licence merging
* Exclude `stubs` from `rat` test
* Add Apache licence clause to `py.typed`
* Reduce list
* Add `ty` as a step in the action
* Run in the correct directory
* Remove `check` from `pip`
* Fix `unresolved-reference` error
* Revert "Fix `unresolved-reference` error"
This reverts commit 7ee3d2f.
* Fix invalid-context-manager
---------
Co-authored-by: Patrick J. Roddy <patrickjamesroddy@gmail.com>
* GH-8: [Python] Fix invalid-type-form (#31)
* Add py.typed file to signify that the library is typed
See the relevant PEP https://peps.python.org/pep-0561
* Prepare `pyarrow-stubs` for history merging
MINOR: [Python] Prepare `pyarrow-stubs` for history merging
Co-authored-by: ZhengYu, Xu <zen-xu@outlook.com>
* Add `ty` configuration and suppress error codes
* One line per rule
* Add licence header from original repo for all `.pyi` files
* Revert "Add licence header from original repo for all `.pyi` files"
This reverts commit 1631f39.
* Prepare for licence merging
* Exclude `stubs` from `rat` test
* Add Apache licence clause to `py.typed`
* Reduce list
* Add `ty` as a step in the action
* Run in the correct directory
* Remove `check` from `pip`
* Fix `unresolved-reference` error
* Revert "Fix `unresolved-reference` error"
This reverts commit 7ee3d2f.
* Fix invalid-type-form errors
---------
Co-authored-by: Patrick J. Roddy <patrickjamesroddy@gmail.com>
* GH-9: [Python] Fix non-subscriptable error (#32)
* fix: The type parameter of array should be covariant (apache#253)
* release 20.0.0.20250716 (apache#254)
* Add py.typed file to signify that the library is typed
See the relevant PEP https://peps.python.org/pep-0561
* Prepare `pyarrow-stubs` for history merging
MINOR: [Python] Prepare `pyarrow-stubs` for history merging
Co-authored-by: ZhengYu, Xu <zen-xu@outlook.com>
* Add `ty` configuration and suppress error codes
* One line per rule
* Add licence header from original repo for all `.pyi` files
* Revert "Add licence header from original repo for all `.pyi` files"
This reverts commit 1631f39.
* Prepare for licence merging
* Exclude `stubs` from `rat` test
* Add Apache licence clause to `py.typed`
* Reduce list
* Add `ty` as a step in the action
* Run in the correct directory
* Remove `check` from `pip`
* Fix `unresolved-reference` error
* Revert "Fix `unresolved-reference` error"
This reverts commit 7ee3d2f.
* Fix non-subscriptable issues
---------
Co-authored-by: Patrick J. Roddy <patrickjamesroddy@gmail.com>
* GH-11: [Python] Fix no-matching-overload error (#34)
* Add py.typed file to signify that the library is typed
See the relevant PEP https://peps.python.org/pep-0561
* Prepare `pyarrow-stubs` for history merging
MINOR: [Python] Prepare `pyarrow-stubs` for history merging
Co-authored-by: ZhengYu, Xu <zen-xu@outlook.com>
* Add `ty` configuration and suppress error codes
* One line per rule
* Add licence header from original repo for all `.pyi` files
* Revert "Add licence header from original repo for all `.pyi` files"
This reverts commit 1631f39.
* Prepare for licence merging
* Exclude `stubs` from `rat` test
* Add Apache licence clause to `py.typed`
* Reduce list
* Add `ty` as a step in the action
* Run in the correct directory
* Remove `check` from `pip`
* Fix `unresolved-reference` error
* Revert "Fix `unresolved-reference` error"
This reverts commit 7ee3d2f.
* Fix no-matching-overload
---------
Co-authored-by: Patrick J. Roddy <patrickjamesroddy@gmail.com>
* GH-12: [Python] Fix `invalid-return-type` error (#25)
* Add py.typed file to signify that the library is typed
See the relevant PEP https://peps.python.org/pep-0561
* Prepare `pyarrow-stubs` for history merging
MINOR: [Python] Prepare `pyarrow-stubs` for history merging
Co-authored-by: ZhengYu, Xu <zen-xu@outlook.com>
* Add `ty` configuration and suppress error codes
* One line per rule
* Add licence header from original repo for all `.pyi` files
* Revert "Add licence header from original repo for all `.pyi` files"
This reverts commit 1631f39.
* Prepare for licence merging
* Exclude `stubs` from `rat` test
* Add Apache licence clause to `py.typed`
* Reduce list
* Add `ty` as a step in the action
* Run in the correct directory
* Remove `check` from `pip`
* Fix `unresolved-reference` error
* Revert "Fix `unresolved-reference` error"
This reverts commit 7ee3d2f.
* Fix `invalid-return-type` error
* Fix linting
---------
Co-authored-by: Rok Mihevc <rok@mihevc.org>
* GH-14: [Python] Fix `not-iterable` typing (#26)
* Add py.typed file to signify that the library is typed
See the relevant PEP https://peps.python.org/pep-0561
* Prepare `pyarrow-stubs` for history merging
MINOR: [Python] Prepare `pyarrow-stubs` for history merging
Co-authored-by: ZhengYu, Xu <zen-xu@outlook.com>
* Add `ty` configuration and suppress error codes
* One line per rule
* Add licence header from original repo for all `.pyi` files
* Revert "Add licence header from original repo for all `.pyi` files"
This reverts commit 1631f39.
* Prepare for licence merging
* Exclude `stubs` from `rat` test
* Add Apache licence clause to `py.typed`
* Reduce list
* Add `ty` as a step in the action
* Run in the correct directory
* Remove `check` from `pip`
* Fix `unresolved-reference` error
* Revert "Fix `unresolved-reference` error"
This reverts commit 7ee3d2f.
* Fix `not-iterable` error
---------
Co-authored-by: Rok Mihevc <rok@mihevc.org>
* GH-15: [Python] Fix possibly-unbound-attribute (#38)
* Add py.typed file to signify that the library is typed
See the relevant PEP https://peps.python.org/pep-0561
* Prepare `pyarrow-stubs` for history merging
MINOR: [Python] Prepare `pyarrow-stubs` for history merging
Co-authored-by: ZhengYu, Xu <zen-xu@outlook.com>
* Add `ty` configuration and suppress error codes
* One line per rule
* Add licence header from original repo for all `.pyi` files
* Revert "Add licence header from original repo for all `.pyi` files"
This reverts commit 1631f39.
* Prepare for licence merging
* Exclude `stubs` from `rat` test
* Add Apache licence clause to `py.typed`
* Reduce list
* Add `ty` as a step in the action
* Run in the correct directory
* Remove `check` from `pip`
* Fix `unresolved-reference` error
* Revert "Fix `unresolved-reference` error"
This reverts commit 7ee3d2f.
* Fix possibly-unbound-attribute
---------
Co-authored-by: Patrick J. Roddy <patrickjamesroddy@gmail.com>
* GH-16: [Python] Fix too-many-positional-arguments (#35)
* Add py.typed file to signify that the library is typed
See the relevant PEP https://peps.python.org/pep-0561
* Prepare `pyarrow-stubs` for history merging
MINOR: [Python] Prepare `pyarrow-stubs` for history merging
Co-authored-by: ZhengYu, Xu <zen-xu@outlook.com>
* Add `ty` configuration and suppress error codes
* One line per rule
* Add licence header from original repo for all `.pyi` files
* Revert "Add licence header from original repo for all `.pyi` files"
This reverts commit 1631f39.
* Prepare for licence merging
* Exclude `stubs` from `rat` test
* Add Apache licence clause to `py.typed`
* Reduce list
* Add `ty` as a step in the action
* Run in the correct directory
* Remove `check` from `pip`
* Fix `unresolved-reference` error
* Revert "Fix `unresolved-reference` error"
This reverts commit 7ee3d2f.
* Fix too-many-positional-arguments
---------
Co-authored-by: Patrick J. Roddy <patrickjamesroddy@gmail.com>
* GH-17: [Python] Fix unknown-argument (#36)
* Add py.typed file to signify that the library is typed
See the relevant PEP https://peps.python.org/pep-0561
* Prepare `pyarrow-stubs` for history merging
MINOR: [Python] Prepare `pyarrow-stubs` for history merging
Co-authored-by: ZhengYu, Xu <zen-xu@outlook.com>
* Add `ty` configuration and suppress error codes
* One line per rule
* Add licence header from original repo for all `.pyi` files
* Revert "Add licence header from original repo for all `.pyi` files"
This reverts commit 1631f39.
* Prepare for licence merging
* Exclude `stubs` from `rat` test
* Add Apache licence clause to `py.typed`
* Reduce list
* Add `ty` as a step in the action
* Run in the correct directory
* Remove `check` from `pip`
* Fix `unresolved-reference` error
* Revert "Fix `unresolved-reference` error"
This reverts commit 7ee3d2f.
* Fix unknown-argument
---------
Co-authored-by: Patrick J. Roddy <patrickjamesroddy@gmail.com>
* GH-18: [Python] Fix unresolved-attribute (#37)
* Add py.typed file to signify that the library is typed
See the relevant PEP https://peps.python.org/pep-0561
* Prepare `pyarrow-stubs` for history merging
MINOR: [Python] Prepare `pyarrow-stubs` for history merging
Co-authored-by: ZhengYu, Xu <zen-xu@outlook.com>
* Add `ty` configuration and suppress error codes
* One line per rule
* Add licence header from original repo for all `.pyi` files
* Revert "Add licence header from original repo for all `.pyi` files"
This reverts commit 1631f39.
* Prepare for licence merging
* Exclude `stubs` from `rat` test
* Add Apache licence clause to `py.typed`
* Reduce list
* Add `ty` as a step in the action
* Run in the correct directory
* Remove `check` from `pip`
* Fix `unresolved-reference` error
* Revert "Fix `unresolved-reference` error"
This reverts commit 7ee3d2f.
* Fix unresolved-attribute
---------
Co-authored-by: Patrick J. Roddy <patrickjamesroddy@gmail.com>
* GH-19: [Python] Fix unresolved-global (#39)
* Add py.typed file to signify that the library is typed
See the relevant PEP https://peps.python.org/pep-0561
* Prepare `pyarrow-stubs` for history merging
MINOR: [Python] Prepare `pyarrow-stubs` for history merging
Co-authored-by: ZhengYu, Xu <zen-xu@outlook.com>
* Add `ty` configuration and suppress error codes
* One line per rule
* Add licence header from original repo for all `.pyi` files
* Revert "Add licence header from original repo for all `.pyi` files"
This reverts commit 1631f39.
* Prepare for licence merging
* Exclude `stubs` from `rat` test
* Add Apache licence clause to `py.typed`
* Reduce list
* Add `ty` as a step in the action
* Run in the correct directory
* Remove `check` from `pip`
* Fix `unresolved-reference` error
* Revert "Fix `unresolved-reference` error"
This reverts commit 7ee3d2f.
* Fix unresolved-global
---------
Co-authored-by: Patrick J. Roddy <patrickjamesroddy@gmail.com>
* GH-20: [Python] Fix `unsupported-reference` typing (#24)
* Add py.typed file to signify that the library is typed
See the relevant PEP https://peps.python.org/pep-0561
* Prepare `pyarrow-stubs` for history merging
MINOR: [Python] Prepare `pyarrow-stubs` for history merging
Co-authored-by: ZhengYu, Xu <zen-xu@outlook.com>
* Add `ty` configuration and suppress error codes
* One line per rule
* Add licence header from original repo for all `.pyi` files
* Revert "Add licence header from original repo for all `.pyi` files"
This reverts commit 1631f39.
* Prepare for licence merging
* Exclude `stubs` from `rat` test
* Add Apache licence clause to `py.typed`
* Reduce list
* Add `ty` as a step in the action
* Run in the correct directory
* Remove `check` from `pip`
* Fix `unresolved-reference` error
* Revert "Fix `unresolved-reference` error"
This reverts commit 7ee3d2f.
* Fix `unresolved-reference` error
---------
Co-authored-by: Rok Mihevc <rok@mihevc.org>
* GH-6: [Python] Fix invalid-argument-type error (#29)
* Add py.typed file to signify that the library is typed
See the relevant PEP https://peps.python.org/pep-0561
* Prepare `pyarrow-stubs` for history merging
MINOR: [Python] Prepare `pyarrow-stubs` for history merging
Co-authored-by: ZhengYu, Xu <zen-xu@outlook.com>
* Add `ty` configuration and suppress error codes
* One line per rule
* Add licence header from original repo for all `.pyi` files
* Revert "Add licence header from original repo for all `.pyi` files"
This reverts commit 1631f39.
* Prepare for licence merging
* Exclude `stubs` from `rat` test
* Add Apache licence clause to `py.typed`
* Reduce list
* Add `ty` as a step in the action
* Run in the correct directory
* Remove `check` from `pip`
* Fix `unresolved-reference` error
* Revert "Fix `unresolved-reference` error"
This reverts commit 7ee3d2f.
* removing OrderedDict, etc
---------
Co-authored-by: Patrick J. Roddy <patrickjamesroddy@gmail.com>
* GH-27: [Python] Fix call-non-callable error (#28)
* Add py.typed file to signify that the library is typed
See the relevant PEP https://peps.python.org/pep-0561
* Prepare `pyarrow-stubs` for history merging
MINOR: [Python] Prepare `pyarrow-stubs` for history merging
Co-authored-by: ZhengYu, Xu <zen-xu@outlook.com>
* Add `ty` configuration and suppress error codes
* One line per rule
* Add licence header from original repo for all `.pyi` files
* Revert "Add licence header from original repo for all `.pyi` files"
This reverts commit 1631f39.
* Prepare for licence merging
* Exclude `stubs` from `rat` test
* Add Apache licence clause to `py.typed`
* Reduce list
* Add `ty` as a step in the action
* Run in the correct directory
* Remove `check` from `pip`
* Fix `unresolved-reference` error
* Revert "Fix `unresolved-reference` error"
This reverts commit 7ee3d2f.
* to_sparse appears deprecated, ignore inline
* Update python/pyarrow/tests/test_feather.py
---------
Co-authored-by: Patrick J. Roddy <patrickjamesroddy@gmail.com>
* GH-10: [Python] Fix invalid-assignment error (#33)
* Add py.typed file to signify that the library is typed
See the relevant PEP https://peps.python.org/pep-0561
* Prepare `pyarrow-stubs` for history merging
MINOR: [Python] Prepare `pyarrow-stubs` for history merging
Co-authored-by: ZhengYu, Xu <zen-xu@outlook.com>
* Add `ty` configuration and suppress error codes
* One line per rule
* Add licence header from original repo for all `.pyi` files
* Revert "Add licence header from original repo for all `.pyi` files"
This reverts commit 1631f39.
* Prepare for licence merging
* Exclude `stubs` from `rat` test
* Add Apache licence clause to `py.typed`
* Reduce list
* Add `ty` as a step in the action
* Run in the correct directory
* Remove `check` from `pip`
* Fix `unresolved-reference` error
* Revert "Fix `unresolved-reference` error"
This reverts commit 7ee3d2f.
* Fix invalid-assignment
---------
Co-authored-by: Patrick J. Roddy <patrickjamesroddy@gmail.com>
* GH-21: [Python] Fix `unsupported-operator` typing (#22)
* Add py.typed file to signify that the library is typed
See the relevant PEP https://peps.python.org/pep-0561
* Prepare `pyarrow-stubs` for history merging
MINOR: [Python] Prepare `pyarrow-stubs` for history merging
Co-authored-by: ZhengYu, Xu <zen-xu@outlook.com>
* Add `ty` configuration and suppress error codes
* One line per rule
* Add licence header from original repo for all `.pyi` files
* Revert "Add licence header from original repo for all `.pyi` files"
This reverts commit 1631f39.
* Prepare for licence merging
* Exclude `stubs` from `rat` test
* Add Apache licence clause to `py.typed`
* Reduce list
* Add `ty` as a step in the action
* Run in the correct directory
* Remove `check` from `pip`
* Fix `unsupported-operator` error
---------
* fix unsupported-operator
* Fix unresolved-reference
* Fix not-iterable
* Fix no-matching-overload
* Fix invalid-assignment
* Fix too-many-positional-arguments
* Fix invalid-argument-type
* Fix missing-argument
* Fix unresolved-import
* Fix possibly-unbound-import
* Fix possibly-unbound-import
* Fix unresolved-attribute
* Revert test changes
* Converging
---------
Co-authored-by: Patrick J. Roddy <patrickjamesroddy@gmail.com>
Co-authored-by: Patrick J. Roddy <patrickjamesroddy@gmail.com>
@github-actions

Copy link
Copy Markdown

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

See also:

@github-actions

Copy link
Copy Markdown

Thank you for your contribution. Unfortunately, this pull request 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 PR will be closed in 14 days. Feel free to re-open this if it has been closed in error. If you do not have repository permissions to reopen the PR, please tag a maintainer.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@rok