Skip to content

Conversation

@digitalresistor
Copy link
Collaborator

@digitalresistor digitalresistor commented Feb 6, 2020

This branch is to make it simpler and easier to develop GLaDOS plugins and then utilizing those bots, as well as making it simpler to do local development.

  • Moved server.py to servelocal.py
  • Added glados-servelocal which will start a local Flask server
  • Use relative imports to avoid circular imports so that glados.servelocal can exist without issues
  • Move read_config to avoid having to import inside a function
  • Sort imports using isort
  • Allow for providing a python module import path and avoid having a config.yaml file inside a plugins folder.
  • Make automatic config file globbing optional
  • Improve example to utilize new glados-servelocal

This is going to be the new yaml file for adding a plugin to a named bot:

configs/plugins/example.yaml:

ExamplePlugin:
  entrypoint: modulename.plugin:includeme
  name: "Override the default name"
  enabled: yes
  bot:
    name: glados

The idea being here that modulename.plugin exposes a function named includeme, it is passed two arguments: bot, which is an instance of type GladosBot and a **kwargs that contains any other configuration parameters that your plugin may need.

The function should raise an exception if any of the required settings are not included.

If you change entrypoint to modulename.plugin it will default to includeme as the function to be called, so you can pass just a module to be imported/used.

This will allow you to easily import new plugins from directories on the local disk (i.e. in the implicit PYTHONPATH), or plugins installed through a Python package.

@zpriddy zpriddy marked this pull request as ready for review June 3, 2020 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant