You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It may be a good idea to try and import the entire packages of plugin modules and then simply iterate over the package namespace to try and find any subclasses of Agent (and Event/Action, if we want to pursue the idea mentioned in #17).
A possibly better idea is to decorate classes in the plugins and register them that way. I think we discussed doing this before but never got around to doing it for whatever reason and the idea disappeared into the ether.
I got these ideas while browsing the source of ZeroNet for leisure while sick. It's definately recommended reading, especially the PluginManager. It seems like they add the directory containing all plugins to the Python path (sys.path), as has been discussed, along with a few other source directories important to the project which can be found in this search.
I think adding to the Python path is a good course of action. I'm likely to introduce something similar into ActivityWatch, and if we can make a general PluginManager that'd be cool. I'd also like to introduce a ~/.config/homebrain (when running as a user service) and /var/lib/homebrain (when running as a system service under a user homebrain). These folders should each contain a plugin folder and configuration (such as which agents to start and how to connect them upon starting).
A decorator for agents would be a great idea so we can skip the agentclass variable in the init.py files.
As seen here, we already add the agents folder to the sys.path and import each one, so that's nothing new though.
After that we could move the autostart variable in init.py to a static class variable inside the agentclasses or something like that. We still need some place to put settings for the agents.
This doesn't add any functionality but makes things more clear, I'm all for that.
The /var/lib/homebrain and .config/homebrain have we already talked about and you know that i would like to see that aswell.
Made alot of changes.
The init.py files no longer specify the agentclass nor autostart and only import the agent files.
The module manager now instead finds all agent classes by itself, and if a agent wants to autostart it has to set "autostart = true" as a static class variable
It may be a good idea to try and import the entire packages of plugin modules and then simply iterate over the package namespace to try and find any subclasses of
Agent
(andEvent
/Action
, if we want to pursue the idea mentioned in #17).A possibly better idea is to decorate classes in the plugins and register them that way. I think we discussed doing this before but never got around to doing it for whatever reason and the idea disappeared into the ether.
I got these ideas while browsing the source of ZeroNet for leisure while sick. It's definately recommended reading, especially the PluginManager. It seems like they add the directory containing all plugins to the Python path (
sys.path
), as has been discussed, along with a few other source directories important to the project which can be found in this search.I think adding to the Python path is a good course of action. I'm likely to introduce something similar into ActivityWatch, and if we can make a general
PluginManager
that'd be cool. I'd also like to introduce a~/.config/homebrain
(when running as a user service) and/var/lib/homebrain
(when running as a system service under a userhomebrain
). These folders should each contain a plugin folder and configuration (such as which agents to start and how to connect them upon starting).Ping @johan-bjareholt @vlthr, what do you think?
The text was updated successfully, but these errors were encountered: