-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
feat: Make register_plugin
a standalone function and include shared lib discovery
#14804
feat: Make register_plugin
a standalone function and include shared lib discovery
#14804
Conversation
58bf3f7
to
2a5fde9
Compare
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.
If we're going to make this part of the public API, we have to make sure the typing is done correctly and it has a proper docstring (e.g. document the parameters / point to the user guide with extensive plugin docs). Probably should also properly use pathlib.
We can also take this opportunity to reconsider the function/parameter names.
We should also document it as unstable.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #14804 +/- ##
==========================================
+ Coverage 81.02% 81.06% +0.04%
==========================================
Files 1338 1342 +4
Lines 173706 173865 +159
Branches 2461 2459 -2
==========================================
+ Hits 140742 140945 +203
+ Misses 32494 32454 -40
+ Partials 470 466 -4 ☔ View full report in Codecov by Sentry. |
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.
Could you add a simple test for this function? Should be easy enough to set up a sensible test by using tmp_path
fixture.
This is probably a good idea, but I don't really want a |
register_plugin
a standalone function and include shared lib discovery
Sounds good, thanks! |
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 did some cleanup and made some minor changes.
The function is now called register_plugin_function
, as it registers a single function (not all functions in the plugin).
We have to decide whether we want to throw a deprecation warning for the previous Expr.register_plugin
(and ultimately remove it?), due to backward compatibility. It was marked unstable and thanks to Marco's experience we have found that the existing API is lacking.
@ritchie46 what do you think?
Yeap, sounds good to me. 👍 |
c49c418
to
263225c
Compare
Okay, I have done a few more things:
@MarcoGorelli could you give this another look and let me know if you're on board with everything as it currently stands? Then we can work out any last potential issues and get it merged. I'd say this is a really nice ergonomics improvement for plugin authors! |
collect_groups, | ||
input_wildcard_expansion, | ||
returns_scalar, | ||
cast_to_supertypes: cast_to_supertype, |
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 will rename cast_to_supertypes
internally to cast_to_supertype
. The inputs all get cast to their (singular) supertype, so the previous name didn't make sense. I already corrected it in the new plugin function public API, so we don't have to change that again later.
Thanks!
Are you sure about this?:
So the user wouldn't see the |
Aha, in that case I'm adding back the warning 👍 |
Looks good to me, thanks I just checked this out with polars-xdt, and:
|
Thanks for checking! All right, let's press the green button then 👍 |
Starting by giving plugin authors a public version of
_get_shared_lib_location
I'd also really like to have a public version ofa publicparse_as_expression
+wrap_expr
, but will leave that for a separate discussionparse_as_expression
would no longer be needed with these changes