Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow for "import narwhals.stable.v1.selectors as cs" #1459

Merged
merged 4 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions narwhals/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

from narwhals import dependencies
from narwhals import dtypes
from narwhals import exceptions
from narwhals import selectors
from narwhals import stable
Expand Down Expand Up @@ -107,6 +108,7 @@
"concat",
"concat_str",
"dependencies",
"dtypes",
"exceptions",
"from_arrow",
"from_dict",
Expand Down
10 changes: 10 additions & 0 deletions narwhals/selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,3 +268,13 @@ def all() -> Expr:
β””β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜
"""
return Selector(lambda plx: plx.selectors.all())


__all__ = [
"by_dtype",
"numeric",
"boolean",
"string",
"categorical",
"all",
]
2 changes: 2 additions & 0 deletions narwhals/stable/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from narwhals.functions import show_versions
from narwhals.schema import Schema as NwSchema
from narwhals.series import Series as NwSeries
from narwhals.stable.v1 import dtypes
from narwhals.stable.v1.dtypes import Array
from narwhals.stable.v1.dtypes import Boolean
from narwhals.stable.v1.dtypes import Categorical
Expand Down Expand Up @@ -3232,6 +3233,7 @@ def from_dict(
"concat",
"concat_str",
"dependencies",
"dtypes",
"exceptions",
"from_arrow",
"from_dict",
Expand Down
17 changes: 17 additions & 0 deletions narwhals/stable/v1/selectors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from __future__ import annotations

from narwhals.selectors import all
from narwhals.selectors import boolean
from narwhals.selectors import by_dtype
from narwhals.selectors import categorical
from narwhals.selectors import numeric
from narwhals.selectors import string

__all__ = [
"by_dtype",
"numeric",
"boolean",
"string",
"categorical",
"all",
]
12 changes: 6 additions & 6 deletions tests/selectors_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import pytest

import narwhals.stable.v1 as nw
from narwhals.selectors import all
from narwhals.selectors import boolean
from narwhals.selectors import by_dtype
from narwhals.selectors import categorical
from narwhals.selectors import numeric
from narwhals.selectors import string
from narwhals.stable.v1.selectors import all
from narwhals.stable.v1.selectors import boolean
from narwhals.stable.v1.selectors import by_dtype
from narwhals.stable.v1.selectors import categorical
from narwhals.stable.v1.selectors import numeric
from narwhals.stable.v1.selectors import string
from tests.utils import PYARROW_VERSION
from tests.utils import Constructor
from tests.utils import assert_equal_data
Expand Down
Loading