From ce549944a92c079dd0d6e5b8cd3e6593198864da Mon Sep 17 00:00:00 2001 From: Roberto Prevato Date: Wed, 30 Nov 2022 19:20:33 +0100 Subject: [PATCH] Workflow maintenance, apply isort and black (#3) --- .github/workflows/build.yml | 18 +---- blacksheepsqlalchemy/__init__.py | 6 +- dev-requirements.txt | 81 +++++++++---------- tests/app.py | 2 +- tests/migrations/env.py | 4 +- .../versions/ae4207a54d40_structure.py | 3 +- tests/test_blacksheepsqlalchemy.py | 8 +- 7 files changed, 52 insertions(+), 70 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e5b091c..4e5d58f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,8 +18,9 @@ jobs: build: runs-on: ubuntu-18.04 strategy: + fail-fast: false matrix: - python-version: [3.7, 3.8, 3.9] + python-version: [3.8, 3.9, "3.10", "3.11"] steps: - uses: actions/checkout@v1 @@ -28,24 +29,13 @@ jobs: submodules: false - name: Use Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - - uses: actions/cache@v1 - id: depcache - with: - path: deps - key: requirements-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }} - - - name: Download dependencies - if: steps.depcache.outputs.cache-hit != 'true' - run: | - pip download --dest=deps -r dev-requirements.txt - - name: Install dependencies run: | - pip install -U --no-index --find-links=deps deps/* + pip install -r dev-requirements.txt - name: Prepare test database run: | diff --git a/blacksheepsqlalchemy/__init__.py b/blacksheepsqlalchemy/__init__.py index b1ee30c..057ac01 100644 --- a/blacksheepsqlalchemy/__init__.py +++ b/blacksheepsqlalchemy/__init__.py @@ -1,12 +1,12 @@ from typing import Optional +from blacksheep.server import Application from sqlalchemy.ext.asyncio import ( - create_async_engine, + AsyncConnection, AsyncEngine, AsyncSession, - AsyncConnection, + create_async_engine, ) -from blacksheep.server import Application def __configure_services( diff --git a/dev-requirements.txt b/dev-requirements.txt index fb00e92..a7710a9 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,49 +1,42 @@ aiosqlite==0.17.0 -alembic==1.6.3 -appdirs==1.4.4 -asyncpg==0.23.0 -attrs==21.2.0 -black==21.5b1 -blacksheep==1.0.5 -cchardet==2.1.7 -certifi==2020.12.5 -click==7.1.2 -coverage==5.5 -essentials==1.1.4 -essentials-openapi==0.1.2 -flake8==3.9.2 -greenlet==1.1.0 -guardpost==0.0.7 -h11==0.12.0 -httptools==0.2.0 +alembic==1.8.1 +attrs==22.1.0 +black==22.10.0 +blacksheep==1.2.8 +certifi==2022.9.24 +click==8.1.3 +coverage==6.5.0 +essentials==1.1.5 +essentials-openapi==0.1.6 +exceptiongroup==1.0.4 +flake8==6.0.0 +greenlet==2.0.1 +guardpost==0.0.9 +h11==0.14.0 +httptools==0.5.0 iniconfig==1.1.1 -itsdangerous==1.1.0 -Jinja2==2.11.3 -Mako==1.1.4 -MarkupSafe==2.0.1 -mccabe==0.6.1 -mypy==0.812 +isort==5.10.1 +itsdangerous==2.1.2 +Jinja2==3.1.2 +Mako==1.2.4 +MarkupSafe==2.1.1 +mccabe==0.7.0 mypy-extensions==0.4.3 -packaging==20.9 -pathspec==0.8.1 -pluggy==0.13.1 -py==1.10.0 -pycodestyle==2.7.0 -pyflakes==2.3.1 -pyparsing==2.4.7 -pytest==6.2.4 -pytest-asyncio==0.15.1 -pytest-cov==2.12.0 -python-dateutil==2.8.1 -python-editor==1.0.4 +packaging==21.3 +pathspec==0.10.2 +platformdirs==2.5.4 +pluggy==1.0.0 +pycodestyle==2.10.0 +pyflakes==3.0.1 +pyparsing==3.0.9 +pytest==7.2.0 +pytest-asyncio==0.20.2 +pytest-cov==4.0.0 +python-dateutil==2.8.2 PyYAML==5.4.1 -regex==2021.4.4 -rodi==1.1.1 +rodi==1.1.3 six==1.16.0 -SQLAlchemy==1.4.15 -sqlalchemy-stubs==0.4 -sqlalchemy2-stubs==0.0.2a1 -toml==0.10.2 -typed-ast==1.4.3 -typing-extensions==3.10.0.0 -uvicorn==0.13.4 +SQLAlchemy==1.4.44 +tomli==2.0.1 +typing_extensions==4.4.0 +uvicorn==0.20.0 diff --git a/tests/app.py b/tests/app.py index f4f964b..162c2d9 100644 --- a/tests/app.py +++ b/tests/app.py @@ -12,11 +12,11 @@ from blacksheep.messages import Response from blacksheep.server import Application from blacksheep.server.openapi.v3 import OpenAPIHandler -from blacksheepsqlalchemy import use_sqlalchemy from openapidocs.v3 import Info from sqlalchemy import delete as sql_delete from sqlalchemy import text +from blacksheepsqlalchemy import use_sqlalchemy from tests.domain import Country app = Application(show_error_details=True) diff --git a/tests/migrations/env.py b/tests/migrations/env.py index 9e9d8a1..490728f 100644 --- a/tests/migrations/env.py +++ b/tests/migrations/env.py @@ -1,10 +1,8 @@ import sys from logging.config import fileConfig -from sqlalchemy import engine_from_config -from sqlalchemy import pool - from alembic import context +from sqlalchemy import engine_from_config, pool # hack to keep example code inside the tests folder without polluting the root folder # of the repository diff --git a/tests/migrations/versions/ae4207a54d40_structure.py b/tests/migrations/versions/ae4207a54d40_structure.py index 7bd53ea..e65e332 100644 --- a/tests/migrations/versions/ae4207a54d40_structure.py +++ b/tests/migrations/versions/ae4207a54d40_structure.py @@ -5,9 +5,8 @@ Create Date: 2021-05-22 09:54:27.486818 """ -from alembic import op import sqlalchemy as sa - +from alembic import op # revision identifiers, used by Alembic. revision = "ae4207a54d40" diff --git a/tests/test_blacksheepsqlalchemy.py b/tests/test_blacksheepsqlalchemy.py index 4bb0889..3b17e73 100644 --- a/tests/test_blacksheepsqlalchemy.py +++ b/tests/test_blacksheepsqlalchemy.py @@ -1,10 +1,12 @@ -from blacksheep.contents import JSONContent import pytest -from .fixtures import * # NoQA -from blacksheep.server import Application from blacksheep.client import ClientSession +from blacksheep.contents import JSONContent +from blacksheep.server import Application + from blacksheepsqlalchemy import use_sqlalchemy +from .fixtures import * # NoQA + async def insert_fetch_delete_scenario( client_session: ClientSession, option: str, country_code: str, country_name: str