-
Notifications
You must be signed in to change notification settings - Fork 4
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
Singledispatch entrypoints #38
Singledispatch entrypoints #38
Conversation
Python 3.9 seems to fail, because the arguments for entry_points are wrong. I wonder if we should still support this version of python: https://scientific-python.org/specs/spec-0000/ |
I figured we'd want to support 3.9 until EOL in Oct next year (https://devguide.python.org/versions/) but as a matter of personal preference I'd much rather take your source's advice and drop it earlier, if only so we can use 3.10 features like pattern matching |
If we keep 3.9 supported, we might come in conflict with the latest versions of numpy and xarray. And then we are lacking behind. I think that's why these packages support only a small subset of python versions. |
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 like it. Extensibility by design — reminds me of pytest, where most basic functionality is implemented in the same way external plugins are
True. I didn't realize numpy had already dropped 3.9. I say we just follow them? |
d74a6b8
to
12248cb
Compare
Somewhat similar discussion: modflowpy/flopy#1470 I don't know if @jlarsen-usgs still has plans for a flopy/modflowapi plugin architecture, more recently he has indicated modflowapi will stay separate from flopy. But the entrypoints plugin approach seems applicable to the core flopy framework too, if we want the same "engine" to drive not only mf6 but other programs. This would of course expand the scope of this work — maybe wisest to design/build for mf6 initially, then consider extending it to other programs later. |
I was playing with how we could set up functions in a modular fashion without having to add a function in the corresponding class.
cattrs
mentions the use of single dispatch functions for theirstructure
andunstructure
functions. We can do the same for functions likeplot()
, where the plot function should be seen as a module, and not as part of the class itself.I have combined this functionality with the
entry_points
function to show that a user or plugin package could in theory also add functionality. For example, a user comes with a specific entry point for plotting a specific package, other than the default way that we normally do.