-
Notifications
You must be signed in to change notification settings - Fork 12
Move KernelBuilder into its own file #159
Conversation
Signed-off-by: Major Hayden <[email protected]>
Pull Request Test Coverage Report for Build 534
💛 - Coveralls |
spbnick
left a comment
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.
Yay, cleanup and organizing :)!
One thing: I've seen this happen often in Python, but it still irks me: do we have to repeat ourselves in the module and in the class name? Can we have sktm.kernel.Builder instead? And perhaps (later) sktm.kernel.Tree too?
This is exactly the thing I mentioned to you with the Jenkins class name which doesn't mention Jenkins at all - module information is often only on the import line and lost in the rest of the code, so the class name itself should be descriptive enough to know where it comes from. One of Python's rule is readability, so noone will write a full module path in the code unless they are, for some reason, forced to. I guess it doesn't matter too much if we are the only ones using the code and there is only one way it can be interpreted or used, but for things like libraries it's more or less required and it's a good practice in general. |
|
@veruu, I agree having "Builder" or "Tree" imported directly wouldn't work for the majority of modules. With the exception of perhaps modules also dealing with kernel. I agree that this is especially important for libraries. However I think we should use Python's import system, and avoid repetition. I.e. write In short: let the users decide how they want it named and how much qualified the names should be, because Python lets them do that. Let's not impose particular qualification onto the final (leaf) name. We don't know what scope it will have. In the end, However, if you don't subscribe to my arguments, I'll be OK with Sorry, keep mixing up |
|
Seeing |
|
Well, I'm not at all a Java fan myself, but I think such practices retract from Python's module system and composition flexibility, and disagree with them, at least ATM. However, it doesn't have anything to do with how we run our project :) Let's just be consistent, so if we go with |
|
Thanks for the discussion here (I learned some things!). Is there anything that needs to be changed for this PR to merge? |
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.
My idea was to, yes, have it as sktm.kernel.Builder, but decide how you wanna see it on import. So if you want to have kernel mentioned just import and use it like this:
import sktm.kernel as kernel
builder = kernel.Builder()
So, basically you would have the same "KernelBuilder" just spelled differently, while also allowing calling it just a "Builder", and not repeating ourselves in the hierarchy.
I see, however, that I'm not getting traction with this idea, so let's merge it as is :)
|
We should probably merge this as it's approved already |
The
__init__.pyfile is becoming quite cluttered and this change makes it easier to test and maintain theKernelBuilderclass.