8000 Implement rich_repr for expressions by TomAugspurger · Pull Request #19173 · rapidsai/cudf · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Implement rich_repr for expressions #19173

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

Merged
merged 5 commits into from
Jun 18, 2025

Conversation

TomAugspurger
Copy link
Contributor

Description

This adds a __rich_repr__ implmementation for cudf-polars' internal data structures Expr and PartitionInfo that should be a bit easier to read while debugging. There's no dependency (required or optional) on rich. There's no change to the regular repr used by Python to print objects. To see the change, use rich.pretty.print.

Here's a screenshot of the output:

import polars as pl
import rich.pretty
from cudf_polars.dsl.translate import Translator

ldf = pl.LazyFrame({"a": ["a", "b", "c", "d", "a", None, "b", "c"]})
q = ldf.group_by((pl.col("a").str.starts_with("a"))).agg(
    pl.col("a").count().alias("count")
)

ir = Translator(q._ldf.visit(), engine=pl.GPUEngine()).translate_ir()

print("default")
print("-" * 80)
print(ir, end="\n\n")

print("rich")
print("-" * 80)
rich.pretty.pprint(ir)

image

Copy link
copy-pr-bot bot commented Jun 16, 2025

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@github-actions github-actions bot added Python Affects Python cuDF API. cudf-polars Issues specific to cudf-polars labels Jun 16, 2025
@GPUtester GPUtester moved this to In Progress in cuDF Python Jun 16, 2025
@TomAugspurger TomAugspurger added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Jun 16, 2025
@TomAugspurger TomAugspurger marked this pull request as ready for review June 16, 2025 14:03
@TomAugspurger TomAugspurger requested a review from a team as a code owner June 16, 2025 14:03
@TomAugspurger TomAugspurger requested review from vyasr and bdice June 16, 2025 14:03
@TomAugspurger TomAugspurger requested review from a team as code owners June 17, 2025 14:40
@github-actions github-actions bot added libcudf Affects libcudf (C++/CUDA) code. CMake CMake build issue cudf.pandas Issues specific to cudf.pandas pylibcudf Issues specific to the pylibcudf package labels Jun 17, 2025
@TomAugspurger TomAugspurger removed request for a team June 17, 2025 14:41
@github-actions github-actions bot removed libcudf Affects libcudf (C++/CUDA) code. CMake CMake build issue cudf.pandas Issues specific to cudf.pandas pylibcudf Issues specific to the pylibcudf package labels Jun 17, 2025
@TomAugspurger
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit b9fb517 into rapidsai:branch-25.08 Jun 18, 2025
94 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in cuDF Python Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cudf-polars Issues specific to cudf-polars improvement Improvement / enhancement to an existing function non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants
0