← All tasks
pythonvega/altair #3688Not a task: already works

unsupported narwhals import

envgap__vega__altair-3688

01 / FAILURE SIGNATURE

As reported upstream

ImportError: cannot import name 'is_into_dataframe' from 'narwhals.dependencies'
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
a0c091eca897e1b9eaa6bb70d8ae8dc1deff9e60
Manifest
pyproject.toml
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

vega/altair #3688 · read the original issue
### What happened?

I currently get this error when trying to import altair:
```
ImportError: cannot import name 'is_into_dataframe' from 'narwhals.dependencies' 
```

This part is not safe at the moment:
https://github.com/vega/altair/blob/a0c091eca897e1b9eaa6bb70d8ae8dc1deff9e60/altair/utils/_vegafusion_data.py#L8

The function `is_into_dataframe` is introduced in narwhals [v1.13.1](https://github.com/narwhals-dev/narwhals/releases/tag/v1.13.1), but our demand is:
https://github.com/vega/altair/blob/a0c091eca897e1b9eaa6bb70d8ae8dc1deff9e60/pyproject.toml#L23

Btw, should this not be referenced by making use of the stable v1 of narwhals?
```python
import narwhals.stable.v1 as nw
...
return isinstance(data, DataFrameLike) or nw.dependencies.is_into_dataframe(data)
```

I notice elsewhere we mixed the `stable.v1` with _just-import-direct_ approach:
https://github.com/vega/altair/blob/a0c091eca897e1b9eaa6bb70d8ae8dc1deff9e60/altair/utils/core.py#L18-L20

### What would you like to happen instead?

Probably best is to update the `pyproject.toml` file.

### Which version of Altair are you using?

main
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]