diff --git a/Makefile b/Makefile index d0993faf..87d10075 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ .DEFAULT_GOAL := help -python := python3.7 +base_python := python3.7 +py := poetry run +python := $(py) python .PHONY: help help: @@ -32,7 +34,7 @@ help: .PHONY: install install: - $(python) -m pip install --user -U poetry + $(base_python) -m pip install --user -U poetry poetry install .PHONY: clean @@ -53,19 +55,19 @@ clean: .PHONY: isort isort: - poetry run isort -rc aiogram tests + $(py) isort -rc aiogram tests .PHONY: black black: - poetry run black aiogram tests + $(py) black aiogram tests .PHONY: flake8 flake8: - poetry run flake8 aiogram tests + $(py) flake8 aiogram tests .PHONY: mypy mypy: - poetry run mypy aiogram tests + $(py) mypy aiogram tests .PHONY: lint lint: isort black flake8 mypy @@ -77,7 +79,7 @@ lint: isort black flake8 mypy .PHONY: test test: - poetry run pytest --cov=aiogram --cov-config .coveragerc tests/ -sq + $(py) pytest --cov=aiogram --cov-config .coveragerc tests/ -sq # ================================================================================================= @@ -86,8 +88,8 @@ test: .PHONY: docs docs: - mkdocs build + $(py) mkdocs build .PHONY: docs-serve docs-serve: - mkdocs serve + $(py) mkdocs serve diff --git a/aiogram/__init__.py b/aiogram/__init__.py index cc8c9a9b..3cde7dd5 100644 --- a/aiogram/__init__.py +++ b/aiogram/__init__.py @@ -1,4 +1,5 @@ -from .api import methods, session, types +from .api import methods, types +from .api.client import session from .api.client.bot import Bot __all__ = ["__api_version__", "__version__", "types", "methods", "Bot", "session"] diff --git a/aiogram/api/client/base.py b/aiogram/api/client/base.py index 7c3ecab5..2f5ebcda 100644 --- a/aiogram/api/client/base.py +++ b/aiogram/api/client/base.py @@ -2,8 +2,8 @@ from typing import TypeVar from ...utils.mixins import ContextInstanceMixin from ..methods import TelegramMethod -from ..session.aiohttp import AiohttpSession -from ..session.base import BaseSession +from aiogram.api.client.session.aiohttp import AiohttpSession +from aiogram.api.client.session.base import BaseSession T = TypeVar("T") diff --git a/aiogram/api/session/__init__.py b/aiogram/api/client/session/__init__.py similarity index 100% rename from aiogram/api/session/__init__.py rename to aiogram/api/client/session/__init__.py diff --git a/aiogram/api/session/aiohttp.py b/aiogram/api/client/session/aiohttp.py similarity index 97% rename from aiogram/api/session/aiohttp.py rename to aiogram/api/client/session/aiohttp.py index 8b539ded..33da0c3f 100644 --- a/aiogram/api/session/aiohttp.py +++ b/aiogram/api/client/session/aiohttp.py @@ -2,7 +2,7 @@ from typing import Callable, Optional, TypeVar, cast from aiohttp import ClientSession, FormData -from ..methods import Request, TelegramMethod +from aiogram.api.methods import Request, TelegramMethod from .base import PRODUCTION, BaseSession, TelegramAPIServer T = TypeVar("T") diff --git a/aiogram/api/session/base.py b/aiogram/api/client/session/base.py similarity index 100% rename from aiogram/api/session/base.py rename to aiogram/api/client/session/base.py diff --git a/tests/test_api/test_session/__init__.py b/tests/__init__.py similarity index 100% rename from tests/test_api/test_session/__init__.py rename to tests/__init__.py diff --git a/tests/test_api/test_client/test_session/__init__.py b/tests/test_api/test_client/test_session/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/test_api/test_session/test_api_server.py b/tests/test_api/test_client/test_session/test_api_server.py similarity index 87% rename from tests/test_api/test_session/test_api_server.py rename to tests/test_api/test_client/test_session/test_api_server.py index 2ff6fc26..e48f2684 100644 --- a/tests/test_api/test_session/test_api_server.py +++ b/tests/test_api/test_client/test_session/test_api_server.py @@ -1,4 +1,4 @@ -from aiogram.api.session.base import PRODUCTION +from aiogram.api.client.session.base import PRODUCTION class TestAPIServer: diff --git a/tests/test_api/test_session/test_base_session.py b/tests/test_api/test_client/test_session/test_base_session.py similarity index 98% rename from tests/test_api/test_session/test_base_session.py rename to tests/test_api/test_client/test_session/test_base_session.py index 2d345059..a74a440b 100644 --- a/tests/test_api/test_session/test_base_session.py +++ b/tests/test_api/test_client/test_session/test_base_session.py @@ -4,7 +4,7 @@ from unittest.mock import patch import pytest from asynctest import CoroutineMock -from aiogram.api.session.base import BaseSession +from aiogram.api.client.session.base import BaseSession from aiogram.utils.mixins import DataMixin