build: migrate dependency management to uv

This commit is contained in:
Azimkin
2026-09-14 13:27:35 +02:00
parent 4421c9cd31
commit 3f0cce6732
8 changed files with 1157 additions and 14 deletions

View File

@@ -5,8 +5,8 @@ Repository guidance for automated coding tools and contributors.
## Running the bot
```bash
pip install -r requirements.txt
python main.py
uv sync
uv run python main.py
```
Logs go to `bot.log` by default (rotating, 10 MB, 3 backups). Override with `LOG_FILE=<path>`.
@@ -14,7 +14,7 @@ Logs go to `bot.log` by default (rotating, 10 MB, 3 backups). Override with `LOG
Run the test suite with:
```bash
python -m unittest discover -s tests -v
uv run python -m unittest discover -s tests -v
```
## Configuration
@@ -36,6 +36,8 @@ AI prompt templates are always loaded from `prompts/MASTER.txt` and `prompts/USE
### Boot path
`main.py` → `load_app_config()` → `AccountManager` → one Pyrogram (`kurigram`) `Client` per account → `register_common_handlers()` → `pyrogram.idle()`.
On supported platforms, `main.py` runs the application with `uvloop`; Windows automatically falls back to the standard `asyncio` event loop.
### Command system (`app/commands/`)
- **Dispatcher** (`dispatcher.py`): parses `.command` (owner prefix) or `..command` (shared/guest prefix) from message text, resolves to a `CommandDefinition`, runs pre-checks, calls handler.
@@ -85,6 +87,7 @@ Shared commands use `..mycommand` for guests and `.mycommand` for the owner. Own
## Change guidelines
- Preserve unrelated local and untracked changes.
- Manage dependencies through `pyproject.toml` and `uv.lock`; use `uv sync` instead of `pip install`.
- Register commands through `command_registry`; do not add separate Pyrogram handlers for individual commands.
- Keep shared commands behind `shared_access_check()` and persist ACL changes through `RuntimeAclStore`.
- Add or update focused `unittest` coverage for behavioral changes.