# telebot-components
Framework / toolkit for building bots with [telebot](https://github.com/bots-against-war/telebot).
## Development
### Setup
1. Clone repository
```bash
git clone git@github.com:bots-against-war/telebot-components.git baw
cd ./baw
```
2. The project requires Poerty 1.5.1 (see [installation instruction](https://python-poetry.org/docs/master#installing-with-the-official-installer)).
For example, to install `1.5.1` on Unix, run
```bash
curl -sSL https://install.python-poetry.org | python3 - --version 1.5.1
```
3. Then, to install the library with all dependencies, run from project root
```bash
poetry install
```
- You might need to manually install dynamic versioning plugin (without it local build will
always have version `0.0.0`):
```bash
poetry self add poetry-dynamic-versioning-plugin
```
- To create virtualenv inside the project’s root directory, use command
```bash
poetry config virtualenvs.in-project false --local
```
4. Run `pre-commit` to set up git hook scripts
```bash
pre-commit install
```
### Testing
Use command below for run tests
```bash
poetry run pytest tests -vv
```
To also generate test coverage report
```bash
poetry run coverage run -m pytest tests -vv && poetry run coverage report
```
By default, all tests are run with in-memory Redis emulation. But if you want you can run them
locally on real Redis by specifying `REDIS_URL` environment variable before running `pytest`.
> **Note**: Tests must be able to find an empty Redis DB to use; they also clean up after themselves.
### Start example bot
For first start you need to do 3 things:
1. Use command below to generate environment variables file:
```bash
cp ./examples/example.env ./examples/.env
```
> **Note**: After `.env` file is generated you will need to add your [bot's token](https://core.telegram.org/bots#6-botfather) to it.
> Also for bot with `trello integration` you need to add `trello` token and api key. You can get it [here](https://trello.com/app-key).
2. If you want start redis on local machine, run
```bash
docker run --name baw-redis -d -p 6379:6379 redis redis-server --save 60 1 --loglevel warning
```
3. Run any bot from `./examples`
```bash
python3 ./examples/feedback_bot.py // or run with IDE from bot file
```
Raw data
{
"_id": null,
"home_page": "https://github.com/bots-against-war/telebot-components",
"name": "telebot-components",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": null,
"author": "Igor Vaiman",
"author_email": "gosha.vaiman@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/5b/dd/430bb6fbcb87474e90253f6d502a27dad9c5954ccf2dafd473c40cdb7b7f/telebot_components-0.12.13.tar.gz",
"platform": null,
"description": "# telebot-components\n\nFramework / toolkit for building bots with [telebot](https://github.com/bots-against-war/telebot).\n\n## Development\n\n### Setup\n\n1. Clone repository\n ```bash\n git clone git@github.com:bots-against-war/telebot-components.git baw\n cd ./baw\n ```\n\n2. The project requires Poerty 1.5.1 (see [installation instruction](https://python-poetry.org/docs/master#installing-with-the-official-installer)).\n For example, to install `1.5.1` on Unix, run\n ```bash\n curl -sSL https://install.python-poetry.org | python3 - --version 1.5.1\n ```\n\n3. Then, to install the library with all dependencies, run from project root\n ```bash\n poetry install\n ```\n - You might need to manually install dynamic versioning plugin (without it local build will\n always have version `0.0.0`):\n ```bash\n poetry self add poetry-dynamic-versioning-plugin\n ```\n - To create virtualenv inside the project\u2019s root directory, use command\n ```bash\n poetry config virtualenvs.in-project false --local\n ```\n4. Run `pre-commit` to set up git hook scripts\n ```bash\n pre-commit install\n ```\n\n\n### Testing\nUse command below for run tests\n```bash\npoetry run pytest tests -vv\n```\n\nTo also generate test coverage report\n\n```bash\npoetry run coverage run -m pytest tests -vv && poetry run coverage report\n```\n\nBy default, all tests are run with in-memory Redis emulation. But if you want you can run them\nlocally on real Redis by specifying `REDIS_URL` environment variable before running `pytest`.\n\n> **Note**: Tests must be able to find an empty Redis DB to use; they also clean up after themselves.\n\n### Start example bot\nFor first start you need to do 3 things:\n1. Use command below to generate environment variables file:\n ```bash\n cp ./examples/example.env ./examples/.env\n ```\n > **Note**: After `.env` file is generated you will need to add your [bot's token](https://core.telegram.org/bots#6-botfather) to it. \n > Also for bot with `trello integration` you need to add `trello` token and api key. You can get it [here](https://trello.com/app-key).\n2. If you want start redis on local machine, run\n ```bash\n docker run --name baw-redis -d -p 6379:6379 redis redis-server --save 60 1 --loglevel warning\n ```\n3. Run any bot from `./examples`\n ```bash\n python3 ./examples/feedback_bot.py // or run with IDE from bot file\n ```\n\n",
"bugtrack_url": null,
"license": "GPLv3",
"summary": "Framework/toolkit for building Telegram bots with telebot and redis",
"version": "0.12.13",
"project_urls": {
"Homepage": "https://github.com/bots-against-war/telebot-components",
"Repository": "https://github.com/bots-against-war/telebot-components"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "eeaf4ffa7d393da97efd6925f58912e624ea813abfb0f9c81ba83de85cee4d50",
"md5": "1dd3ef144f6be30e6ab1fd439138b7d4",
"sha256": "f0fa4593382a924f67a3ecf6df4652f3b55625e48018a9a82daa96721f0f059d"
},
"downloads": -1,
"filename": "telebot_components-0.12.13-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1dd3ef144f6be30e6ab1fd439138b7d4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 190830,
"upload_time": "2025-02-23T20:06:55",
"upload_time_iso_8601": "2025-02-23T20:06:55.610610Z",
"url": "https://files.pythonhosted.org/packages/ee/af/4ffa7d393da97efd6925f58912e624ea813abfb0f9c81ba83de85cee4d50/telebot_components-0.12.13-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "5bdd430bb6fbcb87474e90253f6d502a27dad9c5954ccf2dafd473c40cdb7b7f",
"md5": "89510bced9f9356af78dd38b6388a7be",
"sha256": "ff3cb9a1abe1255a7672a5388f1a77eefe9505887f746d7ccdad22aca4b9a80c"
},
"downloads": -1,
"filename": "telebot_components-0.12.13.tar.gz",
"has_sig": false,
"md5_digest": "89510bced9f9356af78dd38b6388a7be",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 173952,
"upload_time": "2025-02-23T20:06:57",
"upload_time_iso_8601": "2025-02-23T20:06:57.530504Z",
"url": "https://files.pythonhosted.org/packages/5b/dd/430bb6fbcb87474e90253f6d502a27dad9c5954ccf2dafd473c40cdb7b7f/telebot_components-0.12.13.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-23 20:06:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bots-against-war",
"github_project": "telebot-components",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "telebot-components"
}