-
Notifications
You must be signed in to change notification settings - Fork 533
ENH: Add LibraryBaseInterface #2538
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
001cd71
to
3b25528
Compare
Looks like a great idea to me |
Codecov Report
@@ Coverage Diff @@
## master #2538 +/- ##
==========================================
- Coverage 66.88% 66.88% -0.01%
==========================================
Files 327 330 +3
Lines 42491 42484 -7
Branches 5269 5269
==========================================
- Hits 28422 28417 -5
- Misses 13367 13369 +2
+ Partials 702 698 -4
Continue to review full report at Codecov.
|
@effigies +1 - i think anytime we can abstract usefully and reduce boilerplate is a welcome change. i'm finishing up a new issue post on just this - it came up day before when i was with some folks in DC. |
cddaff1
to
b8bd289
Compare
b8bd289
to
7e83fac
Compare
68544d3
to
516ae7a
Compare
A few thoughts from playing with this:
Anyway, I think I've done what I'm likely to with this PR. If it seems valuable, cool. If there are other library-based interface sets that I've missed (I mostly discovered these by grepping for |
except ImportError: | ||
failed_imports.append(pkg) | ||
if failed_imports: | ||
iflogger.warn('Unable to import %s; %s interface may fail to ' |
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.
is this going to generate a lot of warnings when we create docs? or make specs
? i.e. things that simply create an instance of an interface:
InterfaceX()
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.
Yeah, potentially. I guess we could set a class-level flag to only display once per class? Or do you have another preferred approach?
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.
one option would be to remove this if. let's merge it and see how annoying it gets.
@effigies - this looks good to me. for future work (in 2.0) we could consider simplifying many of these interfaces through the py3 annotation framework |
Similar to CLI interfaces, interfaces built on Python libraries (such as dipy, nilearn, nipy, etc.) have some common features and requirements, and it may be useful to unify this into a base class.
Here I suggest a minimal
LibraryBaseInterface
class which:version
property by the library__version__
, which should make it trivial to usemin_ver
andmax_ver
in input specsAs a quick demonstration, I've simplified
DipyBaseInterface
.If this is something worth pursuing, I'll have a look at other library-based interface collections and see what useful things can be standardized and abstracted up into this class.
@satra @chrisfilo @oesteban Thoughts?