kutana


Namekutana JSON
Version 6.0.1 PyPI version JSON
download
home_pageNone
SummaryThe library for developing systems for messengers and social networks
upload_time2024-09-08 14:11:15
maintainerNone
docs_urlNone
authorMichael Kryukov
requires_python<4.0,>=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Kutana

![Kutana logo](./docs/kutana-logo-512.png?raw=true "Kutana")

[![PyPI version](https://badge.fury.io/py/kutana.svg)](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
```

## Documentation

You can read the extended description of the library in
the [docs/index.md](example/config.example.yml) file. At the moment,
the documentation is not in the best condition. If you would like
to contribute to its writing, welcome to the issues.

## Running

### From CLI

Following command will populate application's config, add specified backends and
load plugins from specified folder.

```bash
python3 -m kutana run example/config.yml

# usage: kutana [-h] {init,run} ...
#
# helpfull cli utility
#
# positional arguments:
#   {init,run}
#     init      initiate kutana project
#     run       run kutana project using provided config (working directory will be changed to the one with config file)
#
# optional arguments:
#   -h, --help  show this help message and exit
```

Refer to the example [config.yml](example/config.example.yml)
for the configuration details.

### From code

```py
from kutana import Kutana
from kutana.backends import VkontakteLongpoll
from kutana.loaders import load_plugins_from_path

# Create application
app = Kutana()

# Add manager to application
app.add_backend(VkontakteLongpoll(token="VK-GROUP-TOKEN"))

# Load and register plugins
for plugin in load_plugins_from_path("example/plugins/"):
    app.add_plugin(plugin)

if __name__ == "__main__":
    # Run application
    app.run()
```

## Example plugin (`plugins/echo.py`)

```py
from kutana import Plugin

plugin = Plugin(name="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.

## Available backends

- Vkontakte (for [vk.com](https://vk.com) groups)
- Telegram (for [telegram.org](https://telegram.org) bots)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "kutana",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Michael Kryukov",
    "author_email": "kryukov.ms@ya.ru",
    "download_url": "https://files.pythonhosted.org/packages/b4/4b/6accde4f5bba61aaead1e8b81d0b101d95095946ac6fdc28c1c43444940f/kutana-6.0.1.tar.gz",
    "platform": null,
    "description": "# Kutana\n\n![Kutana logo](./docs/kutana-logo-512.png?raw=true \"Kutana\")\n\n[![PyPI version](https://badge.fury.io/py/kutana.svg)](https://badge.fury.io/py/kutana)\n\nThe library for developing systems for messengers and social networks. Great\nfor developing bots. Refer to [example](https://github.com/ekonda/kutana/tree/master/example)\nfor the showcase of the library abilities.\n\nThis library uses generalized attachment types, possible actions e.t.c. for flexibility\nto use plugins with different backends.\n\n## Installation\n\n```bash\npython -m pip install kutana\n```\n\n## Documentation\n\nYou can read the extended description of the library in\nthe [docs/index.md](example/config.example.yml) file. At the moment,\nthe documentation is not in the best condition. If you would like\nto contribute to its writing, welcome to the issues.\n\n## Running\n\n### From CLI\n\nFollowing command will populate application's config, add specified backends and\nload plugins from specified folder.\n\n```bash\npython3 -m kutana run example/config.yml\n\n# usage: kutana [-h] {init,run} ...\n#\n# helpfull cli utility\n#\n# positional arguments:\n#   {init,run}\n#     init      initiate kutana project\n#     run       run kutana project using provided config (working directory will be changed to the one with config file)\n#\n# optional arguments:\n#   -h, --help  show this help message and exit\n```\n\nRefer to the example [config.yml](example/config.example.yml)\nfor the configuration details.\n\n### From code\n\n```py\nfrom kutana import Kutana\nfrom kutana.backends import VkontakteLongpoll\nfrom kutana.loaders import load_plugins_from_path\n\n# Create application\napp = Kutana()\n\n# Add manager to application\napp.add_backend(VkontakteLongpoll(token=\"VK-GROUP-TOKEN\"))\n\n# Load and register plugins\nfor plugin in load_plugins_from_path(\"example/plugins/\"):\n    app.add_plugin(plugin)\n\nif __name__ == \"__main__\":\n    # Run application\n    app.run()\n```\n\n## Example plugin (`plugins/echo.py`)\n\n```py\nfrom kutana import Plugin\n\nplugin = Plugin(name=\"Echo\")\n\n@plugin.on_commands([\"echo\"])\nasync def _(msg, ctx):\n    await ctx.reply(ctx.body, attachments=msg.attachments)\n```\n\n> If your function exists only to be decorated, you can use `_` to avoid\n> unnecessary names.\n\n## Available backends\n\n- Vkontakte (for [vk.com](https://vk.com) groups)\n- Telegram (for [telegram.org](https://telegram.org) bots)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "The library for developing systems for messengers and social networks",
    "version": "6.0.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5123a4d8d97d118739ffe04b14573c75f2c101521e8cfdcf2ee9c34fed7a312f",
                "md5": "fe2da7d4fe5b6afe88f9b4a3bc2828fa",
                "sha256": "ce734a54ef9f80200468d33a51c2407b43baba86923d1d2d512b6d0a2f4622c7"
            },
            "downloads": -1,
            "filename": "kutana-6.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fe2da7d4fe5b6afe88f9b4a3bc2828fa",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 31808,
            "upload_time": "2024-09-08T14:11:14",
            "upload_time_iso_8601": "2024-09-08T14:11:14.133894Z",
            "url": "https://files.pythonhosted.org/packages/51/23/a4d8d97d118739ffe04b14573c75f2c101521e8cfdcf2ee9c34fed7a312f/kutana-6.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b44b6accde4f5bba61aaead1e8b81d0b101d95095946ac6fdc28c1c43444940f",
                "md5": "3afbe683b7ad31b1f99e6806c6625e06",
                "sha256": "85322124b585c5cfe39a3c2c6c660a367a3d5cb4b6335a3745864eb2d7e38717"
            },
            "downloads": -1,
            "filename": "kutana-6.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3afbe683b7ad31b1f99e6806c6625e06",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 23770,
            "upload_time": "2024-09-08T14:11:15",
            "upload_time_iso_8601": "2024-09-08T14:11:15.628577Z",
            "url": "https://files.pythonhosted.org/packages/b4/4b/6accde4f5bba61aaead1e8b81d0b101d95095946ac6fdc28c1c43444940f/kutana-6.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-08 14:11:15",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "kutana"
}
        
Elapsed time: 1.77104s