Skip to content

Commit 642d4d8

Browse files
authored
chore: pyright (#4289)
Closes #2668 --------- Signed-off-by: Daniel King <[email protected]>
1 parent 11c9452 commit 642d4d8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1035
-748
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ jobs:
5757
run: uv run ruff format --check .
5858
- name: Python Lint - Ruff
5959
run: uv run ruff check .
60+
- name: Python Lint - PyRight
61+
run: uv run basedpyright vortex-python
6062

6163
python-test:
6264
name: "Python (test)"
@@ -73,25 +75,19 @@ jobs:
7375
sync: false
7476
prune-cache: false
7577

76-
# Ensure the stub files are up-to-date with the public API of the native module.
77-
- name: Stubtest - Vortex
78-
run: |
79-
uv run --isolated --all-packages stubtest vortex._lib --allowlist python/vortex/_lib/mypy.allowlist
80-
working-directory: vortex-python/
81-
8278
- name: Pytest - Vortex
8379
run: |
84-
uv run --isolated --all-packages pytest --benchmark-disable test/
80+
uv run --all-packages pytest --benchmark-disable test/
8581
working-directory: vortex-python/
8682

8783
- name: Doctest - PyVortex
8884
run: |
89-
uv run --isolated --all-packages make doctest
85+
uv run --all-packages make doctest
9086
working-directory: docs/
9187

9288
- name: Ensure docs build - PyVortex
9389
run: |
94-
uv run --isolated --all-packages make html
90+
uv run --all-packages make html
9591
working-directory: docs/
9692

9793
- uses: mlugg/setup-zig@v2

docs/api/python/arrays.rst

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,18 @@ of the array, and are also zero-copy to Apache Arrow.
6060
Utility Encodings
6161
-----------------
6262

63-
.. autoclass:: vortex.ChunkedArray
63+
.. autoclass:: vortex.ConstantArray
6464
:members:
6565

6666

67-
.. autoclass:: vortex.ConstantArray
67+
.. autoclass:: vortex.ChunkedArray
6868
:members:
6969

7070

7171
.. autoclass:: vortex.ByteBoolArray
7272
:members:
7373

7474

75-
.. autoclass:: vortex.SparseArray
76-
:members:
77-
78-
7975
Compressed Encodings
8076
--------------------
8177

@@ -103,10 +99,19 @@ Compressed Encodings
10399
:members:
104100

105101

102+
.. autoclass:: vortex.SequenceArray
103+
:members:
104+
105+
106+
.. autoclass:: vortex.SparseArray
107+
:members:
108+
109+
106110
.. autoclass:: vortex.ZigZagArray
107111
:members:
108112

109113

114+
110115
.. autoclass:: vortex.FastLanesBitPackedArray
111116
:members:
112117

@@ -148,4 +153,4 @@ Streams and Iterators
148153
---------------------
149154

150155
.. autoclass:: vortex.ArrayIterator
151-
:members:
156+
:members:

docs/api/python/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ Python API
1111
compress
1212
io
1313
dataset
14+
type_aliases

docs/api/python/type_aliases.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Type Aliases
2+
============
3+
4+
.. data:: vortex.type_aliases.IntoArrayIterator
5+
6+
Anything that can produce a sequence of Vortex Arrays.
7+
8+
9+
.. data:: vortex.type_aliases.IntoProjection
10+
11+
An expression, a list of column names, or None.
12+
13+
Only the data necessary to evaluate the expression or produce the explicit column list are read.
14+
15+
If None, all columns from the file are read.
16+

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"pyarrow": ("https://arrow.apache.org/docs", None),
4444
"pandas": ("https://pandas.pydata.org/docs", None),
4545
"numpy": ("https://numpy.org/doc/stable", None),
46-
"polars": ("https://docs.pola.rs/api/python/stable", None),
46+
"polars": ("https://docs.pola.rs/api/python/stable", "polars.objects.inv"),
4747
}
4848

4949
git_root = Path(__file__).parent.parent
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env -S uv run --script
2+
# /// script
3+
# requires-python = ">=3.12"
4+
# dependencies = [
5+
# "sphobjinv",
6+
# ]
7+
# ///
8+
#
9+
# SPDX-License-Identifier: Apache-2.0
10+
# SPDX-FileCopyrightText: Copyright the Vortex contributors
11+
#
12+
# https://github.com/pola-rs/polars/issues/7027#issuecomment-2661198001
13+
14+
import sphobjinv as soi
15+
16+
inv = soi.Inventory()
17+
inv.project = "Polars"
18+
inv.version = ""
19+
20+
data_obj_strs = [
21+
soi.DataObjStr(
22+
name="polars.DataFrame",
23+
domain="py",
24+
role="class",
25+
priority="1",
26+
uri="reference/dataframe/index.html",
27+
dispname="DataFrame",
28+
),
29+
soi.DataObjStr(
30+
name="polars.LazyFrame",
31+
domain="py",
32+
role="class",
33+
priority="1",
34+
uri="reference/lazyframe/index.html",
35+
dispname="LazyFrame",
36+
),
37+
soi.DataObjStr(
38+
name="Expr",
39+
domain="py",
40+
role="class",
41+
priority="1",
42+
uri="expressions/index.html",
43+
dispname="Expr",
44+
),
45+
soi.DataObjStr(
46+
name="Series",
47+
domain="py",
48+
role="class",
49+
priority="1",
50+
uri="series/index.html",
51+
dispname="Series",
52+
),
53+
]
54+
55+
for data_obj_str in data_obj_strs:
56+
inv.objects.append(data_obj_str)
57+
58+
text = inv.data_file()
59+
ztext = soi.compress(text)
60+
61+
soi.writebytes("polars.objects.inv", ztext)

docs/polars.objects.inv

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Sphinx inventory version 2
2+
# Project: Polars
3+
# Version:
4+
# The remainder of this file is compressed using zlib.
5+
x�}�;
6+
�0��"'Pl����,��@~�Z��7*H@��}3�%����:&�z�$�+͘��#�)��5��O؊euV���O��c���4"���-r."�1�K.\����rr�a� �ERe

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@ required-version = ">=0.6.0"
1919
# Currently, all dev dependencies live in the root since uv doesn't have transitive dev dependencies.
2020
# See: https://github.com/astral-sh/uv/issues/7541
2121
dev-dependencies = [
22+
"basedpyright>=1.31",
2223
"duckdb>=1.1.2",
2324
"ipython>=8.26.0",
2425
"maturin>=1.7.2",
26+
"pandas-stubs>=2.2.3.241126",
2527
"pandas[output-formatting]>=2.2.3",
28+
"pcodec>=0.3.3",
2629
"pip>=23.3.2",
2730
"polars>=1.9.0",
28-
"pyright>=1.1.385",
31+
"pyarrow-stubs>=17.16",
2932
"pytest-benchmark>=4.0.0",
3033
"pytest>=7.4.0",
3134
"ruff>=0.7.1",

0 commit comments

Comments
 (0)