Debian Codegraph @

docs/user_guide/plugin_development/development_environment.rst

raw
1 Development environment
2 =======================
3
4 Before we dive in and start writing our very first plugin, I'd like
5 to take a moment to show you some tools and features which help
6 facilitate the development process.
7
8 Loading plugins from a local directory
9 --------------------------------------
10
11 Normally, you manage and install plugins through the built-in
12 `!repos` command. This installs plugins by cloning them via git, and
13 allows updating of them through the `!repos update` command.
14
15 During development however, it would be easier if you could load
16 your plugin(s) directly, without having to commit them to a Git
17 repository and instructing Errbot to pull them down.
18
19 This can be achieved through the `BOT_EXTRA_PLUGIN_DIR` setting in
20 the `config.py` configuration file. If you set a path here pointing
21 to a directory on your local machine, Errbot will (recursively) scan
22 that directory for plugins and attempt to load any it may find.
23
24 Local test mode
25 ---------------
26
27 You can run Errbot in a local single-user mode that does not require
28 any server connection by passing in the `--text` (or
29 `-T`) option flag when starting the bot.
30
31 In this mode, a very minimal back-end is used which you can interact
32 with directly on the command-line. It looks like this::
33
34 $ errbot -T
35 [...]
36 INFO:Plugin activation done.
37 Talk to me >> _
38
39 Plugin scaffolding
40 ------------------
41
42 Plugins consist of two parts, a special `.plug` file and one or more Python (`.py`) files
43 containing the actual code of your plugin
44 (both of these are explained in-depth in the next section).
45 Errbot can automatically generate these files for you
46 so that you do not have to write boilerplate code by hand.
47
48 To create a new plugin, run `errbot --new-plugin`
49 (optionally specifying a directory where to create the new plugin -
50 it will use the current directory by default).
51 It will ask you a few questions such as the name for your plugin,
52 a description and which versions of errbot it will work with and
53 generate a plugin skeleton from this with all the information
54 filled out automatically for you.