@@ -65,12 +65,12 @@ def my_backend_lazy_constructor(obj: Data, /, **kwds: Any) -> IntoLazyFrame:
6565
6666
6767__all__ = (
68- "available_constructors " ,
69- "available_cpu_constructors " ,
68+ "available_backends " ,
69+ "available_cpu_backends " ,
7070 "frame_constructor" ,
71- "get_constructor " ,
71+ "get_backend_constructor " ,
7272 "is_backend_available" ,
73- "prepare_constructors " ,
73+ "prepare_backends " ,
7474 "pyspark_session" ,
7575 "sqlframe_session" ,
7676)
@@ -464,7 +464,7 @@ def ibis_lazy_constructor(obj: Data, /, **kwds: Any) -> ibis.Table: # pragma: n
464464 return _ibis_backend ().create_table (table_name , table , ** kwds )
465465
466466
467- DEFAULT_CONSTRUCTORS : frozenset [str ] = frozenset (
467+ DEFAULT_BACKENDS : frozenset [str ] = frozenset (
468468 {
469469 "pandas" ,
470470 "pandas[pyarrow]" ,
@@ -475,30 +475,30 @@ def ibis_lazy_constructor(obj: Data, /, **kwds: Any) -> ibis.Table: # pragma: n
475475 "ibis" ,
476476 }
477477)
478- """Subset of constructors enabled by default for parametrised tests when the
479- user does not pass `--constructors ` (mirrors the historical Narwhals defaults).
478+ """Subset of backends enabled by default for parametrised tests when the
479+ user does not pass `--nw-backends ` (mirrors the historical Narwhals defaults).
480480"""
481481
482482
483- def available_constructors () -> frozenset [str ]:
483+ def available_backends () -> frozenset [str ]:
484484 """Return the names of every constructor whose backend is importable.
485485
486486 Examples:
487- >>> from narwhals.testing.constructors import available_constructors
488- >>> "pandas" in available_constructors ()
487+ >>> from narwhals.testing.constructors import available_backends
488+ >>> "pandas" in available_backends ()
489489 True
490490 """
491491 return frozenset (
492492 name for name , c in frame_constructor ._registry .items () if c .is_available
493493 )
494494
495495
496- def available_cpu_constructors () -> frozenset [str ]: # pragma: no cover
496+ def available_cpu_backends () -> frozenset [str ]: # pragma: no cover
497497 """Return the names of every CPU constructor whose backend is importable.
498498
499499 Examples:
500- >>> from narwhals.testing.constructors import available_cpu_constructors
501- >>> "pandas" in available_cpu_constructors ()
500+ >>> from narwhals.testing.constructors import available_cpu_backends
501+ >>> "pandas" in available_cpu_backends ()
502502 True
503503 """
504504 return frozenset (
@@ -524,14 +524,14 @@ def available_cpu_constructors() -> frozenset[str]: # pragma: no cover
524524
525525
526526@overload
527- def get_constructor (name : EagerName ) -> frame_constructor [IntoDataFrame ]: ...
527+ def get_backend_constructor (name : EagerName ) -> frame_constructor [IntoDataFrame ]: ...
528528@overload
529- def get_constructor (name : LazyName ) -> frame_constructor [IntoLazyFrame ]: ...
529+ def get_backend_constructor (name : LazyName ) -> frame_constructor [IntoLazyFrame ]: ...
530530@overload
531- def get_constructor (name : str ) -> frame_constructor [IntoFrame ]: ...
531+ def get_backend_constructor (name : str ) -> frame_constructor [IntoFrame ]: ...
532532
533533
534- def get_constructor (name : str ) -> frame_constructor [IntoFrame ]:
534+ def get_backend_constructor (name : str ) -> frame_constructor [IntoFrame ]:
535535 """Return the registered constructor for `name`.
536536
537537 Arguments:
@@ -542,8 +542,8 @@ def get_constructor(name: str) -> frame_constructor[IntoFrame]:
542542 ValueError: If `name` is not a registered constructor identifier.
543543
544544 Examples:
545- >>> from narwhals.testing.constructors import get_constructor
546- >>> get_constructor ("pandas")
545+ >>> from narwhals.testing.constructors import get_backend_constructor
546+ >>> get_backend_constructor ("pandas")
547547 frame_constructor(name='pandas')
548548 """
549549 try :
@@ -554,7 +554,7 @@ def get_constructor(name: str) -> frame_constructor[IntoFrame]:
554554 raise ValueError (msg ) from exc
555555
556556
557- def prepare_constructors (
557+ def prepare_backends (
558558 * , include : Iterable [str ] | None = None , exclude : Iterable [str ] | None = None
559559) -> list [frame_constructor [IntoFrame ]]:
560560 """Return available constructors, optionally filtered.
@@ -563,14 +563,14 @@ def prepare_constructors(
563563 `exclude` is given precedence in the selection.
564564
565565 Arguments:
566- include: If given, only return constructors whose name is in this set.
567- exclude: If given, remove constructors whose name is in this set.
566+ include: If given, only return backends whose name is in this set.
567+ exclude: If given, remove backends whose name is in this set.
568568
569569 Examples:
570- >>> from narwhals.testing.constructors import prepare_constructors
571- >>> constructors = prepare_constructors (include=["pandas", "polars[eager]"])
570+ >>> from narwhals.testing.constructors import prepare_backends
571+ >>> backends = prepare_backends (include=["pandas", "polars[eager]"])
572572 """
573- available = available_constructors ()
573+ available = available_backends ()
574574 candidates : list [frame_constructor [Any ]] = [
575575 c for name , c in frame_constructor ._registry .items () if name in available
576576 ]
0 commit comments