diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml new file mode 100644 index 0000000..75dc876 --- /dev/null +++ b/.github/workflows/actions.yml @@ -0,0 +1,67 @@ +name: Python application +on: push +jobs: + + test: + name: Test + runs-on: ubuntu-20.04 + + services: + redis: + image: redis:6 + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 6379:6379 + postgres: + image: postgres:12 + env: + POSTGRES_PASSWORD: postgres + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + + steps: + - name: Setup + uses: ExpressApp/github-actions-poetry@v0.1 + with: + python-version: "3.9.6" + poetry-version: "1.1.6" + + - name: Run tests + run: | + source .venv/bin/activate + ./scripts/test --cov-report=xml + env: + REDIS_DSN: redis://localhost/0 + POSTGRES_DSN: postgresql://postgres:postgres@localhost/postgres + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v2 + with: + fail_ci_if_error: false + files: ./coverage.xml + flags: unittests + + lint: + name: Lint + runs-on: ubuntu-20.04 + + steps: + - name: Setup + uses: ExpressApp/github-actions-poetry@v0.1 + with: + python-version: "3.9.6" + poetry-version: "1.1.6" + + - name: Run lint + run: | + source .venv/bin/activate + ./scripts/lint diff --git a/.gitignore b/.gitignore index 47ac262..9c8937a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,4 @@ dist/ .pytest_cache/ .mypy_cache/ .idea/ - +coverage.xml diff --git a/README.md b/README.md index 5c35bc3..5bb14aa 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Boxv2 +# Asyncbox Framework ## Установка @@ -6,19 +6,19 @@ Склонировать репозиторий с исходниками ```bash - git clone https://github.com/ExpressApp/boxv2.git + git clone https://github.com/ExpressApp/asyncbox-framework.git ``` Собрать пакет и установить его ```bash - cd boxv2 + cd asyncbox-framework poetry build - pip install --user dist/boxv2-0.4.0-py3-none-any.whl + pip install --user dist/asyncbox-0.4.0-py3-none-any.whl ``` 2. Создание проекта из шаблона ```bash - boxv2 -v -t http://path/to/template -p plugin1 -p plugin2 bot_project_name + asyncbox -v -t http://path/to/template -p plugin1 -p plugin2 bot_project_name cd bot_project_name ``` @@ -27,11 +27,11 @@ ```bash poetry install ``` - Важно: библиотека boxv2 в созданном проекте будет установлена той версии, которя + Важно: библиотека asyncbox в созданном проекте будет установлена той версии, которя указана в шаблоне файла pyproject.toml. При необходимости вы можете указать нужную версию или ветку репозитория следующим образом: ``` - boxv2 = { git = "https://github.com/ExpressApp/boxv2.git", branch = "master"} + asyncbox = { git = "https://github.com/ExpressApp/asyncbox.git", branch = "master"} ``` 4. Обновление @@ -59,11 +59,11 @@ | Путь | Описание -----------------------------------|:----------------------------------- - | boxv2.plugins.logger | расширенное логирование (Loguru) - | boxv2.plugins.tortoise | БД (PostgreSQL) - | boxv2.plugins.redis | Redis - | boxv2.plugins.sentry | мониторинг ошибок (Sentry) - | boxv2.plugins.prometheus | сбор метрик (Prometheus) + | asyncbox.plugins.logger | расширенное логирование (Loguru) + | asyncbox.plugins.sqlalchemy | БД (PostgreSQL) + | asyncbox.plugins.redis | Redis + | asyncbox.plugins.sentry | мониторинг ошибок (Sentry) + | asyncbox.plugins.prometheus | сбор метрик (Prometheus) Каждый из плагинов может требовать наличия определённых настроек. В этом случае необходимо добавить соответствующую настройку в класс AppSettings diff --git a/asyncbox/__init__.py b/asyncbox/__init__.py new file mode 100644 index 0000000..1fe4691 --- /dev/null +++ b/asyncbox/__init__.py @@ -0,0 +1,3 @@ +from asyncbox.application import get_application + +__all__ = ["get_application"] diff --git a/boxv2/__main__.py b/asyncbox/__main__.py similarity index 61% rename from boxv2/__main__.py rename to asyncbox/__main__.py index 7ad8ab3..e998694 100644 --- a/boxv2/__main__.py +++ b/asyncbox/__main__.py @@ -1,4 +1,4 @@ """Module as an executable magic file.""" -from boxv2.main import main +from asyncbox.main import main main() diff --git a/boxv2/application.py b/asyncbox/application.py similarity index 92% rename from boxv2/application.py rename to asyncbox/application.py index 461486d..2183f4d 100644 --- a/boxv2/application.py +++ b/asyncbox/application.py @@ -7,10 +7,10 @@ from botx import Bot, Collector from fastapi import FastAPI -from boxv2.endpoints import get_router -from boxv2.plugin import get_plugin_by_path -from boxv2.settings import BaseAppSettings -from boxv2.utils.import_utils import import_object +from asyncbox.endpoints import get_router +from asyncbox.plugin import get_plugin_by_path +from asyncbox.settings import BaseAppSettings +from asyncbox.utils.import_utils import import_object def get_application(settings: Optional[BaseAppSettings] = None) -> FastAPI: diff --git a/boxv2/dependencies/__init__.py b/asyncbox/dependencies/__init__.py similarity index 100% rename from boxv2/dependencies/__init__.py rename to asyncbox/dependencies/__init__.py diff --git a/boxv2/dependencies/status_recipient.py b/asyncbox/dependencies/status_recipient.py similarity index 100% rename from boxv2/dependencies/status_recipient.py rename to asyncbox/dependencies/status_recipient.py diff --git a/boxv2/endpoints.py b/asyncbox/endpoints.py similarity index 92% rename from boxv2/endpoints.py rename to asyncbox/endpoints.py index b1ecc3a..57d6374 100644 --- a/boxv2/endpoints.py +++ b/asyncbox/endpoints.py @@ -5,7 +5,7 @@ from fastapi import APIRouter, Depends from starlette.status import HTTP_202_ACCEPTED -from boxv2.dependencies.status_recipient import get_status_recipient +from asyncbox.dependencies.status_recipient import get_status_recipient def get_router(bot: Bot) -> APIRouter: diff --git a/boxv2/main.py b/asyncbox/main.py similarity index 96% rename from boxv2/main.py rename to asyncbox/main.py index fb07466..365cbb1 100644 --- a/boxv2/main.py +++ b/asyncbox/main.py @@ -11,7 +11,7 @@ from cookiecutter.main import cookiecutter # type: ignore from loguru import logger -from boxv2.plugin import get_plugin_by_path +from asyncbox.plugin import get_plugin_by_path @click.command() @@ -43,7 +43,7 @@ def render_plugins_template(plugin: str, extra_content: dict[str, Any]) -> None: temp_dir = Path(mkdtemp()) try: - plugin_class = get_plugin_by_path(f"boxv2.plugins.{plugin}") + plugin_class = get_plugin_by_path(f"asyncbox.plugins.{plugin}") except ImportError: logger.warning(f"Plugin `{plugin}` not found.") return diff --git a/boxv2/plugin.py b/asyncbox/plugin.py similarity index 93% rename from boxv2/plugin.py rename to asyncbox/plugin.py index 44463f3..debf96c 100644 --- a/boxv2/plugin.py +++ b/asyncbox/plugin.py @@ -9,7 +9,7 @@ from fastapi import FastAPI from pydantic import BaseModel, BaseSettings -from boxv2.utils.import_utils import import_object +from asyncbox.utils.import_utils import import_object class BasePluginSettings(BaseSettings): @@ -64,10 +64,9 @@ def get_name(cls) -> str: """Get plugin's lowercase name.""" module = inspect.getmodule(cls) if module is not None: - # - # boxv2.plugins.sqlalchemy.plugin.SQLAlchemyPlugin - # ^ - # this part is using as name + # asyncbox.plugins.sqlalchemy.plugin.SQLAlchemyPlugin + # ^ + # this part is using as name return module.__name__.split(".")[-2] return cls.__name__.lower() diff --git a/boxv2/plugins/__init__.py b/asyncbox/plugins/__init__.py similarity index 100% rename from boxv2/plugins/__init__.py rename to asyncbox/plugins/__init__.py diff --git a/boxv2/plugins/debug/__init__.py b/asyncbox/plugins/debug/__init__.py similarity index 100% rename from boxv2/plugins/debug/__init__.py rename to asyncbox/plugins/debug/__init__.py diff --git a/boxv2/plugins/debug/commands.py b/asyncbox/plugins/debug/commands.py similarity index 93% rename from boxv2/plugins/debug/commands.py rename to asyncbox/plugins/debug/commands.py index abaa1f5..68a0fc1 100644 --- a/boxv2/plugins/debug/commands.py +++ b/asyncbox/plugins/debug/commands.py @@ -20,7 +20,7 @@ async def plugins(message: Message, bot: Bot) -> None: (plugin.get_name(), (await plugin.healthcheck()).json(indent=2)) for plugin in bot.state.plugins ] - template = "**{name}**\n ```json\n{status}\n``` \n\n" + template = "**{name}**\n ```json\n{status}\n```" text = "\n\n".join( [template.format(name=name, status=status) for name, status in names_and_status] ) diff --git a/boxv2/plugins/debug/plugin.py b/asyncbox/plugins/debug/plugin.py similarity index 72% rename from boxv2/plugins/debug/plugin.py rename to asyncbox/plugins/debug/plugin.py index 09222a8..72f4e47 100644 --- a/boxv2/plugins/debug/plugin.py +++ b/asyncbox/plugins/debug/plugin.py @@ -2,8 +2,8 @@ from typing import Any -from boxv2.plugin import BasePlugin -from boxv2.plugins.debug.commands import collector +from asyncbox.plugin import BasePlugin +from asyncbox.plugins.debug.commands import collector class DebugPlugin(BasePlugin): diff --git a/boxv2/plugins/logger/__init__.py b/asyncbox/plugins/logger/__init__.py similarity index 100% rename from boxv2/plugins/logger/__init__.py rename to asyncbox/plugins/logger/__init__.py diff --git a/boxv2/plugins/logger/plugin.py b/asyncbox/plugins/logger/plugin.py similarity index 98% rename from boxv2/plugins/logger/plugin.py rename to asyncbox/plugins/logger/plugin.py index f2c54ac..5ce1ce4 100644 --- a/boxv2/plugins/logger/plugin.py +++ b/asyncbox/plugins/logger/plugin.py @@ -9,7 +9,7 @@ from loguru import logger from loguru._defaults import LOGURU_FORMAT # noqa: WPS436 -from boxv2.plugin import BasePlugin, BasePluginSettings +from asyncbox.plugin import BasePlugin, BasePluginSettings if TYPE_CHECKING: from loguru import Record # noqa: WPS433 # pragma: no cover diff --git a/boxv2/plugins/prometheus/__init__.py b/asyncbox/plugins/prometheus/__init__.py similarity index 100% rename from boxv2/plugins/prometheus/__init__.py rename to asyncbox/plugins/prometheus/__init__.py diff --git a/boxv2/plugins/prometheus/endpoint.py b/asyncbox/plugins/prometheus/endpoint.py similarity index 100% rename from boxv2/plugins/prometheus/endpoint.py rename to asyncbox/plugins/prometheus/endpoint.py diff --git a/boxv2/plugins/prometheus/middleware.py b/asyncbox/plugins/prometheus/middleware.py similarity index 100% rename from boxv2/plugins/prometheus/middleware.py rename to asyncbox/plugins/prometheus/middleware.py diff --git a/boxv2/plugins/prometheus/plugin.py b/asyncbox/plugins/prometheus/plugin.py similarity index 71% rename from boxv2/plugins/prometheus/plugin.py rename to asyncbox/plugins/prometheus/plugin.py index 51a5d38..ccebaba 100644 --- a/boxv2/plugins/prometheus/plugin.py +++ b/asyncbox/plugins/prometheus/plugin.py @@ -2,9 +2,9 @@ from typing import Any -from boxv2.plugin import BasePlugin -from boxv2.plugins.prometheus.endpoint import router -from boxv2.plugins.prometheus.middleware import PrometheusMiddleware +from asyncbox.plugin import BasePlugin +from asyncbox.plugins.prometheus.endpoint import router +from asyncbox.plugins.prometheus.middleware import PrometheusMiddleware class PrometheusPlugin(BasePlugin): diff --git a/boxv2/plugins/redis/__init__.py b/asyncbox/plugins/redis/__init__.py similarity index 100% rename from boxv2/plugins/redis/__init__.py rename to asyncbox/plugins/redis/__init__.py diff --git a/boxv2/plugins/redis/plugin.py b/asyncbox/plugins/redis/plugin.py similarity index 92% rename from boxv2/plugins/redis/plugin.py rename to asyncbox/plugins/redis/plugin.py index 0fb594f..b58ce85 100644 --- a/boxv2/plugins/redis/plugin.py +++ b/asyncbox/plugins/redis/plugin.py @@ -4,8 +4,8 @@ from pydantic import RedisDsn -from boxv2.plugin import BasePlugin, BasePluginSettings, HealtCheckData -from boxv2.plugins.redis.repo import RedisRepo +from asyncbox.plugin import BasePlugin, BasePluginSettings, HealtCheckData +from asyncbox.plugins.redis.repo import RedisRepo class Settings(BasePluginSettings): diff --git a/boxv2/plugins/redis/repo.py b/asyncbox/plugins/redis/repo.py similarity index 100% rename from boxv2/plugins/redis/repo.py rename to asyncbox/plugins/redis/repo.py diff --git a/boxv2/plugins/sentry/__init__.py b/asyncbox/plugins/sentry/__init__.py similarity index 100% rename from boxv2/plugins/sentry/__init__.py rename to asyncbox/plugins/sentry/__init__.py diff --git a/boxv2/plugins/sentry/middleware.py b/asyncbox/plugins/sentry/middleware.py similarity index 100% rename from boxv2/plugins/sentry/middleware.py rename to asyncbox/plugins/sentry/middleware.py diff --git a/boxv2/plugins/sentry/plugin.py b/asyncbox/plugins/sentry/plugin.py similarity index 85% rename from boxv2/plugins/sentry/plugin.py rename to asyncbox/plugins/sentry/plugin.py index 5e920e4..c161e62 100644 --- a/boxv2/plugins/sentry/plugin.py +++ b/asyncbox/plugins/sentry/plugin.py @@ -6,8 +6,8 @@ from pydantic import AnyHttpUrl from sentry_sdk.integrations.asgi import SentryAsgiMiddleware # type: ignore -from boxv2.plugin import BasePlugin, BasePluginSettings -from boxv2.plugins.sentry.middleware import SentryMiddleware +from asyncbox.plugin import BasePlugin, BasePluginSettings +from asyncbox.plugins.sentry.middleware import SentryMiddleware class Settings(BasePluginSettings): diff --git a/boxv2/plugins/sqlalchemy/__init__.py b/asyncbox/plugins/sqlalchemy/__init__.py similarity index 100% rename from boxv2/plugins/sqlalchemy/__init__.py rename to asyncbox/plugins/sqlalchemy/__init__.py diff --git a/boxv2/plugins/sqlalchemy/plugin.py b/asyncbox/plugins/sqlalchemy/plugin.py similarity index 91% rename from boxv2/plugins/sqlalchemy/plugin.py rename to asyncbox/plugins/sqlalchemy/plugin.py index b04c259..557881f 100644 --- a/boxv2/plugins/sqlalchemy/plugin.py +++ b/asyncbox/plugins/sqlalchemy/plugin.py @@ -5,8 +5,8 @@ from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession, create_async_engine from sqlalchemy.orm import sessionmaker -from boxv2.plugin import BasePlugin, BasePluginSettings, HealtCheckData -from boxv2.plugins.sqlalchemy.url_scheme_utils import make_url_async +from asyncbox.plugin import BasePlugin, BasePluginSettings, HealtCheckData +from asyncbox.plugins.sqlalchemy.url_scheme_utils import make_url_async class Settings(BasePluginSettings): @@ -48,7 +48,7 @@ async def healthcheck(self) -> HealtCheckData: return HealtCheckData(healthy=False, information={"error": str(exc)}) return HealtCheckData( healthy=True, - info={ + information={ "server_version": rows.scalars().one(), "dsn": self.settings.POSTGRES_DSN, }, diff --git a/boxv2/plugins/sqlalchemy/template/cookiecutter.json b/asyncbox/plugins/sqlalchemy/template/cookiecutter.json similarity index 76% rename from boxv2/plugins/sqlalchemy/template/cookiecutter.json rename to asyncbox/plugins/sqlalchemy/template/cookiecutter.json index 395902c..70111a9 100644 --- a/boxv2/plugins/sqlalchemy/template/cookiecutter.json +++ b/asyncbox/plugins/sqlalchemy/template/cookiecutter.json @@ -1,6 +1,6 @@ { - "bot_name": "boxv2-bot", - "bot_display_name": "boxv2 bot", + "bot_name": "asyncbox-bot", + "bot_display_name": "asyncbox bot", "bot_short_description": "TODO", "bot_docs_link": "TODO", "test_cov": 0, diff --git a/boxv2/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/alembic.ini b/asyncbox/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/alembic.ini similarity index 100% rename from boxv2/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/alembic.ini rename to asyncbox/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/alembic.ini diff --git a/boxv2/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/__init__.py b/asyncbox/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/__init__.py similarity index 100% rename from boxv2/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/__init__.py rename to asyncbox/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/__init__.py diff --git a/boxv2/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/migrations/__init__.py b/asyncbox/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/migrations/__init__.py similarity index 100% rename from boxv2/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/migrations/__init__.py rename to asyncbox/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/migrations/__init__.py diff --git a/boxv2/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/migrations/env.py b/asyncbox/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/migrations/env.py similarity index 86% rename from boxv2/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/migrations/env.py rename to asyncbox/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/migrations/env.py index 25c06d4..a54ea8e 100644 --- a/boxv2/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/migrations/env.py +++ b/asyncbox/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/migrations/env.py @@ -8,8 +8,8 @@ # init config sys.path.append(str(pathlib.Path(__file__).resolve().parents[3])) -from boxv2.application import get_app_settings # isort:skip -from boxv2.plugins.sqlalchemy.url_scheme_utils import make_url_sync # isort:skip +from asyncbox.application import get_app_settings # isort:skip +from asyncbox.plugins.sqlalchemy.url_scheme_utils import make_url_sync # isort:skip from app.db.models import Base # isort:skip postgres_dsn = make_url_sync(get_app_settings().POSTGRES_DSN) diff --git a/boxv2/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/migrations/script.py.mako b/asyncbox/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/migrations/script.py.mako similarity index 100% rename from boxv2/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/migrations/script.py.mako rename to asyncbox/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/migrations/script.py.mako diff --git a/boxv2/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/migrations/versions/__init__.py b/asyncbox/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/migrations/versions/__init__.py similarity index 100% rename from boxv2/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/migrations/versions/__init__.py rename to asyncbox/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/migrations/versions/__init__.py diff --git a/boxv2/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/models.py b/asyncbox/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/models.py similarity index 100% rename from boxv2/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/models.py rename to asyncbox/plugins/sqlalchemy/template/{{cookiecutter.bot_name}}/app/db/models.py diff --git a/boxv2/plugins/sqlalchemy/url_scheme_utils.py b/asyncbox/plugins/sqlalchemy/url_scheme_utils.py similarity index 100% rename from boxv2/plugins/sqlalchemy/url_scheme_utils.py rename to asyncbox/plugins/sqlalchemy/url_scheme_utils.py diff --git a/boxv2/py.typed b/asyncbox/py.typed similarity index 100% rename from boxv2/py.typed rename to asyncbox/py.typed diff --git a/boxv2/settings.py b/asyncbox/settings.py similarity index 96% rename from boxv2/settings.py rename to asyncbox/settings.py index f6492a4..5f23d05 100644 --- a/boxv2/settings.py +++ b/asyncbox/settings.py @@ -13,9 +13,9 @@ class Config: # noqa: WPS431 env_file = ".env" json_loads = lambda x: x # noqa: E731,WPS111 - NAME = "boxv2" + NAME = "asyncbox" - PLUGINS = ["boxv2.plugins.tortoise"] + PLUGINS = ["asyncbox.plugins.tortoise"] COLLECTORS: List[str] = [] # base kwargs diff --git a/boxv2/template/cookiecutter.json b/asyncbox/template/cookiecutter.json similarity index 78% rename from boxv2/template/cookiecutter.json rename to asyncbox/template/cookiecutter.json index efd86aa..0ad966b 100644 --- a/boxv2/template/cookiecutter.json +++ b/asyncbox/template/cookiecutter.json @@ -1,6 +1,6 @@ { - "bot_name": "boxv2-bot", - "bot_display_name": "boxv2 bot", + "bot_name": "asyncbox-bot", + "bot_display_name": "asyncbox bot", "bot_short_description": "TODO", "bot_docs_link": "TODO", "test_cov": 0, diff --git a/boxv2/template/{{cookiecutter.bot_name}}/app/__init__.py b/asyncbox/template/{{cookiecutter.bot_name}}/app/__init__.py similarity index 100% rename from boxv2/template/{{cookiecutter.bot_name}}/app/__init__.py rename to asyncbox/template/{{cookiecutter.bot_name}}/app/__init__.py diff --git a/boxv2/template/{{cookiecutter.bot_name}}/app/commands.py b/asyncbox/template/{{cookiecutter.bot_name}}/app/commands.py similarity index 100% rename from boxv2/template/{{cookiecutter.bot_name}}/app/commands.py rename to asyncbox/template/{{cookiecutter.bot_name}}/app/commands.py diff --git a/boxv2/template/{{cookiecutter.bot_name}}/app/main.py b/asyncbox/template/{{cookiecutter.bot_name}}/app/main.py similarity index 53% rename from boxv2/template/{{cookiecutter.bot_name}}/app/main.py rename to asyncbox/template/{{cookiecutter.bot_name}}/app/main.py index b27600f..0241ade 100644 --- a/boxv2/template/{{cookiecutter.bot_name}}/app/main.py +++ b/asyncbox/template/{{cookiecutter.bot_name}}/app/main.py @@ -1,5 +1,5 @@ """Main module.""" -from boxv2 import get_application # pragma: no cover +from asyncbox import get_application # pragma: no cover app = get_application() # pragma: no cover diff --git a/boxv2/template/{{cookiecutter.bot_name}}/app/settings.py b/asyncbox/template/{{cookiecutter.bot_name}}/app/settings.py similarity index 80% rename from boxv2/template/{{cookiecutter.bot_name}}/app/settings.py rename to asyncbox/template/{{cookiecutter.bot_name}}/app/settings.py index 9aee7f1..d7864a2 100644 --- a/boxv2/template/{{cookiecutter.bot_name}}/app/settings.py +++ b/asyncbox/template/{{cookiecutter.bot_name}}/app/settings.py @@ -2,7 +2,7 @@ from typing import List -from boxv2.settings import BaseAppSettings +from asyncbox.settings import BaseAppSettings class AppSettings(BaseAppSettings): @@ -11,7 +11,7 @@ class AppSettings(BaseAppSettings): NAME = "{{cookiecutter.bot_name}}" PLUGINS: List[str] = [ {% for plugin in cookiecutter.plugins.plugins_list %} - "boxv2.plugins.{{ plugin }}", + "asyncbox.plugins.{{ plugin }}", {% endfor %} ] COLLECTORS: List[str] = [ diff --git a/boxv2/template/{{cookiecutter.bot_name}}/pyproject.toml b/asyncbox/template/{{cookiecutter.bot_name}}/pyproject.toml similarity index 88% rename from boxv2/template/{{cookiecutter.bot_name}}/pyproject.toml rename to asyncbox/template/{{cookiecutter.bot_name}}/pyproject.toml index 3d040fb..2c13492 100644 --- a/boxv2/template/{{cookiecutter.bot_name}}/pyproject.toml +++ b/asyncbox/template/{{cookiecutter.bot_name}}/pyproject.toml @@ -8,7 +8,7 @@ authors = [] [tool.poetry.dependencies] python = ">=3.9,<3.10" -boxv2 = { git = "https://github.com/ExpressApp/boxv2.git", tag = "0.4.0"} +asyncbox = { git = "https://github.com/ExpressApp/asyncbox-framework.git", tag = "0.4.0"} [tool.poetry.dev-dependencies] black = "~20.8b1" diff --git a/boxv2/tests/__init__.py b/asyncbox/tests/__init__.py similarity index 100% rename from boxv2/tests/__init__.py rename to asyncbox/tests/__init__.py diff --git a/boxv2/tests/fixtures.py b/asyncbox/tests/fixtures.py similarity index 99% rename from boxv2/tests/fixtures.py rename to asyncbox/tests/fixtures.py index 9c4193c..835977c 100644 --- a/boxv2/tests/fixtures.py +++ b/asyncbox/tests/fixtures.py @@ -14,7 +14,7 @@ from fastapi import FastAPI from pytest_cov.plugin import StoreReport -from boxv2 import get_application +from asyncbox import get_application @pytest.fixture(scope="session") diff --git a/boxv2/utils/__init__.py b/asyncbox/utils/__init__.py similarity index 100% rename from boxv2/utils/__init__.py rename to asyncbox/utils/__init__.py diff --git a/boxv2/utils/import_utils.py b/asyncbox/utils/import_utils.py similarity index 100% rename from boxv2/utils/import_utils.py rename to asyncbox/utils/import_utils.py diff --git a/boxv2/utils/mako.py b/asyncbox/utils/mako.py similarity index 100% rename from boxv2/utils/mako.py rename to asyncbox/utils/mako.py diff --git a/boxv2/__init__.py b/boxv2/__init__.py deleted file mode 100644 index 87366e7..0000000 --- a/boxv2/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from boxv2.application import get_application - -__all__ = ["get_application"] diff --git a/poetry.lock b/poetry.lock index b271158..6f7a14f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -10,17 +10,6 @@ python-versions = "*" async-timeout = "*" hiredis = "*" -[[package]] -name = "aiosqlite" -version = "0.16.1" -description = "asyncio bridge to the standard sqlite3 module" -category = "main" -optional = false -python-versions = ">=3.6" - -[package.dependencies] -typing_extensions = ">=3.7.2" - [[package]] name = "alembic" version = "1.7.4" @@ -289,7 +278,7 @@ toml = ["tomli"] [[package]] name = "darglint" -version = "1.8.0" +version = "1.8.1" description = "A utility for ensuring Google-style docstrings stay up to date with the source code." category = "dev" optional = false @@ -402,14 +391,14 @@ dev = ["coverage", "black", "hypothesis", "hypothesmith"] [[package]] name = "flake8-commas" -version = "2.0.0" +version = "2.1.0" description = "Flake8 lint for trailing commas." category = "dev" optional = false python-versions = "*" [package.dependencies] -flake8 = ">=2,<4.0.0" +flake8 = ">=2" [[package]] name = "flake8-comprehensions" @@ -462,19 +451,19 @@ flake8 = ">=3.5,<4.0" [[package]] name = "flake8-isort" -version = "4.0.0" +version = "4.1.1" description = "flake8 plugin that integrates isort ." category = "dev" optional = false python-versions = "*" [package.dependencies] -flake8 = ">=3.2.1,<4" +flake8 = ">=3.2.1,<5" isort = ">=4.3.5,<6" testfixtures = ">=6.8.0,<7" [package.extras] -test = ["pytest (>=4.0.2,<6)", "toml"] +test = ["pytest-cov"] [[package]] name = "flake8-polyfill" @@ -613,14 +602,6 @@ category = "main" optional = false python-versions = ">=3.5" -[[package]] -name = "iso8601" -version = "0.1.16" -description = "Simple module to parse ISO 8601 dates" -category = "main" -optional = false -python-versions = "*" - [[package]] name = "isort" version = "4.3.21" @@ -901,14 +882,6 @@ category = "dev" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" -[[package]] -name = "pypika" -version = "0.44.1" -description = "A SQL query builder API for Python" -category = "main" -optional = false -python-versions = "*" - [[package]] name = "pytest" version = "5.4.3" @@ -1041,21 +1014,13 @@ text-unidecode = ">=1.3" [package.extras] unidecode = ["Unidecode (>=1.1.1)"] -[[package]] -name = "pytz" -version = "2020.5" -description = "World timezone definitions, modern and historical" -category = "main" -optional = false -python-versions = "*" - [[package]] name = "pyyaml" -version = "5.4.1" +version = "6.0" description = "YAML parser and emitter for Python" category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" +python-versions = ">=3.6" [[package]] name = "regex" @@ -1213,7 +1178,7 @@ full = ["aiofiles", "graphene", "itsdangerous", "jinja2", "python-multipart", "p [[package]] name = "stevedore" -version = "3.4.0" +version = "3.5.0" description = "Manage dynamic plugins for Python applications" category = "dev" optional = false @@ -1259,26 +1224,6 @@ category = "dev" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" -[[package]] -name = "tortoise-orm" -version = "0.16.21" -description = "Easy async ORM for python, built with relations in mind" -category = "main" -optional = false -python-versions = ">=3.7,<4.0" - -[package.dependencies] -aiosqlite = ">=0.16.0,<0.17.0" -iso8601 = ">=0.1.13,<0.2.0" -pypika = ">=0.44.0,<0.45.0" -pytz = ">=2020.4,<2021.0" - -[package.extras] -docs = ["pygments", "cloud-sptheme", "docutils", "sphinx"] -aiomysql = ["aiomysql"] -asyncpg = ["asyncpg"] -accel = ["ciso8601 (>=2.1.2,<3.0.0)", "python-rapidjson", "uvloop (>=0.14.0,<0.15.0)"] - [[package]] name = "typed-ast" version = "1.4.3" @@ -1398,17 +1343,13 @@ dev = ["pytest (>=4.6.2)", "black (>=19.3b0)"] [metadata] lock-version = "1.1" python-versions = "~3.9" -content-hash = "4eb931a4093b55ba1ff4f68a79144c8f487c18e6f41a02dd89865d21107afd7e" +content-hash = "46cfec2b997549b72a6667573eca562433434d1bbf5f0f75c8797f05f253d9c8" [metadata.files] aioredis = [ {file = "aioredis-1.3.1-py3-none-any.whl", hash = "sha256:b61808d7e97b7cd5a92ed574937a079c9387fdadd22bfbfa7ad2fd319ecc26e3"}, {file = "aioredis-1.3.1.tar.gz", hash = "sha256:15f8af30b044c771aee6787e5ec24694c048184c7b9e54c3b60c750a4b93273a"}, ] -aiosqlite = [ - {file = "aiosqlite-0.16.1-py3-none-any.whl", hash = "sha256:1df802815bb1e08a26c06d5ea9df589bcb8eec56e5f3378103b0f9b223c6703c"}, - {file = "aiosqlite-0.16.1.tar.gz", hash = "sha256:2e915463164efa65b60fd1901aceca829b6090082f03082618afca6fb9c8fdf7"}, -] alembic = [ {file = "alembic-1.7.4-py3-none-any.whl", hash = "sha256:e3cab9e59778b3b6726bb2da9ced451c6622d558199fd3ef914f3b1e8f4ef704"}, {file = "alembic-1.7.4.tar.gz", hash = "sha256:9d33f3ff1488c4bfab1e1a6dfebbf085e8a8e1a3e047a43ad29ad1f67f012a1d"}, @@ -1542,8 +1483,8 @@ coverage = [ {file = "coverage-6.0.2.tar.gz", hash = "sha256:6807947a09510dc31fa86f43595bf3a14017cd60bf633cc746d52141bfa6b149"}, ] darglint = [ - {file = "darglint-1.8.0-py3-none-any.whl", hash = "sha256:ac6797bcc918cd8d8f14c168a4a364f54e1aeb4ced59db58e7e4c6dfec2fe15c"}, - {file = "darglint-1.8.0.tar.gz", hash = "sha256:aa605ef47817a6d14797d32b390466edab621768ea4ca5cc0f3c54f6d8dcaec8"}, + {file = "darglint-1.8.1-py3-none-any.whl", hash = "sha256:5ae11c259c17b0701618a20c3da343a3eb98b3bc4b5a83d31cdd94f5ebdced8d"}, + {file = "darglint-1.8.1.tar.gz", hash = "sha256:080d5106df149b199822e7ee7deb9c012b49891538f14a11be681044f0bb20da"}, ] databases = [ {file = "databases-0.4.2-py3-none-any.whl", hash = "sha256:44788f6fd344f27baa2be9b42c3926222932000a3ba7dce5a305167a2cb1f6bb"}, @@ -1576,8 +1517,8 @@ flake8-bugbear = [ {file = "flake8_bugbear-21.9.2-py36.py37.py38-none-any.whl", hash = "sha256:4f7eaa6f05b7d7ea4cbbde93f7bcdc5438e79320fa1ec420d860c181af38b769"}, ] flake8-commas = [ - {file = "flake8-commas-2.0.0.tar.gz", hash = "sha256:d3005899466f51380387df7151fb59afec666a0f4f4a2c6a8995b975de0f44b7"}, - {file = "flake8_commas-2.0.0-py2.py3-none-any.whl", hash = "sha256:ee2141a3495ef9789a3894ed8802d03eff1eaaf98ce6d8653a7c573ef101935e"}, + {file = "flake8-commas-2.1.0.tar.gz", hash = "sha256:940441ab8ee544df564ae3b3f49f20462d75d5c7cac2463e0b27436e2050f263"}, + {file = "flake8_commas-2.1.0-py2.py3-none-any.whl", hash = "sha256:ebb96c31e01d0ef1d0685a21f3f0e2f8153a0381430e748bf0bbbb5d5b453d54"}, ] flake8-comprehensions = [ {file = "flake8-comprehensions-3.7.0.tar.gz", hash = "sha256:6b3218b2dde8ac5959c6476cde8f41a79e823c22feb656be2710cd2a3232cef9"}, @@ -1596,8 +1537,8 @@ flake8-eradicate = [ {file = "flake8_eradicate-1.1.0-py3-none-any.whl", hash = "sha256:d8e39b684a37c257a53cda817d86e2d96c9ba3450ddc292742623a5dfee04d9e"}, ] flake8-isort = [ - {file = "flake8-isort-4.0.0.tar.gz", hash = "sha256:2b91300f4f1926b396c2c90185844eb1a3d5ec39ea6138832d119da0a208f4d9"}, - {file = "flake8_isort-4.0.0-py2.py3-none-any.whl", hash = "sha256:729cd6ef9ba3659512dee337687c05d79c78e1215fdf921ed67e5fe46cce2f3c"}, + {file = "flake8-isort-4.1.1.tar.gz", hash = "sha256:d814304ab70e6e58859bc5c3e221e2e6e71c958e7005239202fee19c24f82717"}, + {file = "flake8_isort-4.1.1-py3-none-any.whl", hash = "sha256:c4e8b6dcb7be9b71a02e6e5d4196cefcef0f3447be51e82730fb336fff164949"}, ] flake8-polyfill = [ {file = "flake8-polyfill-1.0.2.tar.gz", hash = "sha256:e44b087597f6da52ec6393a709e7108b2905317d0c0b744cdca6208e670d8eda"}, @@ -1733,10 +1674,6 @@ idna = [ {file = "idna-3.3-py3-none-any.whl", hash = "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff"}, {file = "idna-3.3.tar.gz", hash = "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"}, ] -iso8601 = [ - {file = "iso8601-0.1.16-py2.py3-none-any.whl", hash = "sha256:906714829fedbc89955d52806c903f2332e3948ed94e31e85037f9e0226b8376"}, - {file = "iso8601-0.1.16.tar.gz", hash = "sha256:36532f77cc800594e8f16641edae7f1baf7932f05d8e508545b95fc53c6dc85b"}, -] isort = [ {file = "isort-4.3.21-py2.py3-none-any.whl", hash = "sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd"}, {file = "isort-4.3.21.tar.gz", hash = "sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1"}, @@ -1941,9 +1878,6 @@ pyparsing = [ {file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"}, {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, ] -pypika = [ - {file = "pypika-0.44.1.tar.gz", hash = "sha256:316839144d3ad7656405a10cdd26d2181f16bb8ff7e256d616ffb50335ca1fcb"}, -] pytest = [ {file = "pytest-5.4.3-py3-none-any.whl", hash = "sha256:5c0db86b698e8f170ba4582a492248919255fcd4c79b1ee64ace34301fb589a1"}, {file = "pytest-5.4.3.tar.gz", hash = "sha256:7979331bfcba207414f5e1263b5a0f8f521d0f457318836a7355531ed1a4c7d8"}, @@ -1980,32 +1914,40 @@ python-slugify = [ {file = "python-slugify-5.0.2.tar.gz", hash = "sha256:f13383a0b9fcbe649a1892b9c8eb4f8eab1d6d84b84bb7a624317afa98159cab"}, {file = "python_slugify-5.0.2-py2.py3-none-any.whl", hash = "sha256:6d8c5df75cd4a7c3a2d21e257633de53f52ab0265cd2d1dc62a730e8194a7380"}, ] -pytz = [ - {file = "pytz-2020.5-py2.py3-none-any.whl", hash = "sha256:16962c5fb8db4a8f63a26646d8886e9d769b6c511543557bc84e9569fb9a9cb4"}, - {file = "pytz-2020.5.tar.gz", hash = "sha256:180befebb1927b16f6b57101720075a984c019ac16b1b7575673bea42c6c3da5"}, -] pyyaml = [ - {file = "PyYAML-5.4.1-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:3b2b1824fe7112845700f815ff6a489360226a5609b96ec2190a45e62a9fc922"}, - {file = "PyYAML-5.4.1-cp27-cp27m-win32.whl", hash = "sha256:129def1b7c1bf22faffd67b8f3724645203b79d8f4cc81f674654d9902cb4393"}, - {file = "PyYAML-5.4.1-cp27-cp27m-win_amd64.whl", hash = "sha256:4465124ef1b18d9ace298060f4eccc64b0850899ac4ac53294547536533800c8"}, - {file = "PyYAML-5.4.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:bb4191dfc9306777bc594117aee052446b3fa88737cd13b7188d0e7aa8162185"}, - {file = "PyYAML-5.4.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:6c78645d400265a062508ae399b60b8c167bf003db364ecb26dcab2bda048253"}, - {file = "PyYAML-5.4.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:4e0583d24c881e14342eaf4ec5fbc97f934b999a6828693a99157fde912540cc"}, - {file = "PyYAML-5.4.1-cp36-cp36m-win32.whl", hash = "sha256:3bd0e463264cf257d1ffd2e40223b197271046d09dadf73a0fe82b9c1fc385a5"}, - {file = "PyYAML-5.4.1-cp36-cp36m-win_amd64.whl", hash = "sha256:e4fac90784481d221a8e4b1162afa7c47ed953be40d31ab4629ae917510051df"}, - {file = "PyYAML-5.4.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:5accb17103e43963b80e6f837831f38d314a0495500067cb25afab2e8d7a4018"}, - {file = "PyYAML-5.4.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:e1d4970ea66be07ae37a3c2e48b5ec63f7ba6804bdddfdbd3cfd954d25a82e63"}, - {file = "PyYAML-5.4.1-cp37-cp37m-win32.whl", hash = "sha256:dd5de0646207f053eb0d6c74ae45ba98c3395a571a2891858e87df7c9b9bd51b"}, - {file = "PyYAML-5.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:08682f6b72c722394747bddaf0aa62277e02557c0fd1c42cb853016a38f8dedf"}, - {file = "PyYAML-5.4.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:d2d9808ea7b4af864f35ea216be506ecec180628aced0704e34aca0b040ffe46"}, - {file = "PyYAML-5.4.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:8c1be557ee92a20f184922c7b6424e8ab6691788e6d86137c5d93c1a6ec1b8fb"}, - {file = "PyYAML-5.4.1-cp38-cp38-win32.whl", hash = "sha256:fa5ae20527d8e831e8230cbffd9f8fe952815b2b7dae6ffec25318803a7528fc"}, - {file = "PyYAML-5.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:0f5f5786c0e09baddcd8b4b45f20a7b5d61a7e7e99846e3c799b05c7c53fa696"}, - {file = "PyYAML-5.4.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:294db365efa064d00b8d1ef65d8ea2c3426ac366c0c4368d930bf1c5fb497f77"}, - {file = "PyYAML-5.4.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:74c1485f7707cf707a7aef42ef6322b8f97921bd89be2ab6317fd782c2d53183"}, - {file = "PyYAML-5.4.1-cp39-cp39-win32.whl", hash = "sha256:49d4cdd9065b9b6e206d0595fee27a96b5dd22618e7520c33204a4a3239d5b10"}, - {file = "PyYAML-5.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:c20cfa2d49991c8b4147af39859b167664f2ad4561704ee74c1de03318e898db"}, - {file = "PyYAML-5.4.1.tar.gz", hash = "sha256:607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e"}, + {file = "PyYAML-6.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53"}, + {file = "PyYAML-6.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c"}, + {file = "PyYAML-6.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc"}, + {file = "PyYAML-6.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a80a78046a72361de73f8f395f1f1e49f956c6be882eed58505a15f3e430962b"}, + {file = "PyYAML-6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5"}, + {file = "PyYAML-6.0-cp310-cp310-win32.whl", hash = "sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513"}, + {file = "PyYAML-6.0-cp310-cp310-win_amd64.whl", hash = "sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a"}, + {file = "PyYAML-6.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86"}, + {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f"}, + {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92"}, + {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:98c4d36e99714e55cfbaaee6dd5badbc9a1ec339ebfc3b1f52e293aee6bb71a4"}, + {file = "PyYAML-6.0-cp36-cp36m-win32.whl", hash = "sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293"}, + {file = "PyYAML-6.0-cp36-cp36m-win_amd64.whl", hash = "sha256:07751360502caac1c067a8132d150cf3d61339af5691fe9e87803040dbc5db57"}, + {file = "PyYAML-6.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:819b3830a1543db06c4d4b865e70ded25be52a2e0631ccd2f6a47a2822f2fd7c"}, + {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:473f9edb243cb1935ab5a084eb238d842fb8f404ed2193a915d1784b5a6b5fc0"}, + {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0ce82d761c532fe4ec3f87fc45688bdd3a4c1dc5e0b4a19814b9009a29baefd4"}, + {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:231710d57adfd809ef5d34183b8ed1eeae3f76459c18fb4a0b373ad56bedcdd9"}, + {file = "PyYAML-6.0-cp37-cp37m-win32.whl", hash = "sha256:c5687b8d43cf58545ade1fe3e055f70eac7a5a1a0bf42824308d868289a95737"}, + {file = "PyYAML-6.0-cp37-cp37m-win_amd64.whl", hash = "sha256:d15a181d1ecd0d4270dc32edb46f7cb7733c7c508857278d3d378d14d606db2d"}, + {file = "PyYAML-6.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0b4624f379dab24d3725ffde76559cff63d9ec94e1736b556dacdfebe5ab6d4b"}, + {file = "PyYAML-6.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:213c60cd50106436cc818accf5baa1aba61c0189ff610f64f4a3e8c6726218ba"}, + {file = "PyYAML-6.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9fa600030013c4de8165339db93d182b9431076eb98eb40ee068700c9c813e34"}, + {file = "PyYAML-6.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:277a0ef2981ca40581a47093e9e2d13b3f1fbbeffae064c1d21bfceba2030287"}, + {file = "PyYAML-6.0-cp38-cp38-win32.whl", hash = "sha256:d4eccecf9adf6fbcc6861a38015c2a64f38b9d94838ac1810a9023a0609e1b78"}, + {file = "PyYAML-6.0-cp38-cp38-win_amd64.whl", hash = "sha256:1e4747bc279b4f613a09eb64bba2ba602d8a6664c6ce6396a4d0cd413a50ce07"}, + {file = "PyYAML-6.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b"}, + {file = "PyYAML-6.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174"}, + {file = "PyYAML-6.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d67d839ede4ed1b28a4e8909735fc992a923cdb84e618544973d7dfc71540803"}, + {file = "PyYAML-6.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cba8c411ef271aa037d7357a2bc8f9ee8b58b9965831d9e51baf703280dc73d3"}, + {file = "PyYAML-6.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0"}, + {file = "PyYAML-6.0-cp39-cp39-win32.whl", hash = "sha256:b5b9eccad747aabaaffbc6064800670f0c297e52c12754eb1d976c57e4f74dcb"}, + {file = "PyYAML-6.0-cp39-cp39-win_amd64.whl", hash = "sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c"}, + {file = "PyYAML-6.0.tar.gz", hash = "sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2"}, ] regex = [ {file = "regex-2021.10.8-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:981c786293a3115bc14c103086ae54e5ee50ca57f4c02ce7cf1b60318d1e8072"}, @@ -2118,8 +2060,8 @@ starlette = [ {file = "starlette-0.14.2.tar.gz", hash = "sha256:7d49f4a27f8742262ef1470608c59ddbc66baf37c148e938c7038e6bc7a998aa"}, ] stevedore = [ - {file = "stevedore-3.4.0-py3-none-any.whl", hash = "sha256:920ce6259f0b2498aaa4545989536a27e4e4607b8318802d7ddc3a533d3d069e"}, - {file = "stevedore-3.4.0.tar.gz", hash = "sha256:59b58edb7f57b11897f150475e7bc0c39c5381f0b8e3fa9f5c20ce6c89ec4aa1"}, + {file = "stevedore-3.5.0-py3-none-any.whl", hash = "sha256:a547de73308fd7e90075bb4d301405bebf705292fa90a90fc3bcf9133f58616c"}, + {file = "stevedore-3.5.0.tar.gz", hash = "sha256:f40253887d8712eaa2bb0ea3830374416736dc8ec0e22f5a65092c1174c44335"}, ] termcolor = [ {file = "termcolor-1.1.0.tar.gz", hash = "sha256:1d6d69ce66211143803fbc56652b41d73b4a400a2891d7bf7a1cdf4c02de613b"}, @@ -2136,10 +2078,6 @@ toml = [ {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, ] -tortoise-orm = [ - {file = "tortoise-orm-0.16.21.tar.gz", hash = "sha256:9729eac3eb58e59c32e2815d5ff1941a71e1eecd63834ae7199b6084c1a454b5"}, - {file = "tortoise_orm-0.16.21-py3-none-any.whl", hash = "sha256:f36aa16d07bab69b141e91f8791c0f878fbcc0acfffa3c671ea10a6ad73c54ed"}, -] typed-ast = [ {file = "typed_ast-1.4.3-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:2068531575a125b87a41802130fa7e29f26c09a2833fea68d9a40cf33902eba6"}, {file = "typed_ast-1.4.3-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:c907f561b1e83e93fad565bac5ba9c22d96a54e7ea0267c708bffe863cbe4075"}, diff --git a/pyproject.toml b/pyproject.toml index 576abe2..0367f3d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.poetry] -name = "boxv2" +name = "asyncbox" version = "0.4.0" description = "Express bot framework" authors = ["vkarabanov "] @@ -42,4 +42,4 @@ requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" [tool.poetry.scripts] -boxv2 = 'boxv2.main:main' +asyncbox = 'asyncbox.main:main' diff --git a/scripts/format b/scripts/format index 134df0c..29c3c77 100755 --- a/scripts/format +++ b/scripts/format @@ -2,7 +2,7 @@ set -e -isort --recursive --force-single-line-imports boxv2 tests -autoflake --recursive --remove-all-unused-imports --remove-unused-variables --in-place --exclude boxv2/template/** boxv2 tests -black --exclude boxv2/template boxv2 tests -isort --recursive boxv2 tests +isort --recursive --force-single-line-imports asyncbox tests +autoflake --recursive --remove-all-unused-imports --remove-unused-variables --in-place --exclude asyncbox/template/** asyncbox tests +black --exclude asyncbox/template asyncbox tests +isort --recursive asyncbox tests diff --git a/scripts/lint b/scripts/lint index aba192d..11c3fc1 100755 --- a/scripts/lint +++ b/scripts/lint @@ -4,9 +4,9 @@ set -e set -x -mypy boxv2 -flake8 boxv2 +mypy asyncbox +flake8 asyncbox -black --exclude boxv2/template --check boxv2 --diff -isort --recursive --check-only boxv2 +black --exclude asyncbox/template --check asyncbox --diff +isort --recursive --check-only asyncbox diff --git a/scripts/test b/scripts/test index 403adaf..d9e324c 100755 --- a/scripts/test +++ b/scripts/test @@ -4,8 +4,12 @@ if [ -f .env ]; then source .env fi -echo using PostgreSQL at $TEST_POSTGRES_DSN -echo using Redis at $TEST_REDIS_DSN +echo testing asyncbox -echo testing boxv2 itself -POSTGRES_DSN=$TEST_POSTGRES_DSN REDIS_DSN=$TEST_REDIS_DSN pytest --cov-config=setup.cfg +POSTGRES_DSN="${TEST_POSTGRES_DSN:-$POSTGRES_DSN}" +REDIS_DSN="${TEST_REDIS_DSN:-$REDIS_DSN}" + +echo using PostgreSQL at $POSTGRES_DSN +echo using Redis at $REDIS_DSN + +pytest --cov-config=setup.cfg ${@} diff --git a/setup.cfg b/setup.cfg index 2188c70..320e609 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ testpaths = tests addopts = --diff-width=88 - --cov=boxv2 + --cov=asyncbox --cov=tests --no-cov-on-fail --cov-report term-missing @@ -31,10 +31,10 @@ init_forbid_extra = True init_typed = True warn_required_dynamic_aliases = True -[mypy-boxv2.cookiecutter.*] +[mypy-asyncbox.template.*] ignore_errors = True -[mypy-boxv2.tests.*] +[mypy-asyncbox.tests.*] ignore_errors = True [mypy-tests.*] @@ -78,11 +78,11 @@ max-arguments = 10 nested-classes-whitelist = Config, Meta, Params no-accept-encodings = True inline-quotes = " -exclude = boxv2/template, boxv2/plugins/sqlalchemy/template, boxv2/tests/fixtures.py +exclude = asyncbox/template, asyncbox/plugins/sqlalchemy/template, asyncbox/tests/fixtures.py per-file-ignores = - boxv2/settings.py:WPS115 - boxv2/plugins/*/plugin.py:WPS115 - boxv2/plugin.py:WPS609 + asyncbox/settings.py:WPS115 + asyncbox/plugins/*/plugin.py:WPS115 + asyncbox/plugin.py:WPS609 */__init__.py:D104,WPS412,WPS300,WPS410 # See https://wemake-python-stylegui.de/en/latest/pages/usage/violations/index.html diff --git a/tests/conftest.py b/tests/conftest.py index 5a9cf92..509e675 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,6 @@ from dotenv import load_dotenv -from boxv2.tests.fixtures import credentials, environment +from asyncbox.tests.fixtures import credentials, environment load_dotenv(".env") diff --git a/tests/test_plugins/test_debug/conftest.py b/tests/test_plugins/test_debug/conftest.py index 2832cbc..1341339 100644 --- a/tests/test_plugins/test_debug/conftest.py +++ b/tests/test_plugins/test_debug/conftest.py @@ -1,9 +1,9 @@ import pytest from fastapi import FastAPI -from boxv2 import get_application -from boxv2.settings import BaseAppSettings -from boxv2.tests.fixtures import ( +from asyncbox import get_application +from asyncbox.settings import BaseAppSettings +from asyncbox.tests.fixtures import ( bot, botx_client, builder, @@ -27,7 +27,7 @@ class AppSettings(BaseAppSettings): - PLUGINS = ["boxv2.plugins.debug"] + PLUGINS = ["asyncbox.plugins.debug"] @pytest.fixture diff --git a/tests/test_plugins/test_logger/test_logger.py b/tests/test_plugins/test_logger/test_logger.py index e792553..3254862 100644 --- a/tests/test_plugins/test_logger/test_logger.py +++ b/tests/test_plugins/test_logger/test_logger.py @@ -1,8 +1,8 @@ import pytest from loguru._defaults import LOGURU_FORMAT -from boxv2.plugins.logger.plugin import LoguruPlugin as Plugin -from boxv2.settings import BaseAppSettings +from asyncbox.plugins.logger.plugin import LoguruPlugin as Plugin +from asyncbox.settings import BaseAppSettings @pytest.mark.asyncio diff --git a/tests/test_plugins/test_redis/conftest.py b/tests/test_plugins/test_redis/conftest.py index e1ffcab..6440245 100644 --- a/tests/test_plugins/test_redis/conftest.py +++ b/tests/test_plugins/test_redis/conftest.py @@ -2,9 +2,9 @@ import pytest -from boxv2.plugins.redis.plugin import RedisPlugin as Plugin, Settings +from asyncbox.plugins.redis.plugin import RedisPlugin as Plugin, Settings -REDIS_DSN = environ["TEST_REDIS_DSN"] +REDIS_DSN = environ["REDIS_DSN"] class StateMock: @@ -18,7 +18,7 @@ class AppMock: @pytest.fixture() async def redis(): app = AppMock() - settings = Settings(REDIS_DSN=REDIS_DSN, REDIS_PREFIX="boxv2_test") + settings = Settings(REDIS_DSN=REDIS_DSN, REDIS_PREFIX="asyncbox_test") plugin = Plugin(settings, app, None) await plugin.on_startup() yield plugin.redis_repo diff --git a/tests/test_plugins/test_settings.py b/tests/test_plugins/test_settings.py index 2f4e7eb..747e830 100644 --- a/tests/test_plugins/test_settings.py +++ b/tests/test_plugins/test_settings.py @@ -3,8 +3,8 @@ import pytest from pydantic.error_wrappers import ValidationError -from boxv2.plugin import BasePlugin, BasePluginSettings -from boxv2.settings import BaseAppSettings +from asyncbox.plugin import BasePlugin, BasePluginSettings +from asyncbox.settings import BaseAppSettings class AppSettings(BaseAppSettings): diff --git a/tests/test_utils/test_mako.py b/tests/test_utils/test_mako.py index da34f2d..50e68e5 100644 --- a/tests/test_utils/test_mako.py +++ b/tests/test_utils/test_mako.py @@ -1,4 +1,4 @@ -from boxv2.utils.mako import TemplateFormatterLookup +from asyncbox.utils.mako import TemplateFormatterLookup def test_mako():