Skip to content

Commit 07f7a1e

Browse files
committed
Merge branch 'main' into ci/tubular
2 parents 570d8c7 + 90836bd commit 07f7a1e

File tree

6 files changed

+54
-20
lines changed

6 files changed

+54
-20
lines changed

.github/workflows/downstream_tests.yml

+3-8
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,16 @@ jobs:
8787
- name: show-deps
8888
run: uv pip freeze
8989
- name: Create assets directory, copy over index.html
90+
continue-on-error: true
9091
run: |
9192
mkdir -p marimo/marimo/_static/assets
9293
cp marimo/frontend/index.html marimo/marimo/_static/index.html
9394
cp marimo/frontend/public/favicon.ico marimo/marimo/_static/favicon.ico
94-
- name: Run tests with minimal dependencies
95-
if: ${{ matrix.dependencies == 'core' }}
96-
run: |
97-
cd marimo
98-
hatch run +py=${{ matrix.python-version }} test:test -v tests/ -k "not test_cli"
99-
timeout-minutes: 15
100-
- name: Run tests with optional dependencies
95+
- name: Run tests with full dependencies
10196
if: ${{ matrix.dependencies == 'core,optional' }}
10297
run: |
10398
cd marimo
104-
hatch run +py=${{ matrix.python-version }} test-optional:test -v tests/ -k "not test_cli"
99+
hatch run +py=${{ matrix.python-version }} test-optional:test-narwhals
105100
timeout-minutes: 15
106101
- name: Run typechecks
107102
run: |

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ repos:
4040
hooks:
4141
- id: nbstripout
4242
- repo: https://github.com/adamchainz/blacken-docs
43-
rev: "1.18.0" # replace with latest tag on GitHub
43+
rev: "1.19.0" # replace with latest tag on GitHub
4444
hooks:
4545
- id: blacken-docs
4646
args: [--skip-errors]

docs/installation.md

+23-7
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,36 @@
22

33
## Installation
44

5-
First, make sure you have [created and activated](https://docs.python.org/3/library/venv.html) a Python3.8+ virtual environment.
5+
=== "UV"
66

7-
Then, run
8-
```console
9-
python -m pip install narwhals
10-
```
7+
First, ensure you have installed [UV](https://github.com/astral-sh/uv), and make sure you have [created and activated](https://docs.astral.sh/uv/pip/environments/#python-environments) a Python 3.8+ virtual environment.
8+
9+
If you haven't, you can follow our [_setting up your environment_](https://github.com/narwhals-dev/narwhals/blob/main/CONTRIBUTING.md#option-1-use-uv-recommended) guide.
10+
Then, run:
11+
12+
```console
13+
uv pip install narwhals
14+
```
15+
16+
=== "Python's venv"
17+
18+
First, ensure you have [created and activated](https://docs.python.org/3/library/venv.html) a Python 3.8+ virtual environment.
19+
20+
Then, run:
21+
22+
```console
23+
python -m pip install narwhals
24+
```
25+
26+
### Verifying the Installation
1127

12-
Then, if you start the Python REPL and see the following:
28+
To verify the installation, start the Python REPL and execute:
1329
```python
1430
>>> import narwhals
1531
>>> narwhals.__version__
1632
'1.9.4'
1733
```
18-
then installation worked correctly!
34+
If you see the version number, then the installation was successful!
1935

2036
## Quick start
2137

mkdocs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ nav:
2626
- Supported Expr methods: api-completeness/expr.md
2727
- Supported Series methods: api-completeness/series.md
2828
- API Reference:
29+
- api-reference/index.md
2930
- api-reference/narwhals.md
3031
- api-reference/dataframe.md
3132
- api-reference/expr.md
@@ -42,7 +43,6 @@ nav:
4243
- api-reference/series_str.md
4344
- api-reference/dependencies.md
4445
- api-reference/dtypes.md
45-
- api-reference/index.md
4646
- api-reference/selectors.md
4747
- api-reference/typing.md
4848
theme:

narwhals/expr.py

+18-2
Original file line numberDiff line numberDiff line change
@@ -367,17 +367,19 @@ def mean(self) -> Self:
367367
Examples:
368368
>>> import polars as pl
369369
>>> import pandas as pd
370+
>>> import pyarrow as pa
370371
>>> import narwhals as nw
371372
>>> df_pd = pd.DataFrame({"a": [-1, 0, 1], "b": [2, 4, 6]})
372373
>>> df_pl = pl.DataFrame({"a": [-1, 0, 1], "b": [2, 4, 6]})
374+
>>> df_pa = pa.table({"a": [-1, 0, 1], "b": [2, 4, 6]})
373375
374376
Let's define a dataframe-agnostic function:
375377
376378
>>> @nw.narwhalify
377379
... def func(df):
378380
... return df.select(nw.col("a", "b").mean())
379381
380-
We can then pass either pandas or Polars to `func`:
382+
We can pass any supported library such as Pandas, Polars, or PyArrow to `func`:
381383
382384
>>> func(df_pd)
383385
a b
@@ -391,6 +393,13 @@ def mean(self) -> Self:
391393
╞═════╪═════╡
392394
│ 0.0 ┆ 4.0 │
393395
└─────┴─────┘
396+
>>> func(df_pa)
397+
pyarrow.Table
398+
a: double
399+
b: double
400+
----
401+
a: [[0]]
402+
b: [[4]]
394403
"""
395404
return self.__class__(lambda plx: self._call(plx).mean())
396405

@@ -4054,17 +4063,19 @@ def mean(*columns: str) -> Expr:
40544063
Examples:
40554064
>>> import pandas as pd
40564065
>>> import polars as pl
4066+
>>> import pyarrow as pa
40574067
>>> import narwhals as nw
40584068
>>> df_pl = pl.DataFrame({"a": [1, 8, 3]})
40594069
>>> df_pd = pd.DataFrame({"a": [1, 8, 3]})
4070+
>>> df_pa = pa.table({"a": [1, 8, 3]})
40604071
40614072
We define a dataframe agnostic function:
40624073
40634074
>>> @nw.narwhalify
40644075
... def func(df):
40654076
... return df.select(nw.mean("a"))
40664077
4067-
We can then pass either pandas or Polars to `func`:
4078+
We can pass any supported library such as Pandas, Polars, or PyArrow to `func`:
40684079
40694080
>>> func(df_pd)
40704081
a
@@ -4078,6 +4089,11 @@ def mean(*columns: str) -> Expr:
40784089
╞═════╡
40794090
│ 4.0 │
40804091
└─────┘
4092+
>>> func(df_pa)
4093+
pyarrow.Table
4094+
a: double
4095+
----
4096+
a: [[4]]
40814097
"""
40824098

40834099
return Expr(lambda plx: plx.mean(*columns))

narwhals/stable/v1/__init__.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -1254,17 +1254,19 @@ def mean(*columns: str) -> Expr:
12541254
Examples:
12551255
>>> import pandas as pd
12561256
>>> import polars as pl
1257+
>>> import pyarrow as pa
12571258
>>> import narwhals.stable.v1 as nw
12581259
>>> df_pl = pl.DataFrame({"a": [1, 8, 3]})
12591260
>>> df_pd = pd.DataFrame({"a": [1, 8, 3]})
1261+
>>> df_pa = pa.table({"a": [1, 8, 3]})
12601262
12611263
We define a dataframe agnostic function:
12621264
12631265
>>> @nw.narwhalify
12641266
... def func(df):
12651267
... return df.select(nw.mean("a"))
12661268
1267-
We can then pass either pandas or Polars to `func`:
1269+
We can pass any supported library such as Pandas, Polars, or PyArrow to `func`:
12681270
12691271
>>> func(df_pd)
12701272
a
@@ -1278,6 +1280,11 @@ def mean(*columns: str) -> Expr:
12781280
╞═════╡
12791281
│ 4.0 │
12801282
└─────┘
1283+
>>> func(df_pa)
1284+
pyarrow.Table
1285+
a: double
1286+
----
1287+
a: [[4]]
12811288
"""
12821289
return _stableify(nw.mean(*columns))
12831290

0 commit comments

Comments
 (0)