You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(typing): Backport generic Series to v1 (#2110)
* feat(typing): Backport generic `Series` to `v1`
Related:
- #1412
- #1930
- https://narwhals-dev.github.io/narwhals/backcompat/#breaking-changes-carried-out-so-far
* fix(typing): Remove `mypy`-breaking `Any`
That now would trigger **15** `[var-annotated]` warnings in our tests:
```py
tests/utils_test.py:39: error: Need type annotation for "s" [var-annotated]
s = nw.from_native(pd.Series([1, 2, 3], index=[2, 1, 0]), series_only=True)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/utils_test.py:65: error: Need type annotation for "s" [var-annotated]
s = nw.from_native(pd.Series([1, 2, 3], index=[2, 2, 0]), series_only=True)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/utils_test.py:72: error: Need type annotation for "s" [var-annotated]
s = nw.from_native(pl.Series([1, 2, 3]), series_only=True)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/utils_test.py:171: error: Need type annotation for "index" [var-annotated]
index = nw.from_native(pd.Series([0, 1, 2]), series_only=True)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/utils_test.py:198: error: Need type annotation for "series" [var-annotated]
series = nw.from_native(pl.Series([1, 2, 3]), series_only=True)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/utils_test.py:215: error: Need type annotation for "pandas_series" [var-annotated]
pandas_series = nw.from_native(
^
tests/utils_test.py:232: error: Need type annotation for "series" [var-annotated]
series = nw.from_native(pl.Series([1, 2, 3]), series_only=True)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/stable_api_test.py:136: error: Need type annotation for "stable_df" [var-annotated]
stable_df = nw_v1.from_native(pl.Series(), series_only=True)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/dtypes_test.py:152: error: Need type annotation for "result" [var-annotated]
result = nw.from_native(s, series_only=True)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/dtypes_test.py:182: error: Need type annotation for "snw" [var-annotated]
snw = nw.from_native(s, series_only=True)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/translate/from_native_test.py:140: error: Need type annotation for "res" [var-annotated]
res = nw.from_native(obj, series_only=True)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/series_only/hist_test.py:277: error: Need type annotation for "s" [var-annotated]
s = nw.from_native(pl.Series([1, 2, 3]), series_only=True)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/series_only/arrow_c_stream_test.py:18: error: Need type annotation for "s" [var-annotated]
s = nw.from_native(pl.Series([1, 2, 3]), series_only=True)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/series_only/arrow_c_stream_test.py:31: error: Need type annotation for "s" [var-annotated]
s = nw.from_native(pl.Series([1, 2, 3]), series_only=True)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/expr_and_series/cast_test.py:172: error: Need type annotation for "s" [var-annotated]
s = nw.from_native(s_pd, series_only=True)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 15 errors in 7 files (checked 345 source files)
```
* fix(typing): Try with a default for downstream
Hoping to fix:
- https://github.com/narwhals-dev/narwhals/actions/runs/13567019217/job/37922302040?pr=2110
- https://github.com/narwhals-dev/narwhals/actions/runs/13567019217/job/37922302040?pr=2110
* test(typing): add repro for bug found in `altair`
#2110 (comment)
0 commit comments