-
Notifications
You must be signed in to change notification settings - Fork 179
refactor: Organizing Compliant* APIs
#3045
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
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
3bfefb0
refactor: Move `CompliantExpr._is_multi_output_named`
dangotbanned bc6e890
refactor: Move `CompliantExpr._evaluate_aliases`
dangotbanned 1e8a770
refactor(typing): Correctly label `[False Negative]`, document message
dangotbanned a5f4432
refactor: Label `polars` vs `narwhals`
dangotbanned bd3f691
refactor: Remove `CompliantDataFrame.aggregate`
dangotbanned 8fa84e8
refactor: Move/remove some `PolarsExpr`
dangotbanned 29a3038
refactor: Remove unused from `Polars*GroupBy`
dangotbanned 2c31971
Merge branch 'main' into trim-compliant
dangotbanned f727dcf
Merge branch 'main' into trim-compliant
dangotbanned 7eb1a27
Merge remote-tracking branch 'upstream/main' into trim-compliant
dangotbanned 4c24c9e
Merge remote-tracking branch 'upstream/main' into trim-compliant
dangotbanned 60706de
Merge branch 'main' into trim-compliant
dangotbanned 2525fc1
Merge remote-tracking branch 'upstream/main' into trim-compliant
dangotbanned c67dd85
fix merge conflict
dangotbanned 04dfd11
refactor: Split up `BaseFrame._extract_compliant` (#3054)
dangotbanned 2464524
feat: return `self` from `__narwhals_expr__`
dangotbanned 31fa908
fix(typing): Move annotations that broke protocols
dangotbanned f76b328
refactor(typing): Minimise temp `PolarsExpr` fix
dangotbanned b20c1e1
cov
dangotbanned File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm somewhat torn on these
CompliantExprconstructors.I like that all you need to do is implement these two:
from_column_indicesfrom_column_namesAnd then you get these 4 for "free"
narwhals/narwhals/_compliant/namespace.py
Lines 53 to 76 in 29a3038
What I don't like is that
_LimitedContextspecifies you need to pass an object with:_implementation: Implementation_version: VersionRecently, this PR removed the requirement of also having
_backend_version:Implementation._backend_versionΒ #2764I'd like to continue that trend and work towards removing
_implementationas well πI've been wanting to drop down to 1x
Implementationper class for a while:CompliantSelectorΒ #2064 (comment)pysparkΒ #2051 (comment)Which would just mean defining it on the class like e.g.
Arrow*narwhals/narwhals/_arrow/expr.py
Lines 28 to 29 in 29a3038
If we do that, then:
We don't need it included in any signatures
i
ArrowExprstill requires a sink in__init__even now π’narwhals/narwhals/_arrow/expr.py
Lines 41 to 42 in 29a3038
*Likeclasses don't need to branch onImplementationinside methodsi. We just override things in subclasses
We might be able to do something different for extensions (enh:
Implementationfor pluginsΒ #3042)i. Where
Implementation.UNKNOWNis just a constant to satisfy typing atmThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also then make
__native_namespace__a@classmethodπ€―That doesn't depend on
nw.Version, so we don't need to initialize aCompliantobject to access itThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, if that works, why not