watch and (re)load plugins from a directory
Project description
nonebot-plugins-watch
hot plug and remove nonebot plugins
Installation
pip install nbplugins-watch
Validate installation
python -c "import nbplugins_watch; print(nbplugins_watch.__version__)"
0.0.1
Usage
Make a directory somewhere and place an empty __init__.py in it.
Monitor the directory in your nonebot runner file, e.g. in my_nonebot.py
:
import nonebot
nonebot.load_builtin_plugins() # optional
plugin_dir_path = r"path_to_plugin_dir" # absolute or relative path
from nbplugins_watch import nbplugins_watch
nbplugins_watch(plugin_dir_path)
nonebot.run()
Create a file, say fancy_plugin.py, in the directory above. Edit and test and/or remove the file fancy_plugin.py to your heart's content.
Note: if a plugin file contains syntax errors (as opposed to logic errors), you'll have to restart nonebot, in other words, nbplugins_watch will cease to work after an uncaught error.
Acknowledgments
- Thanks to everyone whose code was used
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nbplugins-watch-0.0.5.tar.gz
(4.3 kB
view hashes)
Built Distribution
Close
Hashes for nbplugins_watch-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0225c9073e2d96b1c3d845b027aa5035672f3ba73f80d846024d0cbb60de288 |
|
MD5 | 45dd29cc7b5d307eeb5da6e731a5a58d |
|
BLAKE2b-256 | 27eaed76d81f8ed74f085f23f6e52efb370327baf42338728c8aec6d84c9f2cf |