Skip to content

Commit

Permalink
Support for polars 1.12 in cudf-polars (#17227)
Browse files Browse the repository at this point in the history
No new updates are required, we must just no longer xfail a test if running with 1.12

Authors:
  - Lawrence Mitchell (https://github.com/wence-)
  - Matthew Murray (https://github.com/Matt711)

Approvers:
  - Vyas Ramasubramani (https://github.com/vyasr)

URL: #17227
  • Loading branch information
wence- authored Oct 31, 2024
1 parent 6055393 commit 0929115
Show file tree
Hide file tree
Showing 28 changed files with 51 additions and 31 deletions.
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ dependencies:
- pandas
- pandas>=2.0,<2.2.4dev0
- pandoc
- polars>=1.11,<1.12
- polars>=1.11,<1.13
- pre-commit
- ptxcompiler
- pyarrow>=14.0.0,<18.0.0a0
Expand Down
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-125_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ dependencies:
- pandas
- pandas>=2.0,<2.2.4dev0
- pandoc
- polars>=1.11,<1.12
- polars>=1.11,<1.13
- pre-commit
- pyarrow>=14.0.0,<18.0.0a0
- pydata-sphinx-theme!=0.14.2
Expand Down
2 changes: 1 addition & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ dependencies:
common:
- output_types: [conda, requirements, pyproject]
packages:
- polars>=1.11,<1.12
- polars>=1.11,<1.13
run_dask_cudf:
common:
- output_types: [conda, requirements, pyproject]
Expand Down
3 changes: 2 additions & 1 deletion python/cudf_polars/cudf_polars/containers/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
from typing import TYPE_CHECKING, cast

import pyarrow as pa
import pylibcudf as plc

import polars as pl

import pylibcudf as plc

from cudf_polars.containers import Column
from cudf_polars.utils import dtypes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from typing import TYPE_CHECKING, Any, ClassVar

import pyarrow as pa

import pylibcudf as plc

from cudf_polars.containers import Column
Expand Down
4 changes: 2 additions & 2 deletions python/cudf_polars/cudf_polars/dsl/expressions/binaryop.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

from typing import TYPE_CHECKING, ClassVar

import pylibcudf as plc

from polars.polars import _expr_nodes as pl_expr

import pylibcudf as plc

from cudf_polars.containers import Column
from cudf_polars.dsl.expressions.base import AggInfo, ExecutionContext, Expr

Expand Down
3 changes: 2 additions & 1 deletion python/cudf_polars/cudf_polars/dsl/expressions/boolean.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
from typing import TYPE_CHECKING, Any, ClassVar

import pyarrow as pa
import pylibcudf as plc

from polars.polars import _expr_nodes as pl_expr

import pylibcudf as plc

from cudf_polars.containers import Column
from cudf_polars.dsl.expressions.base import (
ExecutionContext,
Expand Down
3 changes: 2 additions & 1 deletion python/cudf_polars/cudf_polars/dsl/expressions/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
from typing import TYPE_CHECKING, Any, ClassVar

import pyarrow as pa
import pylibcudf as plc

from polars.polars import _expr_nodes as pl_expr

import pylibcudf as plc

from cudf_polars.containers import Column
from cudf_polars.dsl.expressions.base import ExecutionContext, Expr

Expand Down
1 change: 1 addition & 0 deletions python/cudf_polars/cudf_polars/dsl/expressions/literal.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from typing import TYPE_CHECKING, Any

import pyarrow as pa

import pylibcudf as plc

from cudf_polars.containers import Column
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from typing import TYPE_CHECKING

import pyarrow as pa

import pylibcudf as plc

from cudf_polars.containers import Column
Expand Down
3 changes: 2 additions & 1 deletion python/cudf_polars/cudf_polars/dsl/expressions/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

import pyarrow as pa
import pyarrow.compute as pc
import pylibcudf as plc

from polars.exceptions import InvalidOperationError
from polars.polars import _expr_nodes as pl_expr

import pylibcudf as plc

from cudf_polars.containers import Column
from cudf_polars.dsl.expressions.base import ExecutionContext, Expr
from cudf_polars.dsl.expressions.literal import Literal, LiteralColumn
Expand Down
1 change: 1 addition & 0 deletions python/cudf_polars/cudf_polars/dsl/expressions/unary.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from typing import TYPE_CHECKING, Any, ClassVar

import pyarrow as pa

import pylibcudf as plc

from cudf_polars.containers import Column
Expand Down
3 changes: 2 additions & 1 deletion python/cudf_polars/cudf_polars/dsl/ir.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
from typing import TYPE_CHECKING, Any, ClassVar

import pyarrow as pa
import pylibcudf as plc
from typing_extensions import assert_never

import polars as pl

import pylibcudf as plc

import cudf_polars.dsl.expr as expr
from cudf_polars.containers import Column, DataFrame
from cudf_polars.dsl.nodebase import Node
Expand Down
4 changes: 2 additions & 2 deletions python/cudf_polars/cudf_polars/dsl/to_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
from functools import partial, reduce, singledispatch
from typing import TYPE_CHECKING, TypeAlias

from polars.polars import _expr_nodes as pl_expr

import pylibcudf as plc
from pylibcudf import expressions as plc_expr

from polars.polars import _expr_nodes as pl_expr

from cudf_polars.dsl import expr
from cudf_polars.dsl.traversal import CachingVisitor
from cudf_polars.typing import GenericTransformer
Expand Down
3 changes: 2 additions & 1 deletion python/cudf_polars/cudf_polars/dsl/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
from typing import TYPE_CHECKING, Any

import pyarrow as pa
import pylibcudf as plc
from typing_extensions import assert_never

import polars as pl
import polars.polars as plrs
from polars.polars import _expr_nodes as pl_expr, _ir_nodes as pl_ir

import pylibcudf as plc

from cudf_polars.dsl import expr, ir
from cudf_polars.dsl.traversal import make_recursive, reuse_if_unchanged
from cudf_polars.typing import NodeTraverser
Expand Down
4 changes: 2 additions & 2 deletions python/cudf_polars/cudf_polars/typing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
from collections.abc import Hashable, Mapping
from typing import TYPE_CHECKING, Any, Literal, Protocol, TypeVar, Union

import pylibcudf as plc

from polars.polars import _expr_nodes as pl_expr, _ir_nodes as pl_ir

import pylibcudf as plc

if TYPE_CHECKING:
from collections.abc import Callable
from typing import TypeAlias
Expand Down
3 changes: 2 additions & 1 deletion python/cudf_polars/cudf_polars/utils/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
from functools import cache

import pyarrow as pa
import pylibcudf as plc
from typing_extensions import assert_never

import polars as pl

import pylibcudf as plc

__all__ = ["from_polars", "downcast_arrow_lists", "can_cast"]


Expand Down
7 changes: 4 additions & 3 deletions python/cudf_polars/cudf_polars/utils/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@

POLARS_VERSION = parse(__version__)

POLARS_VERSION_LT_18 = POLARS_VERSION < parse("1.8")
POLARS_VERSION_LT_111 = POLARS_VERSION < parse("1.11")
POLARS_VERSION_LT_112 = POLARS_VERSION < parse("1.12")


def _ensure_polars_version():
if POLARS_VERSION_LT_18:
if POLARS_VERSION_LT_111:
raise ImportError(
"cudf_polars requires py-polars v1.8 or greater."
"cudf_polars requires py-polars v1.11 or greater."
) # pragma: no cover
4 changes: 2 additions & 2 deletions python/cudf_polars/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ authors = [
license = { text = "Apache 2.0" }
requires-python = ">=3.10"
dependencies = [
"polars>=1.11,<1.12",
"polars>=1.11,<1.13",
"pylibcudf==24.12.*,>=0.0.0a0",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`.
classifiers = [
Expand Down Expand Up @@ -188,7 +188,7 @@ required-imports = ["from __future__ import annotations"]

[tool.ruff.lint.isort.sections]
polars = ["polars"]
rapids = ["rmm", "cudf"]
rapids = ["rmm", "pylibcudf"]

[tool.ruff.format]
docstring-code-format = true
Expand Down
3 changes: 2 additions & 1 deletion python/cudf_polars/tests/containers/test_column.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
from __future__ import annotations

import pyarrow
import pylibcudf as plc
import pytest

import pylibcudf as plc

from cudf_polars.containers import Column


Expand Down
3 changes: 2 additions & 1 deletion python/cudf_polars/tests/containers/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

from __future__ import annotations

import pylibcudf as plc
import pytest

import polars as pl

import pylibcudf as plc

from cudf_polars.containers import Column, DataFrame
from cudf_polars.testing.asserts import assert_gpu_result_equal

Expand Down
3 changes: 2 additions & 1 deletion python/cudf_polars/tests/dsl/test_expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

from __future__ import annotations

import pylibcudf as plc
import pytest

import pylibcudf as plc

from cudf_polars.dsl import expr


Expand Down
3 changes: 2 additions & 1 deletion python/cudf_polars/tests/dsl/test_to_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

from __future__ import annotations

import pylibcudf as plc
import pytest

import polars as pl
from polars.testing import assert_frame_equal

import pylibcudf as plc

import cudf_polars.dsl.ir as ir_nodes
from cudf_polars import translate_ir
from cudf_polars.containers.dataframe import DataFrame, NamedColumn
Expand Down
4 changes: 2 additions & 2 deletions python/cudf_polars/tests/dsl/test_traversal.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

from functools import singledispatch

import pylibcudf as plc

import polars as pl
from polars.testing import assert_frame_equal

import pylibcudf as plc

from cudf_polars import translate_ir
from cudf_polars.dsl import expr, ir
from cudf_polars.dsl.traversal import (
Expand Down
3 changes: 2 additions & 1 deletion python/cudf_polars/tests/expressions/test_literal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations

import pylibcudf as plc
import pytest

import polars as pl

import pylibcudf as plc

from cudf_polars.testing.asserts import (
assert_gpu_result_equal,
assert_ir_translation_raises,
Expand Down
3 changes: 2 additions & 1 deletion python/cudf_polars/tests/expressions/test_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

import itertools

import pylibcudf as plc
import pytest

import polars as pl

import pylibcudf as plc

from cudf_polars import translate_ir
from cudf_polars.testing.asserts import assert_gpu_result_equal

Expand Down
3 changes: 2 additions & 1 deletion python/cudf_polars/tests/test_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
assert_gpu_result_equal,
assert_ir_translation_raises,
)
from cudf_polars.utils.versions import POLARS_VERSION_LT_112


@pytest.fixture(params=[False, True], ids=["nulls_not_equal", "nulls_equal"])
Expand Down Expand Up @@ -88,7 +89,7 @@ def test_left_join_with_slice(left, right, join_nulls, zlice):
if zlice is not None:
q_expect = q.collect().slice(*zlice)
q = q.slice(*zlice)
if zlice == (1, 5) or zlice == (0, 2):
if POLARS_VERSION_LT_112 and (zlice == (1, 5) or zlice == (0, 2)):
# https://github.com/pola-rs/polars/issues/19403
# https://github.com/pola-rs/polars/issues/19405
ctx = pytest.raises(AssertionError)
Expand Down
3 changes: 2 additions & 1 deletion python/cudf_polars/tests/utils/test_broadcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

from __future__ import annotations

import pylibcudf as plc
import pytest

import pylibcudf as plc

from cudf_polars.containers import Column
from cudf_polars.dsl.ir import broadcast

Expand Down

0 comments on commit 0929115

Please sign in to comment.