Plugin interface improvements
This PR implements a number of improvements to the plugin system and partially addresses #37.
-
It provides a new
Pluggable
class which formalizes which interfaces accept plugins. A simpler version of this code already existed in classes likeDNADNANet
andTransform
but was duplicated; this centralizes it and provides a central plugin registry.Currently pluggable interfaces include:
- Networks, from
dndanda.nets.Network
(which I renamed fromDNADNANet
, though this is kept for now for compatibility). - Transforms, from
dnadna.transforms.Transform
- Simulators, from
dnadna.simulator.Simulator
Others can easily be added later.
- Networks, from
-
I added some improvements to plugin loading. In particular, your training config file can have a key:
plugins: ["path/to/my_plugin.py"]
to automatically load plugins when running training. You can still specify them with
--plugin
at the command-line too. -
Added logging of plugins: When you run
dnadna train
for example, all loaded plugins and the functionality the provide are logged. -
Started some documentation on writing and using plugins in DNADNA. It should be extended with more examples if any of you can think of some good ones. You can read the raw form here docs/extending.rst.
This is also needed in part for #48, which while brainstorming I realized might need some improvements to the plugin framework (for example when a user selects transforms to add to their dataset the configuration wizard needs to be able to list all available transforms, including any loaded from plugins).