A modular, CLI-first Python boilerplate for building Telegram bots. Fast setup, clean architecture, and open-source ready.
Project description
create-tg-bot
๐ This README is also available in ๐ท๐บ Russian
create-tg-bot is a Python CLI tool and boilerplate generator for creating Telegram bots using a modular and extensible architecture. It scaffolds the basic project structure, including handlers, keyboards, models, and services, and includes a manage.py interface for generating new components.
๐ง Features
- Modular project layout
- Jinja2 templating for generating project files
- Built-in generator for models, keyboards, and command handlers
manage.pyCLI powered by Click- Templates for CRUD, keyboards, and message formatting
- Support for future integration of async ORM, logging, i18n
๐ฆ Installation
pip install create-tg-bot
๐ Quick Start
- Install the package:
pip install create-tg-bot
- Generate a new bot project:
create-tg-bot my_bot
cd my_bot
- Use CLI to generate components:
python manage.py gen-model user
python manage.py gen-keyboard main
python manage.py gen-command start
๐ Project Structure
project/
โโโ .env # Environment variables for local development
โโโ alembic.ini # Alembic configuration file for DB migrations
โโโ config.py # Global configuration settings (token, DB URL, etc.)
โโโ main.py # Entry point to start the bot
โโโ models/ # SQLAlchemy models for database schema
โโโ services/ # Business logic and service layer
โโโ crud/ # Functions for Create, Read, Update, Delete operations
โโโ migrations/ # Alembic migration scripts for database versioning
โโโ templates/ # Jinja2 templates for code generation
โโโ requirements.txt # Python dependencies
โโโ commands/ # Message handlers for bot commands (e.g. /start, /help)
โโโ keyboards/ # Inline and reply keyboard definitions
โโโ button_handlers/ # Callback query handlers for inline buttons
โโโ texts/ # Static texts and formatting functions
โโโ utils/ # General-purpose helper functions
โโโ manage.py # CLI entry point to generate code via Click commands
โโโ .github/workflows/ # CI/CD pipeline definitions (e.g., GitHub Actions)
๐งช Development Notes
- Uses
setuptools_scmfor automatic versioning - Templates live in
create_tg_bot/templates - CLI interface powered by
Click
๐ License
This project is licensed under the MIT License.
๐ค Author
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file create_tg_bot-0.1.4.tar.gz.
File metadata
- Download URL: create_tg_bot-0.1.4.tar.gz
- Upload date:
- Size: 25.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd5ce391cc7a2f7f0ac10545d637518bbffd3f1ce69e242ae4a399108e347925
|
|
| MD5 |
6902ee6684b3916904b4523bc5c0b6ef
|
|
| BLAKE2b-256 |
f5c6934c280016115c394765a47192818e8d3a4f0246dcfc84c88ab39b64d517
|
File details
Details for the file create_tg_bot-0.1.4-py3-none-any.whl.
File metadata
- Download URL: create_tg_bot-0.1.4-py3-none-any.whl
- Upload date:
- Size: 35.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0fb469051a46da39253e3237e39f0443405503f2073a4cd35d43998a2d05684
|
|
| MD5 |
76d9ddc071732593cf8a9a41972ae527
|
|
| BLAKE2b-256 |
521c044f25cd16c338ac34eb2fb69ce7721f648593f2b4fd5b80bea8a08cb44a
|