-
Notifications
You must be signed in to change notification settings - Fork 536
changes in Interfaces base (closes #2320) #2387
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
Is this intended for 1.0, 1.0 maintenance, or 2.0?
@effigies this are for 1.0, but don't know if we have to wait to include everything before release. Was planning to do it last week, but didn't happen..
Notice, that these are independent points that were suggested by me or @satra during #2303 revision. If you or @satra find time to review it we can merge before finishing all points (I'm trying to keep them in separate commits) and I can open a new PR.
that would eliminate a bug in _check_version_requirements.
do you know anyone using MpiCommandLine? should I remove it?
Okay, I can have a look.
As for MpiCommandLine, I would generally prefer not to remove functionality that someone may be using without a deprecation cycle. i.e. We should have had a few releases where we raised warnings that it was going to go away, which would give people time to complain or find another approach before we actually pull the rug out from under them. So unless there's a really compelling reason to remove it, I would leave it. If people think it's not worth supporting, we can deprecate it so it can be removed later.
...t use a afast validator, so i renamed BaseFile(Directory) to File(Directory) and removed extra classes
@effigies ok, I removed MpiCommandLine from the list.
Note that my last commits renamed MultiPath (as suggested by @satra some time ago), and removed BaseFile/BaseDirectory (because they were not used and didn't differ from File/Directory). Hope that's ok, but if you think that would cause problems, I can revert
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.
Commenting on the first 5 points (perhaps not in order).
I would be inclined to leave *MultiPath as it is for 1.0. External users depend on it. We can change it in 2.0. If you think it would be good to have *MultiObject for 1.0, I would simply do:
InputMultiObject = InputMultiPath OutputMultiObject = OutputMultiPath
This would allow users to begin switching to the new syntax before 2.0, without modifying the class hierarchy.
I'll get to the rest shortly, but wanted to get you some feedback right now.
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'm not sure I see a semantic difference in 955b3ad. I see:
if names and self.version: ... # Check min_ver check = dict(...) names = trait_object.trait_names(**check) ... # Check max_ver
Which becomes:
if names and self.version: ... # Check min_ver check = dict(...) names = trait_object.trait_names(**check) if names and self.version: ... # Check max_ver
Am I missing something?
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.
answered lower in the discussion
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.
This used to be called from _generate_handlers.
nipype/nipype/interfaces/base.py
Lines 389 to 390 in 5495816
I was unable to quickly find the PR it was removed in, so it's hard to tell whether its removal was intentional or a mistake. As an unused private methods, I'm okay with getting rid of it, but @satra, if this should still be in _generate_handlers, let us know.
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'm unclear on the original justification for this separation, but dropping BaseFile seems fine to me.
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.
Unused private method. Good to remove, as far as I'm concerned. Again, @satra, feel free to override if this looks like a mistake.
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'm okay with this, but we should verify that we can pretty print Bunches in IPython with this change. I don't know if the API changed beyond what method it looks for in your objects.
if it doesn't work quickly, I'd say remove the function altogether and create an issue to fix and re-add, rather than waste time on this today.
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've just checked that pretty from IPython.lib.pretty uses _repr_pretty_ method (and completely ignored when it was named __pretty__).
In my opinion it looks as "pretty" as simply printing Bunch, so I can either remove it or keep my name.
Let me know if this was design to work with different library.
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.
It looks like what it does is prevents an infinite loop during formating. Could you test with a bunch that contains itself?
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.
yes, you're right, for a bunch that contains itself it makes a difference! But only with the new name _repr_pretty_.
And you don't actually have to import pretty in ipython.
I would not refactor Bunch this close to release. That feels like a rabbit hole that should be entered on a leisurely time frame.
@djarecka Review complete. I'll look at the max_ver issue locally. I don't see how your change can be fixing it, but if the test fails before and works after, I'll allow it.
@effigies ok, I'm just working actually on Bunch, but I can definitely set this as a new PR for future versions
@djarecka - basefile and basedirectory provide different validation error messages than from traits. the code is not the same. please don't remove when the code does not match the traits code.
_requires_warn can be removed since we disabled that.
_hash_infile can be removed
there are many folks who rely on InputMultiPath for their external interfaces. MultiObject/Bunch should be left for the nipype 2.0 refactor.
Ah, gotcha. Yeah, 👍 on max_ver fix.
-
I'll revert
MultiObjectand together withBunchrefactoring will wait till 2.0 -
I can revert my changes of
basefileandbasedirectory, but I don't understand your point @satra. I did NOT remove these classes, I removedFileandDirectoryclasses because IMO were the same asBaseFileandBaseDirectory. Since I didn't want to change the API, I simply renamedBaseFiletoFileandBaseDirectorytoDirectory.
Answering your question @effigies about the original justification: I'm not sure (@satra can correct me), but 2 classes File and BaseFile were created probably to provide an option to use either fast validator or not (see the difference between BaseUnicode and Unicode in traits doc. However the code that was changing validator in File and Directory classes were commented 2 years ago
@djarecka - the reason for the classes have nothing to do with the validator, only the error message. trait's own error message is very cryptic for missing files/directories.
i'm fine with File/Directory being mapped directly to BaseFile/BaseDirectory
yes, I only meant that the reason to have two pairs File/Directory and BaseFile/BaseDirectory was probably related to the validator options offered by traits.
It will be included in 2.0 This reverts commit 36ffda1.
Uh oh!
There was an error while loading. Please reload this page.
changes in interface base listed in #2320:
_check_version_requirementsdoes not check the max_version, this block has wrong indentationI was a bit confused about
BaseFileandFile, etc., do we really need both? Also I believe that we're assuming thatBaseUnicodeuses the fast validator (https://github.com/oesteban/nipype/blob/ref/interface-base/nipype/interfaces/base/traits_extension.py#L98), but from traits documentation I understood thatUnicode(notBaseUnicode) uses the C-level fast validator (http://docs.enthought.com/traits/traits_api_reference/trait_types.html?highlight=baseunicode#traits.trait_types.BaseUnicode. Am I missing something?couldn't find a place where we're using
_requires_warnthe same about
_hash_infileis
__pretty__still working?is it for this package: http://ipython.readthedocs.io/en/stable/api/generated/IPython.lib.pretty.html#extending ?
they suggest
_repr_pretty_Check on this
synchronizeCheck the logic of this