diff --git a/bread_bot/common/async_tasks.py b/bread_bot/common/async_tasks.py deleted file mode 100644 index 446060e..0000000 --- a/bread_bot/common/async_tasks.py +++ /dev/null @@ -1,38 +0,0 @@ -import procrastinate - -from bread_bot.common.schemas.bread_bot_answers import TextAnswerSchema -from bread_bot.common.services.messages.message_sender import MessageSender -from bread_bot.common.services.think_service import OpenAIService -from bread_bot.main.procrastinate import app - - -@app.task( - retry=procrastinate.RetryStrategy( - max_attempts=5, - wait=3, - ) -) -async def async_free_promt(text: str, chat_id: int, reply_to_message_id: int): - await MessageSender( - message=TextAnswerSchema( - text=await OpenAIService().free_promt(text), - chat_id=chat_id, - reply_to_message_id=reply_to_message_id, - ) - ).send_messages_to_chat() - - -@app.task( - retry=procrastinate.RetryStrategy( - max_attempts=5, - wait=3, - ) -) -async def async_think_about(pre_promt: str, text: str, chat_id: int, reply_to_message_id: int): - await MessageSender( - message=TextAnswerSchema( - text=await OpenAIService().think_about(pre_promt, text), - chat_id=chat_id, - reply_to_message_id=reply_to_message_id, - ) - ).send_messages_to_chat() diff --git a/bread_bot/common/routes/common.py b/bread_bot/common/routes/common.py index 4202179..45a9ade 100644 --- a/bread_bot/common/routes/common.py +++ b/bread_bot/common/routes/common.py @@ -1,7 +1,7 @@ import logging from typing import List -from fastapi import APIRouter, Depends, HTTPException +from fastapi import APIRouter, Depends, HTTPException, BackgroundTasks from sqlalchemy.ext.asyncio import AsyncSession from starlette import status @@ -24,11 +24,18 @@ RESPONSE_OK = "OK" +async def _handle_message(db, request_body): + message_receiver = MessageReceiver(db=db, request_body=request_body) + message = await message_receiver.receive() + message_sender = MessageSender(message=message) + await message_sender.send_messages_to_chat() + + @router.post("/") -async def handle_message(request_body: StandardBodySchema, db: AsyncSession = Depends(get_async_session)): - await MessageSender( - message=await MessageReceiver(db=db, request_body=request_body).receive() - ).send_messages_to_chat() +async def handle_message( + request_body: StandardBodySchema, background_tasks: BackgroundTasks, db: AsyncSession = Depends(get_async_session) +): + background_tasks.add_task(_handle_message, db, request_body) return RESPONSE_OK diff --git a/bread_bot/common/services/handlers/command_methods/entertainment_command_method.py b/bread_bot/common/services/handlers/command_methods/entertainment_command_method.py index d32277e..940ed1a 100644 --- a/bread_bot/common/services/handlers/command_methods/entertainment_command_method.py +++ b/bread_bot/common/services/handlers/command_methods/entertainment_command_method.py @@ -5,7 +5,6 @@ from sqlalchemy import select, and_ -from bread_bot.common.async_tasks import async_free_promt, async_think_about from bread_bot.common.clients.openai_client import get_chat_gpt_client # noqa from bread_bot.common.exceptions.base import NextStepException, RaiseUpException from bread_bot.common.models import AnswerEntity @@ -188,21 +187,14 @@ async def morph_word(self, debug: bool = False): async def think_about(self): if not self.member_service.chat.is_openai_enabled: raise RaiseUpException("Для данной группы функция недоступна.") - async_think_about.defer( - pre_promt=self.command_instance.raw_command, - text=self.command_instance.rest_text, - chat_id=self.member_service.chat.chat_id, - reply_to_message_id=self.message_service.message.message_id, - ) + things = await OpenAIService().think_about(self.command_instance.raw_command, self.command_instance.rest_text) + return self._return_answer(things) async def free_openai_query(self): if not self.member_service.chat.is_openai_enabled: raise RaiseUpException("Для данной группы функция недоступна.") - async_free_promt.defer( - text=self.command_instance.rest_text, - chat_id=self.member_service.chat.chat_id, - reply_to_message_id=self.message_service.message.message_id, - ) + result = await OpenAIService().free_promt(self.command_instance.rest_text) + return self._return_answer(result) def help(self): if not self.command_instance.rest_text: diff --git a/bread_bot/main/procrastinate.py b/bread_bot/main/procrastinate.py deleted file mode 100644 index 6ffcc0d..0000000 --- a/bread_bot/main/procrastinate.py +++ /dev/null @@ -1,10 +0,0 @@ -from procrastinate import AiopgConnector, App - -from bread_bot.main.settings import DATABASE_SETTINGS - -db_settings = DATABASE_SETTINGS["default"] -app = App( - connector=AiopgConnector(host=db_settings["host"], user=db_settings["user"], password=db_settings["password"]), - import_paths=["bread_bot.common.async_tasks"], -) -app.open() diff --git a/bread_bot/tests/test_common/test_think_feature.py b/bread_bot/tests/test_common/test_think_feature.py index 963caa4..4997e8c 100644 --- a/bread_bot/tests/test_common/test_think_feature.py +++ b/bread_bot/tests/test_common/test_think_feature.py @@ -3,8 +3,8 @@ import pytest from fastapi.testclient import TestClient +from pytest_mock import MockerFixture -from bread_bot.common.async_tasks import async_free_promt, async_think_about from bread_bot.common.schemas.telegram_messages import ( StandardBodySchema, MessageSchema, @@ -35,20 +35,6 @@ def wrap(message_text: str = "") -> StandardBodySchema: return wrap -@pytest.fixture -def think_about_defer(mocker): - return mocker.patch( - "bread_bot.common.services.handlers.command_methods.entertainment_command_method.async_think_about.defer" - ) - - -@pytest.fixture -def free_promt_defer(mocker): - return mocker.patch( - "bread_bot.common.services.handlers.command_methods.entertainment_command_method.async_free_promt.defer" - ) - - async def test_can_handle_message(message_factory): body = message_factory().dict() response = client.post( @@ -66,70 +52,51 @@ async def test_what_you_think_is_available(db, message_factory): message_receiver = MessageReceiver(db=db, request_body=body) message = await message_receiver.receive() + assert message is not None -async def test_chat_gpt_excepted(db, chat_factory, message_factory, think_about_defer): +async def test_chat_gpt_excepted(db, chat_factory, message_factory): message = f"{BOT_NAME} что думаешь про воду" body = message_factory(message) await chat_factory(chat_id=body.message.source.id, name="lol", is_openai_enabled=True) message_receiver = MessageReceiver(db=db, request_body=body) - await message_receiver.receive() - think_about_defer.assert_called_once() + result = await message_receiver.receive() + + assert result.text == "Ошибка работы получения ответа" -async def test_what_you_think(db, chat_factory, message_factory, think_about_defer): +async def test_what_you_think(db, chat_factory, message_factory, mocker: MockerFixture): message = f"{BOT_NAME} что думаешь про воду" body = message_factory(message) await chat_factory(chat_id=body.message.source.id, name="lol", is_openai_enabled=True) message_receiver = MessageReceiver(db=db, request_body=body) - await message_receiver.receive() - think_about_defer.assert_called_once_with( - pre_promt="что думаешь про", text="воду", chat_id=body.message.source.id, reply_to_message_id=1 - ) - -async def test_what_you_think_task(mocker): - spy = AsyncMock(return_value="Нормальный ответ на промт") + spy = AsyncMock(return_value="Вода чертовски хороша!") mocker.patch( "bread_bot.common.services.think_service.get_chat_gpt_client", return_value=MagicMock(get_chatgpt_answer=spy), ) - send_mock = mocker.patch("bread_bot.common.clients.telegram_client.TelegramClient.send") - await async_think_about(pre_promt="что думаешь про", text="LOL", chat_id=1, reply_to_message_id=1) - send_mock.assert_called_once_with( - **{ - "data": {"chat_id": 1, "reply_to_message_id": 1, "text": "Нормальный ответ на промт"}, - "method": "sendMessage", - } + result = await message_receiver.receive() + assert result.text == "Вода чертовски хороша!" + spy.assert_called_once_with( + f"что думаешь про воду. Уложись в три-четыре предложения. Расскажи об этом в " + f"юмористической и саркастической форме." ) -async def test_free_promt(db, chat_factory, message_factory, free_promt_defer): +async def test_free_promt(db, chat_factory, message_factory, mocker: MockerFixture): message = f"{BOT_NAME} promt какой-то несложный промт" body = message_factory(message) await chat_factory(chat_id=body.message.source.id, name="lol", is_openai_enabled=True) message_receiver = MessageReceiver(db=db, request_body=body) - await message_receiver.receive() - free_promt_defer.assert_called_once_with( - text="какой-то несложный промт", - chat_id=body.message.source.id, - reply_to_message_id=1, - ) - -async def test_free_promt_task(mocker): spy = AsyncMock(return_value="Нормальный ответ на промт") mocker.patch( "bread_bot.common.services.think_service.get_chat_gpt_client", return_value=MagicMock(get_chatgpt_answer=spy), ) - send_mock = mocker.patch("bread_bot.common.clients.telegram_client.TelegramClient.send") - await async_free_promt(text="LOL", chat_id=1, reply_to_message_id=1) - send_mock.assert_called_once_with( - **{ - "data": {"chat_id": 1, "reply_to_message_id": 1, "text": "Нормальный ответ на промт"}, - "method": "sendMessage", - } - ) + result = await message_receiver.receive() + assert result.text == "Нормальный ответ на промт" + spy.assert_called_once_with("какой-то несложный промт") diff --git a/ci/docker-compose.yml b/ci/docker-compose.yml index fec7eeb..5507990 100644 --- a/ci/docker-compose.yml +++ b/ci/docker-compose.yml @@ -26,17 +26,6 @@ services: - bread_bot_net depends_on: - postgres - bread_bot_worker: - image: levkey/bread_bot:app - restart: unless-stopped - command: bash -c "procrastinate --app=bread_bot.main.procrastinate.app schema --apply && procrastinate --verbose --app=bread_bot.main.procrastinate.app worker" - env_file: - - /root/environments.env - networks: - - bread_bot_net - depends_on: - - postgres - - bread_bot postgres: image: postgres:13.3 volumes: @@ -52,4 +41,4 @@ networks: bread_bot_net: external: True volumes: - pgdata: \ No newline at end of file + pgdata: \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index 4579294..a14b248 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,9 +1,10 @@ -# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. +# This file is automatically @generated by Poetry and should not be changed by hand. [[package]] name = "aiohttp" version = "3.8.4" description = "Async http client/server framework (asyncio)" +category = "main" optional = false python-versions = ">=3.6" files = [ @@ -108,28 +109,11 @@ yarl = ">=1.0,<2.0" [package.extras] speedups = ["Brotli", "aiodns", "cchardet"] -[[package]] -name = "aiopg" -version = "1.4.0" -description = "Postgres integration with asyncio." -optional = false -python-versions = ">=3.7" -files = [ - {file = "aiopg-1.4.0-py3-none-any.whl", hash = "sha256:aea46e8aff30b039cfa818e6db4752c97656e893fc75e5a5dc57355a9e9dedbd"}, - {file = "aiopg-1.4.0.tar.gz", hash = "sha256:116253bef86b4d954116716d181e9a0294037f266718b2e1c9766af995639d71"}, -] - -[package.dependencies] -async-timeout = ">=3.0,<5.0" -psycopg2-binary = ">=2.9.5" - -[package.extras] -sa = ["sqlalchemy[postgresql-psycopg2binary] (>=1.3,<1.5)"] - [[package]] name = "aiosignal" version = "1.3.1" description = "aiosignal: a list of registered asynchronous callbacks" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -144,6 +128,7 @@ frozenlist = ">=1.1.0" name = "aiosqlite" version = "0.17.0" description = "asyncio bridge to the standard sqlite3 module" +category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -158,6 +143,7 @@ typing_extensions = ">=3.7.2" name = "alembic" version = "1.10.4" description = "A database migration tool for SQLAlchemy." +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -177,6 +163,7 @@ tz = ["python-dateutil"] name = "anyio" version = "3.6.2" description = "High level compatibility layer for multiple asynchronous event loop implementations" +category = "main" optional = false python-versions = ">=3.6.2" files = [ @@ -197,6 +184,7 @@ trio = ["trio (>=0.16,<0.22)"] name = "asgiref" version = "3.6.0" description = "ASGI specs, helper code, and adapters" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -211,6 +199,7 @@ tests = ["mypy (>=0.800)", "pytest", "pytest-asyncio"] name = "async-timeout" version = "4.0.2" description = "Timeout context manager for asyncio programs" +category = "main" optional = false python-versions = ">=3.6" files = [ @@ -222,6 +211,7 @@ files = [ name = "asynclog" version = "0.1.7" description = "Asynchronous log for python logging." +category = "main" optional = false python-versions = "*" files = [ @@ -232,6 +222,7 @@ files = [ name = "asyncpg" version = "0.27.0" description = "An asyncio PostgreSQL driver" +category = "main" optional = false python-versions = ">=3.7.0" files = [ @@ -282,6 +273,7 @@ test = ["flake8 (>=5.0.4,<5.1.0)", "uvloop (>=0.15.3)"] name = "asynctest" version = "0.13.0" description = "Enhance the standard unittest package with features for testing asyncio libraries" +category = "dev" optional = false python-versions = ">=3.5" files = [ @@ -293,6 +285,7 @@ files = [ name = "attrs" version = "23.1.0" description = "Classes Without Boilerplate" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -311,6 +304,7 @@ tests-no-zope = ["cloudpickle", "hypothesis", "mypy (>=1.1.1)", "pympler", "pyte name = "bcrypt" version = "4.0.1" description = "Modern password hashing for your software and your servers" +category = "main" optional = false python-versions = ">=3.6" files = [ @@ -345,6 +339,7 @@ typecheck = ["mypy"] name = "beautifulsoup4" version = "4.12.2" description = "Screen-scraping library" +category = "main" optional = false python-versions = ">=3.6.0" files = [ @@ -363,6 +358,7 @@ lxml = ["lxml"] name = "black" version = "23.3.0" description = "The uncompromising code formatter." +category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -410,6 +406,7 @@ uvloop = ["uvloop (>=0.15.2)"] name = "cachetools" version = "5.3.0" description = "Extensible memoizing collections and decorators" +category = "main" optional = false python-versions = "~=3.7" files = [ @@ -421,6 +418,7 @@ files = [ name = "certifi" version = "2022.12.7" description = "Python package for providing Mozilla's CA Bundle." +category = "main" optional = false python-versions = ">=3.6" files = [ @@ -432,6 +430,7 @@ files = [ name = "cffi" version = "1.15.1" description = "Foreign Function Interface for Python calling C code." +category = "main" optional = false python-versions = "*" files = [ @@ -508,6 +507,7 @@ pycparser = "*" name = "charset-normalizer" version = "3.1.0" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." +category = "main" optional = false python-versions = ">=3.7.0" files = [ @@ -592,6 +592,7 @@ files = [ name = "click" version = "8.1.3" description = "Composable command line interface toolkit" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -606,6 +607,7 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""} name = "colorama" version = "0.4.6" description = "Cross-platform colored terminal text." +category = "main" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" files = [ @@ -617,6 +619,7 @@ files = [ name = "coverage" version = "6.5.0" description = "Code coverage measurement for Python" +category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -675,24 +678,11 @@ files = [ [package.extras] toml = ["tomli"] -[[package]] -name = "croniter" -version = "1.4.1" -description = "croniter provides iteration for datetime object with cron like format" -optional = false -python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -files = [ - {file = "croniter-1.4.1-py2.py3-none-any.whl", hash = "sha256:9595da48af37ea06ec3a9f899738f1b2c1c13da3c38cea606ef7cd03ea421128"}, - {file = "croniter-1.4.1.tar.gz", hash = "sha256:1a6df60eacec3b7a0aa52a8f2ef251ae3dd2a7c7c8b9874e73e791636d55a361"}, -] - -[package.dependencies] -python-dateutil = "*" - [[package]] name = "cryptography" version = "40.0.2" description = "cryptography is a package which provides cryptographic recipes and primitives to Python developers." +category = "main" optional = false python-versions = ">=3.6" files = [ @@ -734,6 +724,7 @@ tox = ["tox"] name = "dawg-python" version = "0.7.2" description = "Pure-python reader for DAWGs (DAFSAs) created by dawgdic C++ library or DAWG Python extension." +category = "main" optional = false python-versions = "*" files = [ @@ -745,6 +736,7 @@ files = [ name = "dnspython" version = "2.3.0" description = "DNS toolkit" +category = "main" optional = false python-versions = ">=3.7,<4.0" files = [ @@ -765,6 +757,7 @@ wmi = ["wmi (>=1.5.1,<2.0.0)"] name = "docopt" version = "0.6.2" description = "Pythonic argument parser, that will make you smile" +category = "main" optional = false python-versions = "*" files = [ @@ -775,6 +768,7 @@ files = [ name = "ecdsa" version = "0.18.0" description = "ECDSA cryptographic signature library (pure python)" +category = "main" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" files = [ @@ -793,6 +787,7 @@ gmpy2 = ["gmpy2"] name = "email-validator" version = "2.0.0.post2" description = "A robust email address syntax and deliverability validation library." +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -808,6 +803,7 @@ idna = ">=2.0.0" name = "fastapi" version = "0.95.1" description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -829,6 +825,7 @@ test = ["anyio[trio] (>=3.2.1,<4.0.0)", "black (==23.1.0)", "coverage[toml] (>=6 name = "flake8" version = "6.0.0" description = "the modular source code checker: pep8 pyflakes and co" +category = "dev" optional = false python-versions = ">=3.8.1" files = [ @@ -845,6 +842,7 @@ pyflakes = ">=3.0.0,<3.1.0" name = "flake8-black" version = "0.3.6" description = "flake8 plugin to call black as a code style validator" +category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -863,6 +861,7 @@ develop = ["build", "twine"] name = "flake8-pyproject" version = "1.2.3" description = "Flake8 plug-in loading the configuration from pyproject.toml" +category = "dev" optional = false python-versions = ">= 3.6" files = [ @@ -879,6 +878,7 @@ dev = ["pyTest", "pyTest-cov"] name = "freezegun" version = "1.2.2" description = "Let your Python tests travel through time" +category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -893,6 +893,7 @@ python-dateutil = ">=2.7" name = "frozenlist" version = "1.3.3" description = "A list-like structure which implements collections.abc.MutableSequence" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -976,6 +977,7 @@ files = [ name = "google-api-core" version = "2.11.0" description = "Google API client core library" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -998,6 +1000,7 @@ grpcio-gcp = ["grpcio-gcp (>=0.2.2,<1.0dev)"] name = "google-auth" version = "2.17.3" description = "Google Authentication Library" +category = "main" optional = false python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*" files = [ @@ -1022,6 +1025,7 @@ requests = ["requests (>=2.20.0,<3.0.0dev)"] name = "googleapis-common-protos" version = "1.59.0" description = "Common protobufs used in Google APIs" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1039,6 +1043,7 @@ grpc = ["grpcio (>=1.44.0,<2.0.0dev)"] name = "greenlet" version = "2.0.2" description = "Lightweight in-process concurrent programming" +category = "main" optional = false python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" files = [ @@ -1112,6 +1117,7 @@ test = ["objgraph", "psutil"] name = "h11" version = "0.14.0" description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1123,6 +1129,7 @@ files = [ name = "httpcore" version = "0.16.3" description = "A minimal low-level HTTP client." +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1134,16 +1141,17 @@ files = [ anyio = ">=3.0,<5.0" certifi = "*" h11 = ">=0.13,<0.15" -sniffio = "==1.*" +sniffio = ">=1.0.0,<2.0.0" [package.extras] http2 = ["h2 (>=3,<5)"] -socks = ["socksio (==1.*)"] +socks = ["socksio (>=1.0.0,<2.0.0)"] [[package]] name = "httptools" version = "0.5.0" description = "A collection of framework independent HTTP protocol utils." +category = "main" optional = false python-versions = ">=3.5.0" files = [ @@ -1197,6 +1205,7 @@ test = ["Cython (>=0.29.24,<0.30.0)"] name = "httpx" version = "0.23.1" description = "The next generation HTTP client." +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1212,14 +1221,15 @@ sniffio = "*" [package.extras] brotli = ["brotli", "brotlicffi"] -cli = ["click (==8.*)", "pygments (==2.*)", "rich (>=10,<13)"] +cli = ["click (>=8.0.0,<9.0.0)", "pygments (>=2.0.0,<3.0.0)", "rich (>=10,<13)"] http2 = ["h2 (>=3,<5)"] -socks = ["socksio (==1.*)"] +socks = ["socksio (>=1.0.0,<2.0.0)"] [[package]] name = "idna" version = "3.4" description = "Internationalized Domain Names in Applications (IDNA)" +category = "main" optional = false python-versions = ">=3.5" files = [ @@ -1231,6 +1241,7 @@ files = [ name = "iniconfig" version = "2.0.0" description = "brain-dead simple config-ini parsing" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1242,6 +1253,7 @@ files = [ name = "mako" version = "1.2.4" description = "A super-fast templating language that borrows the best ideas from the existing templating languages." +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1261,6 +1273,7 @@ testing = ["pytest"] name = "markdown" version = "3.4.3" description = "Python implementation of John Gruber's Markdown." +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1275,6 +1288,7 @@ testing = ["coverage", "pyyaml"] name = "markupsafe" version = "2.1.2" description = "Safely add untrusted strings to HTML/XML markup." +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1334,6 +1348,7 @@ files = [ name = "mccabe" version = "0.7.0" description = "McCabe checker, plugin for flake8" +category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -1345,6 +1360,7 @@ files = [ name = "multidict" version = "6.0.4" description = "multidict implementation" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1428,6 +1444,7 @@ files = [ name = "mypy-extensions" version = "1.0.0" description = "Type system extensions for programs checked with the mypy type checker." +category = "dev" optional = false python-versions = ">=3.5" files = [ @@ -1439,6 +1456,7 @@ files = [ name = "openai" version = "0.27.8" description = "Python client library for the OpenAI API" +category = "main" optional = false python-versions = ">=3.7.1" files = [ @@ -1453,7 +1471,7 @@ tqdm = "*" [package.extras] datalib = ["numpy", "openpyxl (>=3.0.7)", "pandas (>=1.2.3)", "pandas-stubs (>=1.1.0.11)"] -dev = ["black (>=21.6b0,<22.0)", "pytest (==6.*)", "pytest-asyncio", "pytest-mock"] +dev = ["black (>=21.6b0,<22.0)", "pytest (>=6.0.0,<7.0.0)", "pytest-asyncio", "pytest-mock"] embeddings = ["matplotlib", "numpy", "openpyxl (>=3.0.7)", "pandas (>=1.2.3)", "pandas-stubs (>=1.1.0.11)", "plotly", "scikit-learn (>=1.0.2)", "scipy", "tenacity (>=8.0.1)"] wandb = ["numpy", "openpyxl (>=3.0.7)", "pandas (>=1.2.3)", "pandas-stubs (>=1.1.0.11)", "wandb"] @@ -1461,6 +1479,7 @@ wandb = ["numpy", "openpyxl (>=3.0.7)", "pandas (>=1.2.3)", "pandas-stubs (>=1.1 name = "opencensus" version = "0.11.2" description = "A stats collection and distributed tracing framework" +category = "main" optional = false python-versions = "*" files = [ @@ -1476,6 +1495,7 @@ opencensus-context = ">=0.1.3" name = "opencensus-context" version = "0.1.3" description = "OpenCensus Runtime Context" +category = "main" optional = false python-versions = "*" files = [ @@ -1487,6 +1507,7 @@ files = [ name = "opencensus-ext-httplib" version = "0.7.5" description = "OpenCensus httplib Integration" +category = "main" optional = false python-versions = "*" files = [ @@ -1501,6 +1522,7 @@ opencensus = ">=0.8.0,<1.0.0" name = "opencensus-ext-logging" version = "0.1.1" description = "OpenCensus logging Integration" +category = "main" optional = false python-versions = "*" files = [ @@ -1515,6 +1537,7 @@ opencensus = ">=0.8.0,<1.0.0" name = "opencensus-ext-requests" version = "0.8.0" description = "OpenCensus Requests Integration" +category = "main" optional = false python-versions = "*" files = [ @@ -1531,6 +1554,7 @@ wrapt = ">=1.0.0,<2.0.0" name = "packaging" version = "23.1" description = "Core utilities for Python packages" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1542,6 +1566,7 @@ files = [ name = "passlib" version = "1.7.4" description = "comprehensive password hashing framework supporting over 30 schemes" +category = "main" optional = false python-versions = "*" files = [ @@ -1562,6 +1587,7 @@ totp = ["cryptography"] name = "pathspec" version = "0.11.1" description = "Utility library for gitignore style pattern matching of file paths." +category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -1573,6 +1599,7 @@ files = [ name = "platformdirs" version = "3.5.0" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -1588,6 +1615,7 @@ test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest- name = "pluggy" version = "1.0.0" description = "plugin and hook calling mechanisms for python" +category = "main" optional = false python-versions = ">=3.6" files = [ @@ -1599,33 +1627,11 @@ files = [ dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] -[[package]] -name = "procrastinate" -version = "0.27.0" -description = "Postgres-based distributed task processing library" -optional = false -python-versions = ">=3.7,<4.0" -files = [ - {file = "procrastinate-0.27.0-py3-none-any.whl", hash = "sha256:94d3b924ed60648a081c94ae561c6b89c9775117070281fe1a5f97ce08389c26"}, - {file = "procrastinate-0.27.0.tar.gz", hash = "sha256:43a1010773e05b6906630257be570a8b9b9cd9410f631b0d961c8b27693cf62a"}, -] - -[package.dependencies] -aiopg = "*" -attrs = "*" -click = "*" -croniter = "*" -psycopg2-binary = "*" -python-dateutil = "*" - -[package.extras] -django = ["django (>=2.2)"] -sqlalchemy = ["sqlalchemy (>=1.4,<2.0)"] - [[package]] name = "protobuf" version = "4.22.3" description = "" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1648,6 +1654,7 @@ files = [ name = "psycopg2-binary" version = "2.9.6" description = "psycopg2 - Python-PostgreSQL Database Adapter" +category = "main" optional = false python-versions = ">=3.6" files = [ @@ -1719,6 +1726,7 @@ files = [ name = "pyasn1" version = "0.5.0" description = "Pure-Python implementation of ASN.1 types and DER/BER/CER codecs (X.208)" +category = "main" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7" files = [ @@ -1730,6 +1738,7 @@ files = [ name = "pyasn1-modules" version = "0.3.0" description = "A collection of ASN.1-based protocols modules" +category = "main" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7" files = [ @@ -1744,6 +1753,7 @@ pyasn1 = ">=0.4.6,<0.6.0" name = "pycodestyle" version = "2.10.0" description = "Python style guide checker" +category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -1755,6 +1765,7 @@ files = [ name = "pycparser" version = "2.21" description = "C parser in Python" +category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" files = [ @@ -1766,6 +1777,7 @@ files = [ name = "pydantic" version = "1.10.2" description = "Data validation and settings management using python type hints" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1819,6 +1831,7 @@ email = ["email-validator (>=1.0.3)"] name = "pyflakes" version = "3.0.1" description = "passive checker of Python programs" +category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -1830,6 +1843,7 @@ files = [ name = "pymorphy2" version = "0.9.1" description = "Morphological analyzer (POS tagger + inflection engine) for Russian language." +category = "main" optional = false python-versions = "*" files = [] @@ -1853,6 +1867,7 @@ resolved_reference = "6d253dd2198ab2a0a48b914d9dfe4b8b199bd563" name = "pymorphy2-dicts-ru" version = "2.4.417127.4579844" description = "Russian dictionaries for pymorphy2" +category = "main" optional = false python-versions = "*" files = [ @@ -1864,6 +1879,7 @@ files = [ name = "pytest" version = "7.3.1" description = "pytest: simple powerful testing with Python" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1884,6 +1900,7 @@ testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "no name = "pytest-asyncio" version = "0.20.3" description = "Pytest support for asyncio" +category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -1902,6 +1919,7 @@ testing = ["coverage (>=6.2)", "flaky (>=3.5.0)", "hypothesis (>=5.7.1)", "mypy name = "pytest-cov" version = "4.0.0" description = "Pytest plugin for measuring coverage." +category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -1920,6 +1938,7 @@ testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtuale name = "pytest-freezegun" version = "0.4.2" description = "Wrap tests with fixtures in freeze_time" +category = "dev" optional = false python-versions = "*" files = [ @@ -1935,6 +1954,7 @@ pytest = ">=3.0.0" name = "pytest-httpx" version = "0.21.3" description = "Send responses to httpx." +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1943,16 +1963,17 @@ files = [ ] [package.dependencies] -httpx = "==0.23.*" +httpx = ">=0.23.0,<0.24.0" pytest = ">=6.0,<8.0" [package.extras] -testing = ["pytest-asyncio (==0.20.*)", "pytest-cov (==4.*)"] +testing = ["pytest-asyncio (>=0.20.0,<0.21.0)", "pytest-cov (>=4.0.0,<5.0.0)"] [[package]] name = "pytest-mock" version = "3.10.0" description = "Thin-wrapper around the mock package for easier use with pytest" +category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -1970,6 +1991,7 @@ dev = ["pre-commit", "pytest-asyncio", "tox"] name = "python-dateutil" version = "2.8.2" description = "Extensions to the standard Python datetime module" +category = "main" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" files = [ @@ -1984,6 +2006,7 @@ six = ">=1.5" name = "python-dotenv" version = "0.21.1" description = "Read key-value pairs from a .env file and set them as environment variables" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1998,6 +2021,7 @@ cli = ["click (>=5.0)"] name = "python-jose" version = "3.3.0" description = "JOSE implementation in Python" +category = "main" optional = false python-versions = "*" files = [ @@ -2020,6 +2044,7 @@ pycryptodome = ["pyasn1", "pycryptodome (>=3.3.1,<4.0.0)"] name = "python-multipart" version = "0.0.5" description = "A streaming multipart parser for Python" +category = "main" optional = false python-versions = "*" files = [ @@ -2033,6 +2058,7 @@ six = ">=1.4.0" name = "requests" version = "2.29.0" description = "Python HTTP for Humans." +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -2054,6 +2080,7 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] name = "respx" version = "0.20.1" description = "A utility for mocking out the Python HTTPX and HTTP Core libraries." +category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -2068,6 +2095,7 @@ httpx = ">=0.21.0" name = "rfc3986" version = "1.5.0" description = "Validating URI References per RFC 3986" +category = "main" optional = false python-versions = "*" files = [ @@ -2085,6 +2113,7 @@ idna2008 = ["idna"] name = "rsa" version = "4.9" description = "Pure-Python RSA implementation" +category = "main" optional = false python-versions = ">=3.6,<4" files = [ @@ -2099,6 +2128,7 @@ pyasn1 = ">=0.1.3" name = "six" version = "1.16.0" description = "Python 2 and 3 compatibility utilities" +category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" files = [ @@ -2110,6 +2140,7 @@ files = [ name = "sniffio" version = "1.3.0" description = "Sniff out which async library your code is running under" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -2121,6 +2152,7 @@ files = [ name = "soupsieve" version = "2.4.1" description = "A modern CSS selector implementation for Beautiful Soup." +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -2132,6 +2164,7 @@ files = [ name = "sqlalchemy" version = "1.4.48" description = "Database Abstraction Library" +category = "main" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7" files = [ @@ -2179,7 +2212,7 @@ files = [ ] [package.dependencies] -greenlet = {version = "!=0.4.17", markers = "python_version >= \"3\" and (platform_machine == \"win32\" or platform_machine == \"WIN32\" or platform_machine == \"AMD64\" or platform_machine == \"amd64\" or platform_machine == \"x86_64\" or platform_machine == \"ppc64le\" or platform_machine == \"aarch64\")"} +greenlet = {version = "!=0.4.17", markers = "python_version >= \"3\" and (platform_machine == \"aarch64\" or platform_machine == \"ppc64le\" or platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"AMD64\" or platform_machine == \"win32\" or platform_machine == \"WIN32\")"} [package.extras] aiomysql = ["aiomysql", "greenlet (!=0.4.17)"] @@ -2206,6 +2239,7 @@ sqlcipher = ["sqlcipher3-binary"] name = "starlette" version = "0.26.1" description = "The little ASGI library that shines." +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -2223,6 +2257,7 @@ full = ["httpx (>=0.22.0)", "itsdangerous", "jinja2", "python-multipart", "pyyam name = "tqdm" version = "4.65.0" description = "Fast, Extensible Progress Meter" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -2243,6 +2278,7 @@ telegram = ["requests"] name = "typing-extensions" version = "4.5.0" description = "Backported and Experimental Type Hints for Python 3.7+" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -2254,6 +2290,7 @@ files = [ name = "urllib3" version = "1.26.15" description = "HTTP library with thread-safe connection pooling, file post, and more." +category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" files = [ @@ -2270,6 +2307,7 @@ socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] name = "uvicorn" version = "0.22.0" description = "The lightning-fast ASGI server." +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -2288,6 +2326,7 @@ standard = ["colorama (>=0.4)", "httptools (>=0.5.0)", "python-dotenv (>=0.13)", name = "uvloop" version = "0.17.0" description = "Fast implementation of asyncio event loop on top of libuv" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -2332,6 +2371,7 @@ test = ["Cython (>=0.29.32,<0.30.0)", "aiohttp", "flake8 (>=3.9.2,<3.10.0)", "my name = "websockets" version = "10.4" description = "An implementation of the WebSocket Protocol (RFC 6455 & 7692)" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -2410,6 +2450,7 @@ files = [ name = "wrapt" version = "1.15.0" description = "Module for decorators, wrappers and monkey patching." +category = "main" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" files = [ @@ -2494,6 +2535,7 @@ files = [ name = "yarl" version = "1.9.2" description = "Yet another URL library" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -2580,4 +2622,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "6b59952b5ccec40ae264a31cbf61c958f643f1ea43b46b36183d2ed32f3ccba5" +content-hash = "ecdcf6a970fd4e0b8e2c3cd6fb435cb039f57aebce4a12449f86804cf45db0a3" diff --git a/pyproject.toml b/pyproject.toml index b345ac2..2e2c3c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,6 @@ certifi = "2022.12.07" pymorphy2 = { git = "https://github.com/LEVLLN/pymorphy3-11" } pymorphy2-dicts-ru = "^2.4.417127.4579844" openai = "^0.27.8" -procrastinate = "^0.27.0" [tool.poetry.group.dev.dependencies]