Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,12 @@ on:
- synchronize

jobs:
taplo:
name: taplo
taplo-lint:
name: taplo lint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: uncenter/setup-taplo@v1
with:
version: "0.9.3"
- run: taplo fmt --check

pyright:
name: pyright
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: pyright
- run: |
python -m venv .venv
source .venv/bin/activate
pip install pandas numpy scipy sparse
- run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
- uses: jakebailey/pyright-action@v2
8 changes: 3 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
ci:
autofix_prs: false
skip: [pyright]

default_language_version:
python: python3.11
node: 23.9.0

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -27,7 +25,7 @@ repos:
args: [--fix]
- id: ruff-format

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.400
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
hooks:
- id: pyright
- id: mypy
166 changes: 66 additions & 100 deletions pixi.lock

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions pyarrow-stubs/__lib_pxi/array.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# mypy: disable-error-code="overload-overlap,misc,type-arg"

import datetime as dt
import sys

Expand Down Expand Up @@ -61,6 +63,7 @@ from .types import (
_IndexT,
_RunEndType,
_Size,
_ValueT,
)

_T = TypeVar("_T")
Expand Down Expand Up @@ -1624,25 +1627,25 @@ class RunEndEncodedArray(Array[scalar.RunEndEncodedScalar[_RunEndType, _BasicVal
def from_arrays(
run_ends: Int16Array,
values: Array,
type: DataType | None = None,
type: _ValueT | None = None,
) -> RunEndEncodedArray[types.Int16Type, _BasicValueT]: ...
@overload
@staticmethod
def from_arrays(
run_ends: Int32Array,
values: Array,
type: DataType | None = None,
type: _ValueT | None = None,
) -> RunEndEncodedArray[types.Int32Type, _BasicValueT]: ...
@overload
@staticmethod
def from_arrays(
run_ends: Int64Array,
values: Array,
type: DataType | None = None,
type: _ValueT | None = None,
) -> RunEndEncodedArray[types.Int64Type, _BasicValueT]: ...
@staticmethod
def from_buffers(
type: DataType,
def from_buffers( # type: ignore[override]
type: _ValueT,
length: int,
buffers: list[Buffer],
null_count: int = -1,
Expand Down
1 change: 1 addition & 0 deletions pyarrow-stubs/__lib_pxi/pandas_shim.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# mypy: disable-error-code="name-defined"
from types import ModuleType
from typing import Any, Iterable, TypeGuard

Expand Down
1 change: 1 addition & 0 deletions pyarrow-stubs/__lib_pxi/scalar.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# mypy: disable-error-code="overload-overlap,misc,type-arg"
import collections.abc
import datetime as dt
import sys
Expand Down
2 changes: 2 additions & 0 deletions pyarrow-stubs/__lib_pxi/table.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# mypy: disable-error-code="overload-overlap,type-arg,misc"

import datetime as dt
import sys

Expand Down
4 changes: 3 additions & 1 deletion pyarrow-stubs/__lib_pxi/tensor.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# mypy: disable-error-code="import-untyped"

import sys

if sys.version_info >= (3, 11):
Expand All @@ -8,8 +10,8 @@ else:
import numpy as np

from pyarrow.lib import _Weakrefable
from pydata.sparse import COO # type: ignore[import-not-found]
from scipy.sparse import coo_matrix, csr_matrix
from sparse import COO

class Tensor(_Weakrefable):
@classmethod
Expand Down
2 changes: 1 addition & 1 deletion pyarrow-stubs/_stubs_typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Compression: TypeAlias = Literal[
NullEncoding: TypeAlias = Literal["mask", "encode"]
NullSelectionBehavior: TypeAlias = Literal["drop", "emit_null"]
Mask: TypeAlias = Sequence[bool | None] | NDArray[np.bool_] | BooleanArray
Indices: TypeAlias = Sequence[int] | NDArray[np.integer[Any]] | IntegerArray
Indices: TypeAlias = Sequence[int] | NDArray[np.integer] | IntegerArray
PyScalar: TypeAlias = (
bool | int | float | Decimal | str | bytes | dt.date | dt.datetime | dt.time | dt.timedelta
)
Expand Down
1 change: 1 addition & 0 deletions pyarrow-stubs/compute.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# mypy: disable-error-code="misc,type-var,var-annotated"
# ruff: noqa: I001
from typing import Literal, TypeAlias, TypeVar, overload, Any, Iterable, ParamSpec, Sequence
from collections.abc import Callable
Expand Down
11 changes: 7 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ pyarrow-stubs = { path = ".", editable = true }
ipython = "*"
scipy = "*"
pre-commit = "*"
mypy = ">=1.11"
ruff = ">=0.5"
types-cffi = "*"
pandas-stubs = "*"
hatchling = "*"
fsspec = "*"
sparse = "*"
pyright = { version = ">=1.1.385,<2", extras = ["nodejs"] }

[tool.pixi.tasks]
Expand Down Expand Up @@ -85,6 +85,9 @@ lines-between-types = 1
[tool.ruff.format]
docstring-code-format = true

[tool.pyright]
typeCheckingMode = "basic"
reportMissingImports = false
[tool.mypy]
explicit_package_bases = true
files = "pyarrow-stubs"
namespace_packages = true
show_error_codes = true
disable_error_code = ["overload-overlap", "import-not-found"]