diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-18 05:57:55 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-18 05:57:55 +0000 |
commit | 2dec8850725b4f755d49b59ce4381ce8a7959f48 (patch) | |
tree | c247573b37b6a0c1d150c1ddd8ed79d0a4e0d7c2 | |
parent | 14f8f97bea55ee6bc4bf21064bf1284c6d3ea4ce (diff) |
automatic import of python-kutana
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-kutana.spec | 373 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 375 insertions, 0 deletions
@@ -0,0 +1 @@ +/kutana-5.2.0.tar.gz diff --git a/python-kutana.spec b/python-kutana.spec new file mode 100644 index 0000000..4b6ac30 --- /dev/null +++ b/python-kutana.spec @@ -0,0 +1,373 @@ +%global _empty_manifest_terminate_build 0 +Name: python-kutana +Version: 5.2.0 +Release: 1 +Summary: The library for developing systems for messengers and social networks +License: MIT License +URL: https://github.com/ekonda/kutana +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/0c/58/99b315005650f01a1ee29425bba4679e58d61f98cebaf659cc7f22020651/kutana-5.2.0.tar.gz +BuildArch: noarch + +Requires: python3-sortedcontainers +Requires: python3-aiohttp +Requires: python3-motor +Requires: python3-pyyaml + +%description +# Kutana + + + +[](https://kutana.readthedocs.io/en/latest/?badge=latest) +[](https://www.codefactor.io/repository/github/ekonda/kutana) +[](https://coveralls.io/github/ekonda/kutana?branch=master) +[](https://codebeat.co/projects/github-com-ekonda-kutana-master) +[](https://badge.fury.io/py/kutana) + +The library for developing systems for messengers and social networks. Great +for developing bots. Refer to [example](https://github.com/ekonda/kutana/tree/master/example) +for the showcase of the library abilities. + +This library uses generalized attachment types, possible actions e.t.c. for flexibility +to use plugins with different backends. + +## Installation + +```bash +python -m pip install kutana +``` + +## Running + +### From CLI + +Following command will populate application's config, add specified backends and +load plugins from specified folder. + +```bash +python3 -m kutana --config example/config.yml --plugins example/plugins + +# usage: python3 -m kutana [-h] [--config CONFIG] [--plugins PLUGINS] [--debug] + +# Run kutana application instance using provided config. + +# optional arguments: +# -h, --help show this help message and exit +# --config CONFIG file with config in yaml format (default: config.yml +# --plugins PLUGINS folder with plugins to load (default: plugins) +# --debug set logging level to debug +``` + +Refer to the example [config.yml](https://github.com/ekonda/kutana/tree/master/example/config.example.yml) +for the configuration details. + +### From python + +```py +import json +from kutana import Kutana, load_plugins +from kutana.backends import Vkontakte + +# Import configuration +with open("config.json") as fh: + config = json.load(fh) + +# Create application +app = Kutana() + +# Add manager to application +app.add_backend(Vkontakte(token=config["vk_token"])) + +# Load and register plugins +app.add_plugins(load_plugins("plugins/")) + +if __name__ == "__main__": + # Run application + app.run() +``` + +> Token for Vkontakte is loaded from the file "config.json" +> and plugins are loaded from folder "plugins/" + +## Example plugin (`plugins/echo.py`) + +```py +from kutana import Plugin, t + +plugin = Plugin(name=t("Echo")) + +@plugin.on_commands(["echo"]) +async def __(msg, ctx): + await ctx.reply(ctx.body, attachments=msg.attachments) +``` + +> If your function exists only to be decorated, you can use `_` to avoid +> unnecessary names. Use `__` if you use something like pydash. + +## Available backends + +- Vkontakte (for [vk.com](https://vk.com) groups) +- Telegram (for [telegram.org](https://telegram.org) bots) + +## Authors + +- **Michael Krukov** - [@michaelkrukov](https://github.com/michaelkrukov) +- [Other contributors](CONTRIBUTORS.md) + + +%package -n python3-kutana +Summary: The library for developing systems for messengers and social networks +Provides: python-kutana +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-kutana +# Kutana + + + +[](https://kutana.readthedocs.io/en/latest/?badge=latest) +[](https://www.codefactor.io/repository/github/ekonda/kutana) +[](https://coveralls.io/github/ekonda/kutana?branch=master) +[](https://codebeat.co/projects/github-com-ekonda-kutana-master) +[](https://badge.fury.io/py/kutana) + +The library for developing systems for messengers and social networks. Great +for developing bots. Refer to [example](https://github.com/ekonda/kutana/tree/master/example) +for the showcase of the library abilities. + +This library uses generalized attachment types, possible actions e.t.c. for flexibility +to use plugins with different backends. + +## Installation + +```bash +python -m pip install kutana +``` + +## Running + +### From CLI + +Following command will populate application's config, add specified backends and +load plugins from specified folder. + +```bash +python3 -m kutana --config example/config.yml --plugins example/plugins + +# usage: python3 -m kutana [-h] [--config CONFIG] [--plugins PLUGINS] [--debug] + +# Run kutana application instance using provided config. + +# optional arguments: +# -h, --help show this help message and exit +# --config CONFIG file with config in yaml format (default: config.yml +# --plugins PLUGINS folder with plugins to load (default: plugins) +# --debug set logging level to debug +``` + +Refer to the example [config.yml](https://github.com/ekonda/kutana/tree/master/example/config.example.yml) +for the configuration details. + +### From python + +```py +import json +from kutana import Kutana, load_plugins +from kutana.backends import Vkontakte + +# Import configuration +with open("config.json") as fh: + config = json.load(fh) + +# Create application +app = Kutana() + +# Add manager to application +app.add_backend(Vkontakte(token=config["vk_token"])) + +# Load and register plugins +app.add_plugins(load_plugins("plugins/")) + +if __name__ == "__main__": + # Run application + app.run() +``` + +> Token for Vkontakte is loaded from the file "config.json" +> and plugins are loaded from folder "plugins/" + +## Example plugin (`plugins/echo.py`) + +```py +from kutana import Plugin, t + +plugin = Plugin(name=t("Echo")) + +@plugin.on_commands(["echo"]) +async def __(msg, ctx): + await ctx.reply(ctx.body, attachments=msg.attachments) +``` + +> If your function exists only to be decorated, you can use `_` to avoid +> unnecessary names. Use `__` if you use something like pydash. + +## Available backends + +- Vkontakte (for [vk.com](https://vk.com) groups) +- Telegram (for [telegram.org](https://telegram.org) bots) + +## Authors + +- **Michael Krukov** - [@michaelkrukov](https://github.com/michaelkrukov) +- [Other contributors](CONTRIBUTORS.md) + + +%package help +Summary: Development documents and examples for kutana +Provides: python3-kutana-doc +%description help +# Kutana + + + +[](https://kutana.readthedocs.io/en/latest/?badge=latest) +[](https://www.codefactor.io/repository/github/ekonda/kutana) +[](https://coveralls.io/github/ekonda/kutana?branch=master) +[](https://codebeat.co/projects/github-com-ekonda-kutana-master) +[](https://badge.fury.io/py/kutana) + +The library for developing systems for messengers and social networks. Great +for developing bots. Refer to [example](https://github.com/ekonda/kutana/tree/master/example) +for the showcase of the library abilities. + +This library uses generalized attachment types, possible actions e.t.c. for flexibility +to use plugins with different backends. + +## Installation + +```bash +python -m pip install kutana +``` + +## Running + +### From CLI + +Following command will populate application's config, add specified backends and +load plugins from specified folder. + +```bash +python3 -m kutana --config example/config.yml --plugins example/plugins + +# usage: python3 -m kutana [-h] [--config CONFIG] [--plugins PLUGINS] [--debug] + +# Run kutana application instance using provided config. + +# optional arguments: +# -h, --help show this help message and exit +# --config CONFIG file with config in yaml format (default: config.yml +# --plugins PLUGINS folder with plugins to load (default: plugins) +# --debug set logging level to debug +``` + +Refer to the example [config.yml](https://github.com/ekonda/kutana/tree/master/example/config.example.yml) +for the configuration details. + +### From python + +```py +import json +from kutana import Kutana, load_plugins +from kutana.backends import Vkontakte + +# Import configuration +with open("config.json") as fh: + config = json.load(fh) + +# Create application +app = Kutana() + +# Add manager to application +app.add_backend(Vkontakte(token=config["vk_token"])) + +# Load and register plugins +app.add_plugins(load_plugins("plugins/")) + +if __name__ == "__main__": + # Run application + app.run() +``` + +> Token for Vkontakte is loaded from the file "config.json" +> and plugins are loaded from folder "plugins/" + +## Example plugin (`plugins/echo.py`) + +```py +from kutana import Plugin, t + +plugin = Plugin(name=t("Echo")) + +@plugin.on_commands(["echo"]) +async def __(msg, ctx): + await ctx.reply(ctx.body, attachments=msg.attachments) +``` + +> If your function exists only to be decorated, you can use `_` to avoid +> unnecessary names. Use `__` if you use something like pydash. + +## Available backends + +- Vkontakte (for [vk.com](https://vk.com) groups) +- Telegram (for [telegram.org](https://telegram.org) bots) + +## Authors + +- **Michael Krukov** - [@michaelkrukov](https://github.com/michaelkrukov) +- [Other contributors](CONTRIBUTORS.md) + + +%prep +%autosetup -n kutana-5.2.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-kutana -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Thu May 18 2023 Python_Bot <Python_Bot@openeuler.org> - 5.2.0-1 +- Package Spec generated @@ -0,0 +1 @@ +bcfc3b38bfbd448edee12a769100ad6a kutana-5.2.0.tar.gz |