-
Notifications
You must be signed in to change notification settings - Fork 48
Fix/Simplify plugin_function
#95
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
Conversation
|
Awesome @tlambert03 , the new code is so short! ❤️ Closes #94 I'll send a PR to your repo for fixing the failing tests... |
set destination parameters to None per default
Codecov Report
@@ Coverage Diff @@
## master #95 +/- ##
==========================================
- Coverage 91.33% 91.31% -0.02%
==========================================
Files 474 474
Lines 7478 7462 -16
==========================================
- Hits 6830 6814 -16
Misses 648 648
Continue to review full report at Codecov.
|
|
thanks! This is mergeable now... I still think there's some room for improvement on the |
Yes! I also don't like that either. I struggled hard to make it work earlier and would love to come up with a better solution. You should see the solution on Java side.... It's sooo much worse ;-) I will continue thinking about it. Thanks for this PR! |
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #95 +/- ##
==========================================
- Coverage 91.33% 91.31% -0.02%
==========================================
Files 474 474
Lines 7478 7462 -16
==========================================
- Hits 6830 6814 -16
Misses 648 648 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This PR simplifies and fixes some bugs in the heavily used
plugin_functiondecorator.It moves to the more modern
inspect.SignatureAPI, and takes advantage of theSignature.bindmethod to accomplish in a single line what most of the previous implementation was trying to do.Importantly, this is fixing a big bug in the current implementation, which is that position or keyword arguments were not working. as an explanation:
the current
plugin_functionbreaks this functionality, meaning that functions must be called in a very specific way, or they will break:pyclesperanto_prototype/pyclesperanto_prototype/_tier0/_execute.py in execute(anchor, opencl_kernel_filename, kernel_name, global_size, parameters, prog, constants, image_size_independent_kernel_compilation) 211 arguments.append(np.array([value], np.float32)) 212 else: --> 213 raise TypeError( 214 f"other types than float and int aren`t supported yet for parameters {key} : {value} . \n" 215 f"function {kernel_name}" TypeError: other types than float and int aren`t supported yet for parameters src : [[ 0.42569358 0.41798918 0.487596 0.21005139 -0.19382348 -0.40420797this PR fixes that...
however, I'm still having a bit of an issue with tests, because there was one more thing I'm struggling to figure out here. The
output_creatorfunction may be one of many of the functions in_create.py, however each of those has a very different signature (some take*args, some do not) ... so there too, extra logic is required inplugin_functionto call theoutput_creatorin just the right way depending on the context. Can you help me understand the intent there? Shouldoutput_creatorusually just receive the positional arguments provided to the function? something different?