-
Notifications
You must be signed in to change notification settings - Fork 34
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
Code: Improve type hints for Creators #366
Code: Improve type hints for Creators #366
Conversation
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 encountered the errors and they crashed the loader and tray-publisher when I am testing the code in developer mode. I also tested with the latest develop in developer mode but it doesn't encounter such errors.
PS D:\ayon_launcher\ayon-launcher\build\output> ./ayon_console.exe --use-dev
>>> Connected to AYON server http://localhost:5000
*** WRN: >>> { AddonsLoader }: [ Please update 'applications' addon to '0.2.0' or higher. Using client code from ayon-core repository. ]
*** AYON [1.0.2-dev.1] -----------------------------------------------------------------------------------------------
>>> Using AYON from [ D:\ayon_launcher\ayon-launcher\build\output ]
... AYON variant: [ dev (test_thumbnail-prod-04) ]
... AYON bundle: [ test_thumbnail-prod-04 ]
>>> loading environments ...
- global AYON ...
- for addons ...
Registered font families: Noto Sans, Noto Sans, Noto Sans, Noto Sans, Noto Sans Mono Black, Noto Sans Mono, Noto Sans Mono ExtraBold, Noto Sans Mono ExtraLight, Noto Sans Mono Light, Noto Sans Mono Medium, Noto Sans Mono, Noto Sans Mono SemiBold, Noto Sans Mono Thin
WARNING:TrayAddonsManager:Addon "launcher_tool" crashed on `tray_init`.
Traceback (most recent call last):
File "D:\ayon-core\client\ayon_core\addon\base.py", line 1378, in tray_init
addon.tray_init()
File "D:\ayon-core\client\ayon_core\modules\launcher_action.py", line 17, in tray_init
self._create_window()
File "D:\ayon-core\client\ayon_core\modules\launcher_action.py", line 51, in _create_window
from ayon_core.tools.launcher.ui import LauncherWindow
File "D:\ayon_launcher\ayon-launcher\build\output\vendor\python\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "D:\ayon-core\client\ayon_core\tools\launcher\ui\__init__.py", line 1, in <module>
from .window import LauncherWindow
File "D:\ayon_launcher\ayon-launcher\build\output\vendor\python\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "D:\ayon-core\client\ayon_core\tools\launcher\ui\window.py", line 6, in <module>
from ayon_core.tools.launcher.control import BaseLauncherController
File "D:\ayon_launcher\ayon-launcher\build\output\vendor\python\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "D:\ayon-core\client\ayon_core\tools\launcher\control.py", line 7, in <module>
from .models import LauncherSelectionModel, ActionsModel
File "D:\ayon_launcher\ayon-launcher\build\output\vendor\python\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "D:\ayon-core\client\ayon_core\tools\launcher\models\__init__.py", line 1, in <module>
from .actions import ActionsModel
File "D:\ayon_launcher\ayon-launcher\build\output\vendor\python\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "D:\ayon-core\client\ayon_core\tools\launcher\models\actions.py", line 6, in <module>
from ayon_core.pipeline.actions import (
File "D:\ayon_launcher\ayon-launcher\build\output\vendor\python\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "D:\ayon-core\client\ayon_core\pipeline\__init__.py", line 11, in <module>
from .create import (
File "D:\ayon_launcher\ayon-launcher\build\output\vendor\python\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "D:\ayon-core\client\ayon_core\pipeline\create\__init__.py", line 19, in <module>
from .creator_plugins import (
File "D:\ayon_launcher\ayon-launcher\build\output\vendor\python\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "D:\ayon-core\client\ayon_core\pipeline\create\creator_plugins.py", line 156, in <module>
class BaseCreator:
File "D:\ayon-core\client\ayon_core\pipeline\create\creator_plugins.py", line 195, in BaseCreator
instance_attr_defs: List[AbstractAttrDef] = []
NameError: name 'AbstractAttrDef' is not defined
*** WRN: >>> { loader_tool }: [ Couldn't load Loader tool for tray. ]
==============================
name 'AbstractAttrDef' is not defined
==============================
Traceback (most recent call last):
File "D:\ayon-core\client\ayon_core\modules\loader_action.py", line 16, in tray_init
from ayon_core.tools.loader.ui import LoaderWindow # noqa F401
File "D:\ayon_launcher\ayon-launcher\build\output\vendor\python\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "D:\ayon-core\client\ayon_core\tools\loader\__init__.py", line 1, in <module>
from .control import LoaderController
File "D:\ayon_launcher\ayon-launcher\build\output\vendor\python\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "D:\ayon-core\client\ayon_core\tools\loader\control.py", line 7, in <module>
from ayon_core.pipeline import Anatomy, get_current_context
File "D:\ayon_launcher\ayon-launcher\build\output\vendor\python\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "D:\ayon-core\client\ayon_core\pipeline\__init__.py", line 11, in <module>
from .create import (
File "D:\ayon_launcher\ayon-launcher\build\output\vendor\python\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "D:\ayon-core\client\ayon_core\pipeline\create\__init__.py", line 19, in <module>
from .creator_plugins import (
File "D:\ayon_launcher\ayon-launcher\build\output\vendor\python\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "D:\ayon-core\client\ayon_core\pipeline\create\creator_plugins.py", line 156, in <module>
class BaseCreator:
File "D:\ayon-core\client\ayon_core\pipeline\create\creator_plugins.py", line 195, in BaseCreator
instance_attr_defs: List[ AbstractAttrDef] = [ ]
NameERROR: name 'AbstractAttrDef' is not defined
>>> [ IdleManager has started ]
-----------------------+--------------+---------+---------------+---------+------------+-----
Addon name |Initialization|Tray init|Connect modules|Tray menu|Addons start|Total
-----------------------+--------------+---------+---------------+---------+------------+-----
AfterEffectsAddon |0.000 |N/A |0.000 |N/A |N/A |0.000
ApplicationsAddon |0.000 |N/A |0.000 |N/A |N/A |0.000
BlenderAddon |0.000 |N/A |0.000 |N/A |N/A |0.000
CelactionAddon |0.000 |N/A |0.000 |N/A |N/A |0.000
ClockifyModule |0.000 |N/A |N/A |N/A |N/A |0.000
DeadlineModule |0.000 |N/A |0.000 |N/A |N/A |0.000
FusionAddon |0.000 |N/A |0.000 |N/A |N/A |0.000
HieroAddon |0.000 |N/A |0.000 |N/A |N/A |0.000
HoudiniAddon |0.000 |N/A |0.000 |N/A |N/A |0.000
JobQueueAddon |0.000 |N/A |0.000 |N/A |N/A |0.000
LauncherAction |0.000 |0.011 |0.000 |N/A |N/A |0.011
LoaderAddon |0.000 |0.004 |0.000 |0.000 |0.000 |0.004
MaxAddon |0.000 |N/A |0.000 |N/A |N/A |0.000
MayaAddon |0.000 |N/A |0.000 |N/A |N/A |0.000
NukeAddon |0.001 |N/A |0.000 |N/A |N/A |0.001
OCIODistModule |0.000 |N/A |0.000 |N/A |N/A |0.000
PhotoshopAddon |0.000 |N/A |0.000 |N/A |N/A |0.000
PythonInterpreterAction|0.000 |0.261 |0.000 |0.000 |0.000 |0.261
ResolveAddon |0.000 |N/A |0.000 |N/A |N/A |0.000
RoyalRenderAddon |0.000 |N/A |N/A |N/A |N/A |0.000
SubstanceAddon |0.000 |N/A |0.000 |N/A |N/A |0.000
TVPaintAddon |0.000 |N/A |0.000 |N/A |N/A |0.000
ThirdPartyDistAddon |0.000 |0.000 |0.000 |0.000 |0.020 |0.020
TimersManager |0.000 |0.027 |0.000 |0.007 |0.000 |0.034
TrayPublishAddon |0.000 |0.000 |0.000 |0.000 |0.000 |0.000
UnrealAddon |0.000 |N/A |0.000 |N/A |N/A |0.000
WebServerAddon |0.001 |0.085 |0.000 |0.000 |0.001 |0.086
-----------------------+--------------+---------+---------------+---------+------------+-----
Total |0.001 |0.387 |0.000 |0.007 |0.021 |0.416
>>> [ Starting WebServer server ]
>>> [ IdleManager has stopped ]
>>> [ Web server stopped ]
Fixed open issues, some more cleanup and merged in #696 which basically was me implementing some of the same things 🤦 @iLLiCiTiT could you review the code style again? sorry about the long wait on this PR. |
This could also be `dict[str, Any] | None` but my IDE still displayed that as `Optional[dict[str, Any]]` so I guess this is just as fine.
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
…ancement/create_context_typing # Conflicts: # server_addon/jobqueue/client/ayon_jobqueue/addon.py
…m/BigRoy/ayon-core into enhancement/create_context_typing
Can you make few smaller PRs? Right now github refuses to show differences and when something is loaded, it shows added files and lines. |
Github shows me very few changes actually - and the changes are small. I'm not sure how to separate this further without creating a PR per file almost. Did you comment on the wrong PR or is Github doing something crazy for you? |
Like 1 hour ago I saw at about 100 changed files... Maybe glitch in GitHub. |
Failing on linting. |
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.
Tested creators in Maya and Houdini, works fine.
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.
looks good. I am wondering why those typos were not caught by codespell check here on GH...
Co-authored-by: Mustafa Taher <mustafataherzaky@outlook.com>
Changelog Description
Improve type hints for Creators
Additional info
This improves the type hints in my IDE (PyCharm). However, I wonder if these changes are worth it since
typing
seems to be quite a bit in flux in Py3 and I'm not sure whether all used here was available in older Py3 versions.Note that the use of- removed the usage ofUnion
may make thisPy3.5+
Union
in favor ofOptional
Testing notes: