hot reloading, plugin instantiation, plugin main method

- The Loader now watches for file changes in the plugin directory, and will (re)import when a new plugin is created, or an existing one is modified. This is implemented by means of the watchdog library
- Plugin classes are now instantiated (and therefore require a self arg in every method). This way they can maintain a state during the runtime of the loader (or until they are reloaded), and share data between methods.
- Plugins can now have a __main() method, which can include long-running code. Every plugin's main method is ran in a separate asyncio task.
- Plugin methods that start from __ are now uncallable from javascript. This can be helpful when implementing unfinished/development versions of methods.
This commit is contained in:
tza
2022-04-04 18:10:02 +03:00
parent cbf46b950a
commit 8c142c01bd
4 changed files with 73 additions and 21 deletions
+2 -1
View File
@@ -1,2 +1,3 @@
aiohttp==3.8.1
aiohttp-jinja2==1.5.0
aiohttp-jinja2==1.5.0
watchdog==2.1.7