Skip to content

Commit 3c88f4d

Browse files
committed
Merge remote-tracking branch 'upstream/main' into refac-native-module
2 parents 56aa417 + f05011c commit 3c88f4d

File tree

103 files changed

+2364
-568
lines changed

Some content is hidden

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

103 files changed

+2364
-568
lines changed

.github/workflows/downstream_tests.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ jobs:
187187
run: |
188188
cd py-shiny
189189
. .venv/bin/activate
190-
# temporary to get CI green
191-
uv pip install "chatlas<0.9.0"
192190
make narwhals-install-shiny
193191
- name: install-narwhals-dev
194192
run: |
@@ -242,11 +240,6 @@ jobs:
242240
cd tea-tasting
243241
uv pip uninstall narwhals
244242
uv pip install -e ./..
245-
- name: temporary pin duckdb # TODO(FBruzzesi): Unpin duckdb
246-
run: |
247-
cd tea-tasting
248-
uv pip uninstall duckdb
249-
uv pip install "duckdb<1.4"
250243
- name: show-deps
251244
run: |
252245
cd tea-tasting
@@ -292,8 +285,6 @@ jobs:
292285
run: |
293286
uv pip uninstall narwhals --system
294287
uv pip install -e . --system
295-
# temporary pin to get CI green
296-
uv pip install "polars<1.30" --system
297288
- name: show-deps
298289
run: uv pip freeze
299290
- name: Run pytest

.github/workflows/extremes.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
cache-suffix: min-versions-${{ matrix.python-version }}
3030
cache-dependency-glob: "pyproject.toml"
3131
- name: install-minimum-versions
32-
run: uv pip install pipdeptree tox virtualenv setuptools pandas==1.1.3 polars==0.20.4 numpy==1.19.3 pyarrow==13.0.0 "pyarrow-stubs<17" scipy==1.6.0 scikit-learn==1.1.0 duckdb==1.0 tzdata --system
32+
run: uv pip install pipdeptree tox virtualenv setuptools pandas==1.1.3 polars==0.20.4 numpy==1.19.3 pyarrow==13.0.0 "pyarrow-stubs<17" scipy==1.6.0 scikit-learn==1.1.0 duckdb==1.1 tzdata --system
3333
- name: install-reqs
3434
run: |
3535
uv pip install -e . --group tests --system
@@ -44,9 +44,9 @@ jobs:
4444
echo "$DEPS" | grep 'pyarrow==13.0.0'
4545
echo "$DEPS" | grep 'scipy==1.6.0'
4646
echo "$DEPS" | grep 'scikit-learn==1.1.0'
47-
echo "$DEPS" | grep 'duckdb==1.0'
47+
echo "$DEPS" | grep 'duckdb==1.1'
4848
- name: Run pytest
49-
run: pytest tests --cov=narwhals --cov=tests --cov-fail-under=50 --runslow --constructors=pandas,pyarrow,polars[eager],polars[lazy]
49+
run: pytest tests --cov=narwhals --cov=tests --cov-fail-under=50 --runslow --constructors=pandas,pyarrow,polars[eager],polars[lazy],duckdb
5050

5151
pretty_old_versions:
5252
strategy:
@@ -66,7 +66,7 @@ jobs:
6666
cache-suffix: pretty-old-versions-${{ matrix.python-version }}
6767
cache-dependency-glob: "pyproject.toml"
6868
- name: install-pretty-old-versions
69-
run: uv pip install pipdeptree tox virtualenv setuptools pandas==1.1.5 polars==0.20.4 numpy==1.19.3 pyarrow==14.0.0 "pyarrow-stubs<17" scipy==1.6.0 scikit-learn==1.1.0 duckdb==1.0 tzdata --system
69+
run: uv pip install pipdeptree tox virtualenv setuptools pandas==1.1.5 polars==0.20.4 numpy==1.19.3 pyarrow==14.0.0 "pyarrow-stubs<17" scipy==1.6.0 scikit-learn==1.1.0 duckdb==1.2 tzdata --system
7070
- name: install-reqs
7171
run: uv pip install -e . --group tests --system
7272
- name: show-deps
@@ -82,9 +82,9 @@ jobs:
8282
echo "$DEPS" | grep 'pyarrow==14.0.0'
8383
echo "$DEPS" | grep 'scipy==1.6.0'
8484
echo "$DEPS" | grep 'scikit-learn==1.1.0'
85-
echo "$DEPS" | grep 'duckdb==1.0'
85+
echo "$DEPS" | grep 'duckdb==1.2'
8686
- name: Run pytest
87-
run: pytest tests --cov=narwhals --cov=tests --cov-fail-under=50 --runslow --constructors=pandas,pyarrow,polars[eager],polars[lazy]
87+
run: pytest tests --cov=narwhals --cov=tests --cov-fail-under=50 --runslow --constructors=pandas,pyarrow,polars[eager],polars[lazy],duckdb
8888

8989
not_so_old_versions:
9090
strategy:
@@ -104,7 +104,7 @@ jobs:
104104
cache-suffix: not-so-old-versions-${{ matrix.python-version }}
105105
cache-dependency-glob: "pyproject.toml"
106106
- name: install-not-so-old-versions
107-
run: uv pip install tox virtualenv setuptools pandas==2.0.3 polars==0.20.8 numpy==1.24.4 pyarrow==15.0.0 "pyarrow-stubs<17" scipy==1.8.0 scikit-learn==1.3.0 duckdb==1.0 dask[dataframe]==2024.10 tzdata --system
107+
run: uv pip install tox virtualenv setuptools pandas==2.0.3 polars==0.20.8 numpy==1.24.4 pyarrow==15.0.0 "pyarrow-stubs<17" scipy==1.8.0 scikit-learn==1.3.0 duckdb==1.3 dask[dataframe]==2024.10 tzdata --system
108108
- name: install-reqs
109109
run: uv pip install -e . --group tests --system
110110
- name: show-deps
@@ -119,9 +119,9 @@ jobs:
119119
echo "$DEPS" | grep 'scipy==1.8.0'
120120
echo "$DEPS" | grep 'scikit-learn==1.3.0'
121121
echo "$DEPS" | grep 'dask==2024.10'
122-
echo "$DEPS" | grep 'duckdb==1.0'
122+
echo "$DEPS" | grep 'duckdb==1.3'
123123
- name: Run pytest
124-
run: pytest tests --cov=narwhals --cov=tests --cov-fail-under=50 --runslow --constructors=pandas,pyarrow,polars[eager],polars[lazy],dask
124+
run: pytest tests --cov=narwhals --cov=tests --cov-fail-under=50 --runslow --constructors=pandas,pyarrow,polars[eager],polars[lazy],dask,duckdb
125125

126126
nightlies:
127127
strategy:
@@ -152,10 +152,8 @@ jobs:
152152
uv pip install pandas --pre --index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple --system -U
153153
- name: install pyarrow nightly
154154
run: |
155-
# commented out nightly whilst it fails to install
156-
uv pip install -U pyarrow --system
157-
# uv pip uninstall pyarrow --system
158-
# uv pip install pyarrow --pre --index https://pypi.fury.io/arrow-nightlies/ --system -U
155+
uv pip uninstall pyarrow --system
156+
uv pip install pyarrow --pre --index https://pypi.fury.io/arrow-nightlies/ --system -U
159157
- name: install numpy nightly
160158
run: |
161159
uv pip uninstall numpy --system
@@ -174,9 +172,10 @@ jobs:
174172
run: |
175173
DEPS=$(uv pip freeze)
176174
echo "$DEPS" | grep 'pandas.*dev'
177-
# echo "$DEPS" | grep 'pyarrow.*dev'
175+
echo "$DEPS" | grep 'pyarrow.*dev'
178176
echo "$DEPS" | grep 'numpy.*dev'
179177
echo "$DEPS" | grep 'dask.*@'
178+
echo "$DEPS" | grep 'duckdb.*dev'
180179
- name: Run pytest
181180
run: |
182181
pytest tests --cov=narwhals --cov=tests --cov-fail-under=50 --runslow \

.pre-commit-config.yaml

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ci:
33
repos:
44
- repo: https://github.com/astral-sh/ruff-pre-commit
55
# Ruff version.
6-
rev: 'v0.13.0'
6+
rev: 'v0.14.0'
77
hooks:
88
# Run the formatter.
99
- id: ruff-format
@@ -22,10 +22,12 @@ repos:
2222
args: [--ignore-words-list=ser]
2323
exclude: ^docs/api-completeness.md$
2424
- repo: https://github.com/pycqa/flake8
25-
rev: '7.3.0' # todo: remove once https://github.com/astral-sh/ruff/issues/458 is addressed
25+
rev: '7.3.0'
2626
hooks:
2727
- id: flake8
28-
additional_dependencies: [darglint==1.8.1, Flake8-pyproject]
28+
# TODO(unassigned): replace with ruff once https://github.com/astral-sh/ruff/issues/458 is addressed.
29+
name: darglint
30+
alias: darglint
2931
entry: flake8 --select DAR --ignore DAR101,DAR201,DAR401,DAR402
3032
exclude: |
3133
(?x)^(
@@ -39,6 +41,15 @@ repos:
3941
# Soft-deprecated, so less crucial to document so carefully
4042
narwhals/stable/v1/.*
4143
)$
44+
# Keep in sync with `flake8-typing-imports` so the same venv is reused.
45+
additional_dependencies: [darglint==1.8.1, flake8-typing-imports==1.17.0]
46+
- id: flake8
47+
# TODO(unassigned): replace with ruff once https://github.com/astral-sh/ruff/issues/2302 is addressed.
48+
name: flake8-typing-imports
49+
alias: flake8-typing-imports
50+
entry: flake8 --select TYP --min-python-version=3.9.0
51+
# Keep in sync with `darglint` so the same venv is reused.
52+
additional_dependencies: [darglint==1.8.1, flake8-typing-imports==1.17.0]
4253
- repo: local
4354
hooks:
4455
- id: check-api-reference
@@ -47,6 +58,16 @@ repos:
4758
entry: python -m utils.check_api_reference
4859
language: python
4960
additional_dependencies: [polars]
61+
- id: sort-api-reference
62+
name: sort-api-reference
63+
pass_filenames: false
64+
entry: python -m utils.sort_api_reference
65+
language: python
66+
- id: check-slotted-classes
67+
name: check-slotted-classes
68+
pass_filenames: false
69+
entry: python -m utils.check_slotted_classes
70+
language: python
5071
- id: imports-are-banned
5172
name: import are banned (use `get_pandas` instead of `import pandas`)
5273
entry: python utils/import_check.py
@@ -62,12 +83,12 @@ repos:
6283
name: don't import from narwhals.dtypes (use `Version.dtypes` instead)
6384
entry: |
6485
(?x)
65-
import\ narwhals.dtypes|
66-
from\ narwhals\ import\ dtypes|
67-
from\ narwhals.dtypes\ import\ [^D_]+|
68-
import\ narwhals.stable.v1.dtypes|
69-
from\ narwhals.stable\.v.\ import\ dtypes|
70-
from\ narwhals.stable\.v.\.dtypes\ import
86+
import\ narwhals(\.stable\.v\d)?\.dtypes|
87+
from\ narwhals(\.stable\.v\d)?\ import\ dtypes|
88+
^from\ narwhals(\.stable\.v\d)?\.dtypes\ import
89+
\ (DType,\ )?
90+
((Datetime|Duration|Enum)(,\ )?)+
91+
((,\ )?DType)?
7192
language: pygrep
7293
files: ^narwhals/
7394
exclude: |
@@ -84,7 +105,7 @@ repos:
84105
language: pygrep
85106
files: ^\.github/workflows/
86107
- repo: https://github.com/adamchainz/blacken-docs
87-
rev: "1.19.1" # replace with latest tag on GitHub
108+
rev: "1.20.0" # replace with latest tag on GitHub
88109
hooks:
89110
- id: blacken-docs
90111
args: [--skip-errors]

docs/api-reference/dataframe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@
4444
- shape
4545
- sort
4646
- tail
47-
- top_k
4847
- to_arrow
4948
- to_dict
5049
- to_native
5150
- to_numpy
5251
- to_pandas
5352
- to_polars
53+
- top_k
5454
- unique
5555
- unpivot
5656
- with_columns

docs/api-reference/expr_dt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
- replace_time_zone
1919
- second
2020
- timestamp
21+
- to_string
2122
- total_microseconds
2223
- total_milliseconds
2324
- total_minutes
2425
- total_nanoseconds
2526
- total_seconds
26-
- to_string
2727
- truncate
2828
- weekday
2929
- year

docs/api-reference/expr_str.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- to_date
1919
- to_datetime
2020
- to_lowercase
21+
- to_titlecase
2122
- to_uppercase
2223
- zfill
2324
show_source: false

docs/api-reference/lazyframe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
- sink_parquet
2626
- sort
2727
- tail
28-
- top_k
2928
- to_native
29+
- top_k
3030
- unique
3131
- unpivot
3232
- with_columns

docs/api-reference/narwhals.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ Here are the top-level functions available in Narwhals.
4444
- read_parquet
4545
- scan_csv
4646
- scan_parquet
47+
- show_versions
4748
- sum
4849
- sum_horizontal
49-
- show_versions
5050
- to_native
5151
- to_py_scalar
5252
- when

docs/api-reference/schema.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
handler: python
55
options:
66
members:
7-
- names
87
- dtypes
98
- from_arrow
109
- from_native
1110
- from_pandas_like
1211
- from_polars
1312
- len
13+
- names
1414
- to_arrow
1515
- to_pandas
1616
- to_polars

docs/api-reference/series.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
- median
6060
- min
6161
- mode
62-
- name
6362
- n_unique
63+
- name
6464
- null_count
6565
- pipe
6666
- quantile
@@ -76,8 +76,8 @@
7676
- scatter
7777
- shape
7878
- shift
79-
- sort
8079
- skew
80+
- sort
8181
- sqrt
8282
- std
8383
- sum
@@ -86,10 +86,10 @@
8686
- to_dummies
8787
- to_frame
8888
- to_list
89+
- to_native
8990
- to_numpy
9091
- to_pandas
9192
- to_polars
92-
- to_native
9393
- unique
9494
- value_counts
9595
- var

0 commit comments

Comments
 (0)