mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-01-14 13:07:55 -05:00
Previously, custom node loading occurred _during module imports_. A consequence of this is that when a custom node import fails (e.g. its type clobbers an existing node), the app fails to start up. In fact, any time we import basically anything from the app, we trigger custom node imports! Not good. This logic is now in its own function, called as the API app starts up. If a custom node load fails for any reason, it no longer prevents the app from starting up. One other bonus we get from this is that we can now ensure custom nodes are loaded _after_ core nodes. Any clobbering that may occur while loading custom nodes is now guaranteed to be a custom node clobbering a core node's type - and not the other way round.
6 lines
207 B
Python
6 lines
207 B
Python
from pathlib import Path
|
|
|
|
# add core nodes to __all__
|
|
python_files = filter(lambda f: not f.name.startswith("_"), Path(__file__).parent.glob("*.py"))
|
|
__all__ = [f.stem for f in python_files] # type: ignore
|