This repository was archived by the owner on Dec 27, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Separate "build" image
2- FROM python:3.11-slim-bookworm as compile-image
3- RUN python -m venv /opt/venv
4- ENV PATH="/opt/venv/bin:$PATH"
2+ FROM python:3.11-slim as builder
3+ WORKDIR /app
54COPY requirements.txt .
6- RUN pip install --no-cache-dir --upgrade pip \
7- && pip install --no-cache-dir -r requirements.txt
5+ RUN pip install --no-cache-dir -r requirements.txt
6+ COPY bot /app/bot
87
9- # "Run" image
10- FROM gcr.io/distroless/python3
8+ # Final stage
9+ FROM gcr.io/distroless/python3-debian12:nonroot
10+ COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
11+ COPY --from=builder /app /app
1112WORKDIR /app
12- COPY --from=compile-image /opt/venv /app/venv
13- ENV PYTHONPATH="/app/venv/lib/python3.11/site-packages"
14- COPY bot /app/bot
13+ ENV PYTHONPATH=/usr/local/lib/python3.11/site-packages
1514CMD ["-m" , "bot" ]
Original file line number Diff line number Diff line change 11MIT License
22
3- Copyright (c) 2019-2024 Groosha (also known as MasterGroosha on GitHub)
3+ Copyright (c) 2019-present Aleksandr K. (also known as MasterGroosha on GitHub)
44
55Permission is hereby granted, free of charge, to any person obtaining a copy
66of this software and associated documentation files (the "Software"), to deal
Original file line number Diff line number Diff line change @@ -21,13 +21,13 @@ async def main():
2121 structlog .configure (** get_structlog_config (log_config ))
2222
2323 bot = Bot (
24- bot_config .bot_token .get_secret_value (),
24+ token = bot_config .bot_token .get_secret_value (),
2525 default = DefaultBotProperties (
2626 parse_mode = ParseMode .HTML ,
2727 )
2828 )
2929
30- # Setup dispatcher and bind routers to it
30+ # Setup dispatcher
3131 dp = Dispatcher ()
3232
3333 dispenser = FluentDispenser (
@@ -52,9 +52,13 @@ async def main():
5252 await set_bot_commands (bot , dispenser )
5353
5454 # Run bot
55- await logger .awarning ("Starting bot" )
55+ await logger .awarning (
56+ "Important! This version is the last one to use environment variables for configuration. "
57+ "The next version is going to use TOML file. Be careful when upgrading bot version in the future."
58+ )
59+ await logger .ainfo ("Starting bot" )
5660 await dp .start_polling (bot , allowed_updates = dp .resolve_used_update_types ())
57- await logger .awarning ("Bot stopped" )
61+ await logger .ainfo ("Bot stopped" )
5862
5963
6064if __name__ == "__main__" :
Original file line number Diff line number Diff line change 1- from enum import StrEnum , auto
1+ from enum import Enum
22
33from pydantic import SecretStr
44from pydantic_settings import BaseSettings , SettingsConfigDict
55
66
7- class LoggingRenderer (StrEnum ):
8- JSON = auto ()
9- CONSOLE = auto ()
7+ class LoggingRenderer (str , Enum ):
8+ JSON = "json"
9+ CONSOLE = "console"
1010
1111
1212class LoggingSettings (BaseSettings ):
@@ -18,7 +18,7 @@ class LoggingSettings(BaseSettings):
1818
1919 model_config = SettingsConfigDict (
2020 env_file = ".env" ,
21- env_file_encoding = "UTF -8" ,
21+ env_file_encoding = "utf -8" ,
2222 env_prefix = "LOGGING_" ,
2323 extra = "allow" ,
2424 )
@@ -29,7 +29,7 @@ class BotSettings(BaseSettings):
2929
3030 model_config = SettingsConfigDict (
3131 env_file = ".env" ,
32- env_file_encoding = "UTF -8" ,
32+ env_file_encoding = "utf -8" ,
3333 extra = "allow" ,
3434 )
3535
Original file line number Diff line number Diff line change 11# This file was autogenerated by uv via the following command:
2- # uv pip compile requirements.in -o requirements.txt
3- aiofiles == 23.2.1
2+ # uv pip compile -o requirements.txt requirements.in
3+ aiofiles == 24.1.0
44 # via aiogram
5- aiogram == 3.12 .0
5+ aiogram == 3.18 .0
66 # via -r requirements.in
7- aiohappyeyeballs == 2.3.5
7+ aiohappyeyeballs == 2.4.6
88 # via aiohttp
9- aiohttp == 3.10.3
9+ aiohttp == 3.11.13
1010 # via aiogram
11- aiosignal == 1.3.1
11+ aiosignal == 1.3.2
1212 # via aiohttp
1313annotated-types == 0.7.0
1414 # via pydantic
15- attrs == 24.2 .0
15+ attrs == 25.1 .0
1616 # via
1717 # aiohttp
1818 # fluent-runtime
19- babel == 2.16 .0
19+ babel == 2.17 .0
2020 # via fluent-runtime
21- cachetools == 5.4.0
21+ cachetools == 5.5.2
2222 # via -r requirements.in
23- certifi == 2024.7.4
23+ certifi == 2025.1.31
2424 # via aiogram
2525fluent-runtime == 0.4.0
2626 # via -r requirements.in
2727fluent-syntax == 0.19.0
2828 # via fluent-runtime
29- frozenlist == 1.4.1
29+ frozenlist == 1.5.0
3030 # via
3131 # aiohttp
3232 # aiosignal
33- idna == 3.7
33+ idna == 3.10
3434 # via yarl
3535magic-filter == 1.0.12
3636 # via aiogram
37- multidict == 6.0.5
37+ multidict == 6.1.0
3838 # via
3939 # aiohttp
4040 # yarl
41- pydantic == 2.8.2
41+ propcache == 0.3.0
42+ # via
43+ # aiohttp
44+ # yarl
45+ pydantic == 2.10.6
4246 # via
4347 # aiogram
4448 # pydantic-settings
45- pydantic-core == 2.20.1
49+ pydantic-core == 2.27.2
4650 # via pydantic
4751pydantic-settings == 2.4.0
4852 # via -r requirements.in
4953python-dotenv == 1.0.1
5054 # via pydantic-settings
51- pytz == 2024 .1
55+ pytz == 2025 .1
5256 # via fluent-runtime
53- structlog == 24.4 .0
57+ structlog == 25.1 .0
5458 # via -r requirements.in
5559typing-extensions == 4.12.2
5660 # via
@@ -59,5 +63,5 @@ typing-extensions==4.12.2
5963 # fluent-syntax
6064 # pydantic
6165 # pydantic-core
62- yarl == 1.9.4
66+ yarl == 1.18.3
6367 # via aiohttp
You can’t perform that action at this time.
0 commit comments