# 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/7d/05/a9883d300a7eb1bddb2a1b3b559e8aca15d6a924d27d87866dfcfbcd3449/telebot_components-0.12.0.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.0",
"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": "",
"digests": {
"blake2b_256": "15d32df311d1ba98d5ad4619937b212cf3da1af3f5fd03268ddb1aa0dc2b0e20",
"md5": "7865e24e4163a3f10c1cc0cc66fdbf8e",
"sha256": "9f5bf55beae681db77aec6138e7d47dc7a06f40912b9585f8855f04170419eed"
},
"downloads": -1,
"filename": "telebot_components-0.12.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7865e24e4163a3f10c1cc0cc66fdbf8e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 189335,
"upload_time": "2024-05-02T14:54:41",
"upload_time_iso_8601": "2024-05-02T14:54:41.188540Z",
"url": "https://files.pythonhosted.org/packages/15/d3/2df311d1ba98d5ad4619937b212cf3da1af3f5fd03268ddb1aa0dc2b0e20/telebot_components-0.12.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7d05a9883d300a7eb1bddb2a1b3b559e8aca15d6a924d27d87866dfcfbcd3449",
"md5": "921fa613c5546a5b490b6826018c81c4",
"sha256": "8eea51ab40154df2099f830e7eb6fba2c0de709b9f5fb1bb8b9b95bd5bf7f341"
},
"downloads": -1,
"filename": "telebot_components-0.12.0.tar.gz",
"has_sig": false,
"md5_digest": "921fa613c5546a5b490b6826018c81c4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 172422,
"upload_time": "2024-05-02T14:54:43",
"upload_time_iso_8601": "2024-05-02T14:54:43.535591Z",
"url": "https://files.pythonhosted.org/packages/7d/05/a9883d300a7eb1bddb2a1b3b559e8aca15d6a924d27d87866dfcfbcd3449/telebot_components-0.12.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-02 14:54:43",
"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"
}