Skip to content

Commit 2a8212c

Browse files
authored
Merge branch 'expr-ir/over-and-over-and-over-again' into expr-ir/strict-selectors
2 parents 109537c + eef6189 commit 2a8212c

File tree

182 files changed

+3729
-3315
lines changed

Some content is hidden

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

182 files changed

+3729
-3315
lines changed

.github/ISSUE_TEMPLATE/feature_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ body:
1010
- type: markdown
1111
attributes:
1212
value: >
13-
### Before submitting a request, please check if it has already been discused in the
13+
### Before submitting a request, please check if it has already been discussed in the
1414
[list of issues](https://github.com/narwhals-dev/narwhals/issues?q=is%3Aissue+is%3Aclosed%2Bopen+).
1515
- type: textarea
1616
attributes:

.github/workflows/downstream_tests.yml

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ jobs:
4848
run: |
4949
cd altair
5050
pytest tests
51-
- name: Run mypy
52-
run: |
53-
cd altair
54-
mypy altair tests
51+
# Temporarily commented-out to get CI green
52+
# https://github.com/narwhals-dev/narwhals/issues/3013
53+
# - name: Run mypy
54+
# run: |
55+
# cd altair
56+
# mypy altair tests
5557

5658
marimo:
5759
strategy:
@@ -187,6 +189,8 @@ jobs:
187189
run: |
188190
cd py-shiny
189191
. .venv/bin/activate
192+
# temporary pin to get CI green
193+
uv pip install "flake8-bugbear<25.10.21"
190194
make narwhals-install-shiny
191195
- name: install-narwhals-dev
192196
run: |
@@ -598,3 +602,43 @@ jobs:
598602
run: |
599603
cd gt-extras
600604
uv run --no-sync pytest
605+
606+
fairlearn:
607+
strategy:
608+
matrix:
609+
python-version: ["3.12"]
610+
os: [ubuntu-latest]
611+
612+
runs-on: ${{ matrix.os }}
613+
steps:
614+
- uses: actions/checkout@v5
615+
- uses: actions/setup-python@v6
616+
with:
617+
python-version: ${{ matrix.python-version }}
618+
- name: Install uv
619+
uses: astral-sh/setup-uv@v6
620+
with:
621+
enable-cache: "true"
622+
cache-suffix: fairlearn-${{ matrix.python-version }}
623+
cache-dependency-glob: "pyproject.toml"
624+
- name: clone-fairlearn
625+
run: |
626+
git clone https://github.com/fairlearn/fairlearn.git --depth 1
627+
cd fairlearn
628+
git log
629+
- name: install-deps
630+
run: |
631+
cd fairlearn
632+
uv pip install -e . -r requirements.txt matplotlib polars pyarrow pytest typing-extensions --system
633+
- name: install-narwhals-dev
634+
run: |
635+
cd fairlearn
636+
uv pip uninstall narwhals --system
637+
uv pip install -e ./.. --system
638+
uv pip freeze
639+
- name: run-pytest
640+
run: |
641+
cd fairlearn
642+
# TODO(FBruzzesi): I hope this will be simplified once there is a decision on
643+
# https://github.com/fairlearn/fairlearn/issues/1555
644+
pytest test/unit/preprocessing test/unit/metrics

.github/workflows/pytest-pyspark.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ jobs:
7474
java-version: 17
7575

7676
- name: install-reqs
77-
run: uv pip install -e . --group core-tests --group extra --system
77+
# temporary pin to get CI green
78+
run: uv pip install -e . --group core-tests --group extra "pyarrow<22.0" --system
7879
- name: install pyspark
7980
run: echo "setuptools<78" | uv pip install -e . "pyspark[connect]==${SPARK_VERSION}" --system
8081
- name: show-deps

.github/workflows/pytest.yml

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
run: uv pip freeze
3434
- name: Run pytest
3535
run: pytest tests --cov=narwhals --cov=tests --cov-fail-under=75 --constructors=pandas,pyarrow,polars[eager],polars[lazy]
36+
- name: install-test-plugin
37+
run: uv pip install -e tests/test_plugin --system
3638

3739
pytest-windows:
3840
strategy:
@@ -54,6 +56,8 @@ jobs:
5456
- name: install-reqs
5557
# we are not testing pyspark, modin, or dask on Windows here because nobody got time for that
5658
run: uv pip install -e ".[ibis]" --group core-tests --group extra --system
59+
- name: install-test-plugin
60+
run: uv pip install -e tests/test_plugin --system
5761
- name: show-deps
5862
run: uv pip freeze
5963
- name: Run pytest
@@ -84,14 +88,16 @@ jobs:
8488
cache-dependency-glob: "pyproject.toml"
8589
- name: install-reqs
8690
run: uv pip install -e ".[dask, modin, ibis]" --group core-tests --group extra --system
91+
- name: install-test-plugin
92+
run: uv pip install -e tests/test_plugin --system
8793
- name: show-deps
8894
run: uv pip freeze
8995
- name: Run pytest
9096
run: pytest tests --cov=narwhals --cov=tests --cov-fail-under=100 --runslow --constructors=pandas,pandas[nullable],pandas[pyarrow],pyarrow,modin[pyarrow],polars[eager],polars[lazy],dask,duckdb,sqlframe,ibis --durations=30
9197
- name: Run doctests
9298
# reprs differ between versions, so we only run doctests on the latest Python
9399
if: matrix.python-version == '3.13'
94-
run: pytest narwhals/*.py --doctest-modules
100+
run: pytest narwhals --doctest-modules
95101

96102
# Test against smaller dependency set, used e.g. on Gentoo.
97103
pytest-narrower-dependencies:
@@ -112,17 +118,24 @@ jobs:
112118
cache-suffix: pytest-narrower-deps-${{ matrix.python-version }}
113119
cache-dependency-glob: "pyproject.toml"
114120
- name: install-reqs
115-
run: uv pip install -e ".[pandas]" --group tests --system
116-
- name: show-deps
117-
run: uv pip freeze
118-
- name: Run pytest
121+
run: |
122+
uv pip install -e ".[pandas]" --group tests --system
123+
uv pip freeze
124+
- name: Run pytest (pandas and pandas[nullable])
119125
run: pytest tests --runslow --constructors=pandas,pandas[nullable]
120126
- name: install-more-reqs
121-
run: uv pip install -U pyarrow --system
122-
- name: show-deps
123-
run: uv pip freeze
124-
- name: Run pytest
127+
run: |
128+
uv pip install -U pyarrow --system
129+
uv pip freeze
130+
- name: Run pytest (pandas[pyarrow] and pyarrow)
125131
run: pytest tests --runslow --constructors=pandas[pyarrow],pyarrow
132+
- name: install-polars
133+
run: |
134+
uv pip uninstall pandas pyarrow --system
135+
uv pip install polars --system
136+
uv pip freeze
137+
- name: Run pytest (polars)
138+
run: pytest tests --runslow --constructors=polars[eager],polars[lazy]
126139

127140
python-314:
128141
strategy:
@@ -141,13 +154,9 @@ jobs:
141154
enable-cache: "true"
142155
cache-suffix: python-314-${{ matrix.python-version }}
143156
cache-dependency-glob: "pyproject.toml"
144-
- name: install pyarrow nightly
145-
run: |
146-
uv pip uninstall pyarrow --system
147-
uv pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple pyarrow -U --system
148157
- name: install-reqs
149158
# Use `--pre` as duckdb stable not compatible with 3.14
150-
run: uv pip install -e . --group tests --pre pandas polars duckdb sqlframe --system
159+
run: uv pip install -e . --group tests --pre pandas polars pyarrow duckdb sqlframe --system
151160
- name: show-deps
152161
run: uv pip freeze
153162
- name: Run pytest
@@ -172,12 +181,8 @@ jobs:
172181
enable-cache: "true"
173182
cache-suffix: python-314t-${{ matrix.python-version }}
174183
cache-dependency-glob: "pyproject.toml"
175-
- name: install pyarrow nightly
176-
run: |
177-
uv pip uninstall pyarrow --system
178-
uv pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple pyarrow -U --system
179184
- name: install-reqs
180-
run: uv pip install -e . --group tests --pre pandas --system
185+
run: uv pip install -e . --group tests --pre pandas pyarrow --system
181186
- name: show-deps
182187
run: uv pip freeze
183188
- name: Run pytest

.github/workflows/random_ci_pytest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
cache-dependency-glob: "pyproject.toml"
2929
- name: generate-random-versions
3030
run: python utils/generate_random_versions.py
31-
- name: install-random-verions
31+
- name: install-random-versions
3232
run: uv pip install -r random-requirements.txt --system
3333
- name: install-narwhals
3434
run: uv pip install -e . --group tests --system

.pre-commit-config.yaml

Lines changed: 10 additions & 2 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.14.0'
6+
rev: 'v0.14.2'
77
hooks:
88
# Run the formatter.
99
- id: ruff-format
@@ -21,6 +21,10 @@ repos:
2121
files: \.(py|rst|md)$
2222
args: [--ignore-words-list=ser, --ignore-words-list=RightT]
2323
exclude: ^docs/api-completeness.md$
24+
- repo: https://github.com/crate-ci/typos
25+
rev: 'v1.39.0'
26+
hooks:
27+
- id: typos
2428
- repo: https://github.com/pycqa/flake8
2529
rev: '7.3.0'
2630
hooks:
@@ -121,7 +125,11 @@ repos:
121125
rev: v6.0.0
122126
hooks:
123127
- id: name-tests-test
124-
exclude: ^(tests/utils\.py|tests/plan/utils\.py)
128+
exclude: |
129+
(?x)
130+
^(tests/utils\.py)
131+
|^(tests/test_plugin/)
132+
|^(tests/plan/utils\.py)
125133
- id: no-commit-to-branch
126134
- id: end-of-file-fixer
127135
exclude: .svg$

CONTRIBUTING.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,16 @@ If you add code that should be tested, please add tests.
185185
- Never assume that your data is ordered in any pre-defined way.
186186
- Never materialise your data (only exception: `collect`).
187187
- Avoid calling the schema / column names unnecessarily.
188-
- For DuckDB, use the Python API as much as possible, only falling
188+
189+
- DuckDB:
190+
191+
In addition to the above:
192+
193+
- Use the Python API as much as possible, only falling
189194
back to SQL as the last resort for operations not yet supported
190195
in their Python API (e.g. `over`).
196+
- Use standard SQL constructs where possible instead of non-standard
197+
ones such as `GROUP BY ALL` or `EXCLUDE`.
191198
192199
### Test Failure Patterns
193200

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ Join the party!
171171
- [altair](https://github.com/vega/altair/)
172172
- [bokeh](https://github.com/bokeh/bokeh)
173173
- [darts](https://github.com/unit8co/darts)
174+
- [fairlearn](https://github.com/fairlearn/fairlearn)
174175
- [formulaic](https://github.com/matthewwardrop/formulaic)
175176
- [gt-extras](https://github.com/posit-dev/gt-extras)
176177
- [hierarchicalforecast](https://github.com/Nixtla/hierarchicalforecast)

_typos.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[default.extend-words]
2+
ser = "ser" # Used in Series classes
3+
ND = "ND" # Used in NativeNDFrameT
4+
ba = "ba" # Used as column name in docstring examples (way too much?)
5+
iy = "iy" # Used as column name (once in a test)
6+
pn = "pn" # Used in docs: pn = PandasLikeNamespace(...)
7+
TYP = "TYP" # Used in flake8 rule
8+
9+
[files]
10+
extend-exclude = ["tests/data/*"]

docs/ecosystem.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ for their dataframe interoperability needs:
88
* [altair](https://github.com/vega/altair/)
99
* [bokeh](https://github.com/bokeh/bokeh)
1010
* [darts](https://github.com/unit8co/darts)
11+
* [fairlearn](https://github.com/fairlearn/fairlearn)
1112
* [formulaic](https://github.com/matthewwardrop/formulaic)
1213
* [gt-extras](https://github.com/posit-dev/gt-extras)
1314
* [hierarchicalforecast](https://github.com/Nixtla/hierarchicalforecast)

0 commit comments

Comments
 (0)