Skip to content

ci: unpin pyright #3584

@MarcoGorelli

Description

@MarcoGorelli

Pyright 1.1.409 is causing several type-checking errors:

./.venv/bin/uv run --no-sync pyright
/home/runner/work/narwhals/narwhals/narwhals/_dask/expr.py
  /home/runner/work/narwhals/narwhals/narwhals/_dask/expr.py:482:36 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
  /home/runner/work/narwhals/narwhals/narwhals/_dask/expr.py:497:35 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
/home/runner/work/narwhals/narwhals/narwhals/_dask/group_by.py
  /home/runner/work/narwhals/narwhals/narwhals/_dask/group_by.py:146:54 - error: "reset_index" is not a known attribute of "None" (reportOptionalMemberAccess)
/home/runner/work/narwhals/narwhals/narwhals/_ibis/namespace.py
  /home/runner/work/narwhals/narwhals/narwhals/_ibis/namespace.py:112:20 - error: Operator "/" not supported for types "Value" and "Value" (reportOperatorIssue)
  /home/runner/work/narwhals/narwhals/narwhals/_ibis/namespace.py:112:27 - error: Argument of type "Overload[(a: SupportsAdd[_T_contra@add, _T_co@add], b: _T_contra@add, /) -> _T_co@add, (a: _T_contra@add, b: SupportsRAdd[_T_contra@add, _T_co@add], /) -> _T_co@add]" cannot be assigned to parameter "function" of type "(_T@reduce, _T@reduce) -> _T@reduce" in function "reduce"
    No overloaded function matches type "(Value, Value) -> Value" (reportArgumentType)
  /home/runner/work/narwhals/narwhals/narwhals/_ibis/namespace.py:113:17 - error: Argument of type "Overload[(a: SupportsAdd[_T_contra@add, _T_co@add], b: _T_contra@add, /) -> _T_co@add, (a: _T_contra@add, b: SupportsRAdd[_T_contra@add, _T_co@add], /) -> _T_co@add]" cannot be assigned to parameter "function" of type "(_T@reduce, _T@reduce) -> _T@reduce" in function "reduce"
    No overloaded function matches type "(Value, Value) -> Value" (reportArgumentType)
/home/runner/work/narwhals/narwhals/narwhals/_polars/dataframe.py
  /home/runner/work/narwhals/narwhals/narwhals/_polars/dataframe.py:485:29 - error: No overloads for "__getitem__" match the provided arguments (reportCallIssue)
  /home/runner/work/narwhals/narwhals/narwhals/_polars/dataframe.py:485:29 - error: Argument of type "slice[int | Any | str | None, Any | int | str | None, Any | int]" cannot be assigned to parameter "s" of type "slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" in function "__getitem__"
    "slice[int | Any | str | None, Any | int | str | None, Any | int]" is not assignable to "slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]"
      Type parameter "_StartT_co@slice" is covariant, but "int | Any | str | None" is not a subtype of "SupportsIndex | None"
        Type "int | Any | str | None" is not assignable to type "SupportsIndex | None"
          Type "str" is not assignable to type "SupportsIndex | None"
            "str" is incompatible with protocol "SupportsIndex"
            "str" is not assignable to "None"
      Type parameter "_StopT_co@slice" is covariant, but "Any | int | str | None" is not a subtype of "SupportsIndex | None"
        Type "Any | int | str | None" is not assignable to type "SupportsIndex | None" (reportArgumentType)
/home/runner/work/narwhals/narwhals/narwhals/_sql/expr.py
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr.py:468:17 - error: Argument of type "NativeExprT@SQLExpr" cannot be assigned to parameter "b" of type "SupportsRMul[_T_contra@mul, _T_co@mul]" in function "mul"
    "NativeExpr*" is incompatible with protocol "SupportsRMul[NativeExprT@SQLExpr, _T_co@mul]"
      "__rmul__" is not present (reportArgumentType)
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr.py:468:40 - error: No overloads for "sub" match the provided arguments (reportCallIssue)
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr.py:468:59 - error: Argument of type "Literal[1]" cannot be assigned to parameter "b" of type "SupportsRSub[_T_contra(1)@sub, _T_co(1)@sub]" in function "sub"
    "Literal[1]" is incompatible with protocol "SupportsRSub[NativeExprT@SQLExpr, _T_co(1)@sub]"
      Type parameter "_T_contra@SupportsRSub" is contravariant, but "int" is not a supertype of "NativeExprT@SQLExpr"
        "NativeExpr*" is not assignable to "int" (reportArgumentType)
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr.py:468:65 - error: No overloads for "sub" match the provided arguments (reportCallIssue)
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr.py:468:83 - error: Argument of type "int" cannot be assigned to parameter "b" of type "SupportsRSub[_T_contra(2)@sub, _T_co(2)@sub]" in function "sub"
    "int" is incompatible with protocol "SupportsRSub[NativeExprT@SQLExpr, _T_co(2)@sub]"
      Type parameter "_T_contra@SupportsRSub" is contravariant, but "int" is not a supertype of "NativeExprT@SQLExpr"
        "NativeExpr*" is not assignable to "int" (reportArgumentType)
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr.py:482:17 - error: No overloads for "sub" match the provided arguments (reportCallIssue)
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr.py:482:35 - error: Argument of type "Literal[1]" cannot be assigned to parameter "b" of type "SupportsRSub[_T_contra@sub, _T_co@sub]" in function "sub"
    "Literal[1]" is incompatible with protocol "SupportsRSub[NativeExprT@SQLExpr, _T_co@sub]"
      Type parameter "_T_contra@SupportsRSub" is contravariant, but "int" is not a supertype of "NativeExprT@SQLExpr"
        "NativeExpr*" is not assignable to "int" (reportArgumentType)
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr.py:482:40 - error: No overloads for "sub" match the provided arguments (reportCallIssue)
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr.py:482:58 - error: Argument of type "int" cannot be assigned to parameter "b" of type "SupportsRSub[_T_contra(1)@sub, _T_co(1)@sub]" in function "sub"
    "int" is incompatible with protocol "SupportsRSub[NativeExprT@SQLExpr, _T_co(1)@sub]"
      Type parameter "_T_contra@SupportsRSub" is contravariant, but "int" is not a supertype of "NativeExprT@SQLExpr"
        "NativeExpr*" is not assignable to "int" (reportArgumentType)
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr.py:530:17 - error: Argument of type "NativeExprT@SQLExpr" cannot be assigned to parameter "b" of type "SupportsRAdd[_T_contra@add, _T_co@add]" in function "add"
    "NativeExpr*" is incompatible with protocol "SupportsRAdd[NativeExprT@SQLExpr, _T_co@add]"
      "__radd__" is not present (reportArgumentType)
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr.py:537:17 - error: No overloads for "add" match the provided arguments (reportCallIssue)
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr.py:539:21 - error: Argument of type "NativeExprT@SQLExpr" cannot be assigned to parameter "b" of type "SupportsRAdd[_T_contra@add, _T_co@add]" in function "add"
    "NativeExpr*" is incompatible with protocol "SupportsRAdd[NativeExprT@SQLExpr, _T_co@add]"
      "__radd__" is not present (reportArgumentType)
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr.py:698:17 - error: No overloads for "sub" match the provided arguments (reportCallIssue)
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr.py:698:30 - error: Argument of type "NativeExprT@SQLExpr" cannot be assigned to parameter "b" of type "SupportsRSub[_T_contra@sub, _T_co@sub]" in function "sub"
    "NativeExpr*" is incompatible with protocol "SupportsRSub[NativeExprT@SQLExpr, _T_co@sub]"
      "__rsub__" is not present (reportArgumentType)
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr.py:834:21 - error: No overloads for "add" match the provided arguments (reportCallIssue)
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr.py:836:25 - error: Argument of type "NativeExprT@SQLExpr" cannot be assigned to parameter "b" of type "SupportsRAdd[_T_contra@add, _T_co@add]" in function "add"
    "NativeExpr*" is incompatible with protocol "SupportsRAdd[NativeExprT@SQLExpr, _T_co@add]"
      "__radd__" is not present (reportArgumentType)
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr.py:844:25 - error: No overloads for "sub" match the provided arguments (reportCallIssue)
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr.py:844:75 - error: Argument of type "NativeExprT@SQLExpr" cannot be assigned to parameter "b" of type "SupportsRSub[_T_contra@sub, _T_co@sub]" in function "sub"
    "NativeExpr*" is incompatible with protocol "SupportsRSub[NativeExprT@SQLExpr, _T_co@sub]"
      "__rsub__" is not present (reportArgumentType)
/home/runner/work/narwhals/narwhals/narwhals/_sql/expr_str.py
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr_str.py:70:17 - error: No overloads for "add" match the provided arguments (reportCallIssue)
  /home/runner/work/narwhals/narwhals/narwhals/_sql/expr_str.py:70:42 - error: Argument of type "NativeExpr" cannot be assigned to parameter "b" of type "SupportsRAdd[_T_contra@add, _T_co@add]" in function "add"
    "NativeExpr" is incompatible with protocol "SupportsRAdd[NativeExpr, _T_co@add]"
      "__radd__" is not present (reportArgumentType)
/home/runner/work/narwhals/narwhals/narwhals/_sql/namespace.py
  /home/runner/work/narwhals/narwhals/narwhals/_sql/namespace.py:63:17 - error: Argument of type "Overload[(a: SupportsAdd[_T_contra@add, _T_co@add], b: _T_contra@add, /) -> _T_co@add, (a: _T_contra@add, b: SupportsRAdd[_T_contra@add, _T_co@add], /) -> _T_co@add]" cannot be assigned to parameter "function" of type "(_T@reduce, _T@reduce) -> _T@reduce" in function "reduce"
    No overloaded function matches type "(NativeExprT@SQLNamespace, NativeExprT@SQLNamespace) -> NativeExprT@SQLNamespace" (reportArgumentType)
29 errors, 0 warnings, 0 informations
make: *** [Makefile:26: typing] Error 1

I'm temporarily pinning pyright to get CI green, but we should fix these

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions