- 
                Notifications
    
You must be signed in to change notification settings  - Fork 170
 
Closed
Description
Hi!
Since narwhals 2.2.0 I observe that running mypy against
import narwhals as nw
import numpy as np
import polars as pl
X = pl.DataFrame({"col_a": [1, 2, 3], "col_b": [1, 2, 3]})
Y = np.array([1,2,3]).reshape(-1, 1)
X_nw = nw.from_native(X)
Y_nw = nw.from_numpy(Y, backend=X_nw.implementation)yields
error: Argument "backend" to "from_numpy" has incompatible type "Implementation"; expected "Literal['pandas', 'cudf', 'modin', Implementation.PANDAS, Implementation.CUDF, Implementation.MODIN, 'pyarrow', Implementation.PYARROW, 'polars', Implementation.POLARS] | Module"  [arg-type]
Found 1 error in 1 file (checked 1 source file)If I pass str(X_nw.implementation) or X_nw.implementation.value instead of X_nw.implementation I get
error: Argument "backend" to "from_numpy" has incompatible type "str"; expected "Literal['pandas', 'cudf', 'modin', Implementation.PANDAS, Implementation.CUDF, Implementation.MODIN, 'pyarrow', Implementation.PYARROW, 'polars', Implementation.POLARS] | Module"  [arg-type]
Found 1 error in 1 file (checked 1 source file)Is that behaviour expected? If yes, how can I do better?
- MacOS ARM
 python: 3.13.5mypy: 1.17.1narwhals: 2.2.0