Skip to content

[Bug]: Widen backend type #3808

Description

@AdrianSosic

Describe the bug

I think this may be a typing issue that could potentially be addressed by refining the backend type?

Steps or code to reproduce the bug

import narwhals as nw

backend: nw.Implementation = nw.Implementation.PANDAS
nw.from_dict({}, backend=backend)

Expected results

No error is thrown.

Actual results

error: Argument "backend" to "from_dict" has incompatible type "Implementation"; expected "Literal['pandas', 'cudf', 'modin', Implementation.PANDAS, Implementation.CUDF, Implementation.MODIN, 'pyarrow', Implementation.PYARROW, 'polars', Implementation.POLARS] | Module | None"  [arg-type]
Found 1 error in 1 file (checked 1 source file)

Please run narwhals.show_versions() and enter the output below.

Python dependencies:
     narwhals: 2.20.0
        numpy: 2.3.5
       pandas: 2.3.3
        modin: 0.37.1
         cudf: 
      pyarrow: 
      pyspark: 
       polars: 1.42.1
         dask: 
       duckdb: 
         ibis: 
     sqlframe:

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions