-
Notifications
You must be signed in to change notification settings - Fork 129
General: Host implementation defined with class #3337
General: Host implementation defined with class #3337
Conversation
Task linked: OP-3315 Host implementation defined with class |
openpype/host/__init__.py
Outdated
) | ||
|
||
__all__ = ( | ||
"HostImplementation", |
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.
Finding it a bit odd to include "Implementation" into the class name. It's an programming concept.. and as the first line of the class comment states:
"Host is pipeline implementation of DCC application". So it feels a bit redundant.
Any issue with simply calling it "Host" ?
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 againts but Host
is too short (for my taste), maybe BaseHost
or HostBase
?
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.
Any issue with simply calling it "Host" ?
I personally felt the same as @icyvapor - I'd prefer shorter if possible.
Same for MayaHostImplementation
- I'm not sure why it couldn't be called MayaHost
.
From a class naming convention I'd understand MayaHost
better than MayaHostImplementation
. The latter almost sounds like there's still another MayaHost
class somewhere in the code base.
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.
Changed to HostBase
and MayaHost
, is it ok? Any other comments?
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.
The only problem with host
as a word, that it's super hard to find it in the code base when you need to trace it's usages. HostBase
and MayaHost
is pretty good and specific enough not to have millions of false positives when searching through codebase
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.
Would AsbtractHost
make sense too? I'm also fine with HostBase
by the way.
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.
Only abstract part of the class is name
property. In future is planned to have more pre-implemented functionality thus I'm more in HostBase
.
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.
Sorry guys, soon after the comment I was put out of commission for the rest of the week by some health issue. Thanks for addressing the 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.
I have one request: at least for the new files, lets adhere more to some docstring and code-style culture. For example docstrings - they should use napoleon format (there are now parts in markdown that will never render correctly in sphinx when we start generating documentation). Here is some simple guide to it.
Another thing are type hints. For python 2 compatibility we should add typing backport to python 2 hosts but I think we should do type hinting at least on the docstring level.
0d91784
to
ecd2686
Compare
Some notesMethod namesChanged names of some required methods:
Type hintsType hints are an issue because they require imported classes at the top. To be able import them in Python 2 we would have to add DocumentationAdded some documentation related to host implementation. I'm not sure what approach should be used, so I've tried to explain it a way I would explain it to someone on community. Any comments regarding style, naming, grammar, ... are welcomed. |
Why not
I'd say |
This is good to merge now. We can further improve of course, but the sooner we transition to the approach the easier it will be to move on with any global improvements. |
self.log.info("Installed event handler _on_scene_save..") | ||
self.log.info("Installed event handler _before_scene_save..") | ||
self.log.info("Installed event handler _on_scene_new..") | ||
self.log.info("Installed event handler _on_maya_initialized..") | ||
self.log.info("Installed event handler _on_scene_open..") |
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.
not sure about the log leve here, nor the text. The is mainly interesting for developer so it should be debug. Or if not, it should be more user friendly than _on_scene_save..
that will remind artist of an ascii art.
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.
All of them were there before this PR. Irrelevant from point of this PR.
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 agree. As much as there refactoring PRs uncover a lot of tech debt, it should be logged into Issues and handled separately. To keep focus on what these PRs are doing.
Brief description
Initial PR to define host implementation using class instead of using functions from module.
Description
Primary goal is to somehow define what must, should and can be implemented in host to enable certain functionality (public interface for tools and global plugins). Some functionality is not directly defined in base class but in interfaces (e.g. workfiles or load workflow). The reason is that not all hosts support these features but they should be defined somewhere. Maya was used for an "example" usage of class just to match minimum requirements. It does not mean that all functions should be moved to the class, some functions can be used without installed host (e.g. during farm publishing) but the class should provide the functionality.
Secondary goal is for further future features e.g. to implement common logic in the base class and move there some host related logic which lives in global scope right now, which is not possible ATM. That would break backwards compatibility so it must wait until all hosts use the class.
Additional info
Now is the time for discussion and criticism.
TODO
Testing notes: