Skip to content

Commit 24e20b5

Browse files
authored
Revert "Revert "depr: deprecate strict in from_native / to_native in favour of pass_through (#1312)
1 parent 9465ae3 commit 24e20b5

File tree

10 files changed

+567
-146
lines changed

10 files changed

+567
-146
lines changed

.github/workflows/downstream_tests.yml

Lines changed: 55 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: Test Downstream Libraries
22

33
on:
4-
workflow_call:
5-
workflow_dispatch:
4+
pull_request:
5+
push:
6+
branches: [main]
67

78
jobs:
89
altair:
@@ -230,59 +231,59 @@ jobs:
230231
cd tubular
231232
pytest tests --config-file=pyproject.toml
232233
233-
vegafusion:
234-
env:
235-
UV_SYSTEM_PYTHON: true
234+
# vegafusion:
235+
# env:
236+
# UV_SYSTEM_PYTHON: true
236237

237-
strategy:
238-
matrix:
239-
python-version: ["3.11"]
240-
os: [ubuntu-latest]
238+
# strategy:
239+
# matrix:
240+
# python-version: ["3.11"]
241+
# os: [ubuntu-latest]
241242

242-
runs-on: ${{ matrix.os }}
243-
steps:
244-
- uses: actions/checkout@v4
245-
- uses: actions/setup-python@v5
246-
with:
247-
python-version: ${{ matrix.python-version }}
248-
- name: Install uv
249-
uses: astral-sh/setup-uv@v3
250-
with:
251-
enable-cache: "true"
252-
cache-suffix: ${{ matrix.python-version }}
253-
cache-dependency-glob: "**requirements*.txt"
254-
- name: clone-vegafusion
255-
run: |
256-
git clone --single-branch -b v2 https://github.com/vega/vegafusion.git
257-
cd vegafusion
258-
git log
259-
- name: Cache rust dependencies
260-
uses: Swatinem/rust-cache@v2
261-
with:
262-
workspaces: vegafusion
263-
- name: Build wheels
264-
uses: PyO3/maturin-action@v1
265-
with:
266-
command: build
267-
manylinux: 2014
268-
rust-toolchain: stable
269-
args: --release -m vegafusion/vegafusion-python/Cargo.toml --features=protobuf-src --strip
270-
- name: Install wheels
271-
working-directory: vegafusion/target/wheels/
272-
run: |
273-
ls -la
274-
python -m pip install vegafusion-*manylinux*.whl
243+
# runs-on: ${{ matrix.os }}
244+
# steps:
245+
# - uses: actions/checkout@v4
246+
# - uses: actions/setup-python@v5
247+
# with:
248+
# python-version: ${{ matrix.python-version }}
249+
# - name: Install uv
250+
# uses: astral-sh/setup-uv@v3
251+
# with:
252+
# enable-cache: "true"
253+
# cache-suffix: ${{ matrix.python-version }}
254+
# cache-dependency-glob: "**requirements*.txt"
255+
# - name: clone-vegafusion
256+
# run: |
257+
# git clone --single-branch -b v2 https://github.com/vega/vegafusion.git
258+
# cd vegafusion
259+
# git log
260+
# - name: Cache rust dependencies
261+
# uses: Swatinem/rust-cache@v2
262+
# with:
263+
# workspaces: vegafusion
264+
# - name: Build wheels
265+
# uses: PyO3/maturin-action@v1
266+
# with:
267+
# command: build
268+
# manylinux: 2014
269+
# rust-toolchain: stable
270+
# args: --release -m vegafusion/vegafusion-python/Cargo.toml --features=protobuf-src --strip
271+
# - name: Install wheels
272+
# working-directory: vegafusion/target/wheels/
273+
# run: |
274+
# ls -la
275+
# python -m pip install vegafusion-*manylinux*.whl
275276

276-
# Optional dependencies
277-
python -m pip install pyarrow pandas polars-lts-cpu "duckdb>=1.0" "vl-convert-python>=1.0.1rc1" scikit-image "pandas>=2.2" jupytext voila anywidget ipywidgets chromedriver-binary-auto
277+
# # Optional dependencies
278+
# python -m pip install pyarrow pandas polars-lts-cpu "duckdb>=1.0" "vl-convert-python>=1.0.1rc1" scikit-image "pandas>=2.2" jupytext voila anywidget ipywidgets chromedriver-binary-auto
278279

279-
# Test dependencies
280-
python -m pip install pytest altair vega-datasets scikit-image jupytext voila ipykernel anywidget ipywidgets selenium flaky tenacity chromedriver-binary-auto
281-
- name: Test lazy imports
282-
working-directory: vegafusion/vegafusion-python/
283-
run: python checks/check_lazy_imports.py
284-
- name: Test vegafusion
285-
working-directory: vegafusion/vegafusion-python/
286-
env:
287-
VEGAFUSION_TEST_HEADLESS: 1
288-
run: pytest
280+
# # Test dependencies
281+
# python -m pip install pytest altair vega-datasets scikit-image jupytext voila ipykernel anywidget ipywidgets selenium flaky tenacity chromedriver-binary-auto
282+
# - name: Test lazy imports
283+
# working-directory: vegafusion/vegafusion-python/
284+
# run: python checks/check_lazy_imports.py
285+
# - name: Test vegafusion
286+
# working-directory: vegafusion/vegafusion-python/
287+
# env:
288+
# VEGAFUSION_TEST_HEADLESS: 1
289+
# run: pytest

docs/backcompat.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,27 @@ before making any change.
9999

100100
### After `stable.v1`
101101

102-
- `Datetime` and `Duration` dtypes hash using both `time_unit` and `time_zone`.
103-
The effect of this can be seen when doing `dtype in {...}` checks:
102+
- Since Narwhals 1.13.0, the `strict` parameter in `from_native`, `to_native`, and `narwhalify`
103+
has been deprecated in favour of `pass_through`. This is because several users expressed
104+
confusion/surprise over what `strict=False` did.
105+
```python
106+
# v1 syntax:
107+
nw.from_native(df, strict=False)
108+
109+
# main namespace (and, when we get there, v2) syntax:
110+
nw.from_native(df, pass_through=True)
111+
```
112+
If you are using Narwhals>=1.13.0, then we recommend using `pass_through`, as that
113+
works consistently across namespaces.
114+
115+
In the future:
116+
117+
- in the main Narwhals namespace, `strict` will be removed in favour of `pass_through`
118+
- in `stable.v1`, we will keep both `strict` and `pass_through`
119+
120+
- Since Narwhals 1.9.0, `Datetime` and `Duration` dtypes hash using both `time_unit` and
121+
`time_zone`.
122+
The effect of this can be seen when placing these dtypes in sets:
104123

105124
```python exec="1" source="above" session="backcompat"
106125
import narwhals.stable.v1 as nw_v1

narwhals/dataframe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2874,7 +2874,7 @@ def to_native(self) -> FrameT:
28742874
└─────┴─────┴─────┘
28752875
"""
28762876

2877-
return to_native(narwhals_object=self, strict=True)
2877+
return to_native(narwhals_object=self, pass_through=False)
28782878

28792879
# inherited
28802880
def pipe(self, function: Callable[[Any], Self], *args: Any, **kwargs: Any) -> Self:

narwhals/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ def _from_dict_impl(
361361
else:
362362
msg = "Calling `from_dict` without `native_namespace` is only supported if all input values are already Narwhals Series"
363363
raise TypeError(msg)
364-
data = {key: to_native(value, strict=False) for key, value in data.items()}
364+
data = {key: to_native(value, pass_through=True) for key, value in data.items()}
365365
implementation = Implementation.from_native_namespace(native_namespace)
366366

367367
if implementation is Implementation.POLARS:

0 commit comments

Comments
 (0)