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

with pandas-stubs ≥ 2.3.3 some mytype errors appear

envgap__vega__altair-3961

01 / FAILURE SIGNATURE

As reported upstream

Error is reproducible with this snippet (`repro_pdstubs.py`):
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

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

03 / ORIGINAL ISSUE TEXT

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

With pandas-stubs ≥ 2.3.3, mypy reports: *No overload variant of "where" of "Series" matches argument types "Series[bool]", "None"*.

On eg code like this (lines 394, 399, 407, 447, 456 in altair/utils/core.py):
https://github.com/vega/altair/blob/f5cad857074158b4fa7182bd874e54de11b595dd/altair/utils/core.py#L394

Error is reproducible with this snippet (`repro_pdstubs.py`):

```python
from typing import Any
import pandas as pd
col: pd.Series[Any] = pd.Series([1, 2, None])
col.where(col.notnull(), None)
```

```bash
uv run --with "pandas-stubs==3.0.0.260204" mypy repro_pdstubs.py
# error

uv run --with "pandas-stubs==2.3.2.250827" mypy repro_pdstubs.py
# success
```

### What would you like to happen instead?

To also support higher versions of pandas-stubs. If you like to work on this, please do not hesitate in doing so. It might be a good idea to first check pandas-stubs repository https://github.com/pandas-dev/pandas-stubs. Maybe you can find the PR that introduced this behaviour, with hopefully a proposed migration path.

### Which version of Altair are you using?

_No response_
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
[]