Skip to content

feat: Add Collection.pipe method analogous to polars Lazy-/DataFrames#359

Merged
Oliver Borchert (borchero) merged 2 commits into
mainfrom
collection-pipe
Jul 5, 2026
Merged

feat: Add Collection.pipe method analogous to polars Lazy-/DataFrames#359
Oliver Borchert (borchero) merged 2 commits into
mainfrom
collection-pipe

Conversation

@MoritzPotthoffQC

Copy link
Copy Markdown
Contributor

Motivation

I recently wanted to use this and realized I can't. I think it would be nice to support this so that we can use the same operation chaining pattern we use for data frames also for collections.

Changes

  • Add Collection.pipe method with the same interface as pl.LazyFrame.pipe (see here)
  • Add simple tests

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (3089ece) to head (43b0063).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #359   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           56        56           
  Lines         3471      3475    +4     
=========================================
+ Hits          3471      3475    +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Collection.pipe helper to enable fluent, Polars-style operation chaining on dy.Collection instances, mirroring the ergonomics of pl.LazyFrame.pipe while preserving type information via ParamSpec/Concatenate.

Changes:

  • Introduces Collection.pipe(function, *args, **kwargs) that calls function(self, *args, **kwargs) and returns the function’s result.
  • Adds unit tests covering self forwarding, args/kwargs forwarding, and arbitrary return types.
  • Exposes the new API in the collection operations docs autosummary.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
dataframely/collection/collection.py Adds the new Collection.pipe method with typed signature and docstring.
tests/collection/test_pipe.py Adds tests validating behavior and return-type flexibility of Collection.pipe.
docs/api/collection/operations.rst Includes Collection.pipe in the documented collection operations list.

Comment thread dataframely/collection/collection.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice :)

@borchero Oliver Borchert (borchero) merged commit a523310 into main Jul 5, 2026
32 checks passed
@borchero Oliver Borchert (borchero) deleted the collection-pipe branch July 5, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants