Skip to content

Commit

Permalink
feat(typing): Set "polars" as default in Loader.from_backend
Browse files Browse the repository at this point in the history
Without a default, I found that VSCode was always suggesting the **last** overload first (`"pyarrow"`)
This is a bad suggestion, as it provides the *worst native* experience.

The default now aligns with the backend providing the *best native* experience
  • Loading branch information
dangotbanned committed Jan 22, 2025
1 parent d64dbee commit 0c72435
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions altair/datasets/_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Loader(Generic[IntoDataFrameT, IntoFrameT]):
@overload
@classmethod
def from_backend(
cls, backend_name: Literal["polars"], /
cls, backend_name: Literal["polars"] = ..., /
) -> Loader[pl.DataFrame, pl.LazyFrame]: ...

@overload
Expand All @@ -64,7 +64,7 @@ def from_backend(
) -> Loader[pa.Table, pa.Table]: ...

@classmethod
def from_backend(cls, backend_name: _Backend, /) -> Loader[Any, Any]:
def from_backend(cls, backend_name: _Backend = "polars", /) -> Loader[Any, Any]:
"""
Initialize a new loader, with the specified backend.
Expand Down

0 comments on commit 0c72435

Please sign in to comment.