-
Notifications
You must be signed in to change notification settings - Fork 3
Add PolarsExpr type annotation for pydantic validation #130
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
base: main
Are you sure you want to change the base?
Conversation
…ssing Signed-off-by: Nijat Khanbabayev <[email protected]>
Test Results436 tests +10 432 ✅ +10 23s ⏱️ -1s Results for commit 95c02a3. ± Comparison against base commit fa733a0. This pull request removes 6 and adds 16 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #130 +/- ##
==========================================
+ Coverage 95.42% 95.45% +0.02%
==========================================
Files 120 120
Lines 6754 6792 +38
Branches 427 427
==========================================
+ Hits 6445 6483 +38
Misses 203 203
Partials 106 106 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Nijat Khanbabayev <[email protected]>
raise ValueError(f"Supplied value '{value}' cannot be converted to a Polars expression") | ||
|
||
|
||
class PolarsExpression(_PolarsExprPydanticAnnotation, pl.Expr): |
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 think it would be better to make PolarsExpression
the annotated type and just drop PolarsExpr
. Having both is confusing.
without subclassing.
This follows the approach highlighted here: https://docs.pydantic.dev/latest/concepts/types/#handling-third-party-types
on the pydantic documentation.