Update deps and lint

This commit is contained in:
2023-05-09 22:53:53 +02:00
parent 0c4d3c2871
commit bc991e8148
10 changed files with 625 additions and 621 deletions

View File

@@ -2,18 +2,17 @@ exclude: 'docs|node_modules|migrations|.git|.tox'
repos: repos:
- repo: https://github.com/ambv/black - repo: https://github.com/ambv/black
rev: 22.12.0 rev: 23.3.0
hooks: hooks:
- id: black - id: black
language_version: python3.11 language_version: python3.11
- repo: https://github.com/charliermarsh/ruff-pre-commit - repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.216' rev: 'v0.0.265'
hooks: hooks:
- id: ruff - id: ruff
args: ["--force-exclude"]
- repo: https://github.com/crate-ci/typos - repo: https://github.com/crate-ci/typos
rev: v1.13.6 rev: typos-dict-v0.9.26
hooks: hooks:
- id: typos - id: typos

1196
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -6,24 +6,24 @@ authors = ["Kurbanov Bulat <kurbanovbul@gmail.com>"]
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.11" python = "^3.11"
fastapi = "^0.95.0" fastapi = "^0.95.1"
fastapi-pagination = {extras = ["ormar"], version = "^0.11.4"} fastapi-pagination = {extras = ["ormar"], version = "^0.12.3"}
alembic = "^1.10.2" alembic = "^1.10.4"
ormar = {extras = ["postgresql"], version = "^0.12.1"} ormar = {extras = ["postgresql"], version = "^0.12.1"}
uvicorn = {extras = ["standard"], version = "^0.21.1"} uvicorn = {extras = ["standard"], version = "^0.22.0"}
httpx = "^0.23.3" httpx = "^0.24.0"
orjson = "^3.8.8" orjson = "^3.8.12"
prometheus-fastapi-instrumentator = "^6.0.0" prometheus-fastapi-instrumentator = "^6.0.0"
uvloop = "^0.17.0" uvloop = "^0.17.0"
gunicorn = "^20.1.0" gunicorn = "^20.1.0"
sentry-sdk = "^1.17.0" sentry-sdk = "^1.22.2"
redis = {extras = ["hiredis"], version = "^4.5.4"} redis = {extras = ["hiredis"], version = "^4.5.5"}
ormsgpack = "^1.2.5" ormsgpack = "^1.2.6"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
pre-commit = "^2.21.0" pre-commit = "^3.3.1"
[build-system] [build-system]
requires = ["poetry-core>=1.0.0"] requires = ["poetry-core>=1.0.0"]
@@ -65,14 +65,13 @@ max-complexity = 15
[tool.ruff.isort] [tool.ruff.isort]
known-first-party = ["core", "app"] known-first-party = ["core", "app"]
force-sort-within-sections = true force-sort-within-sections = true
force-wrap-aliases = true
section-order = ["future", "standard-library", "base_framework", "framework_ext", "third-party", "first-party", "local-folder"]
lines-after-imports = 2
# only_sections = true [tool.ruff.isort.sections]
# force_sort_within_sections = true base_framework = ["fastapi",]
# lines_after_imports = 2 framework_ext = ["starlette"]
# lexicographical = true
# sections = ["FUTURE", "STDLIB", "BASEFRAMEWORK", "FRAMEWORKEXT", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
# known_baseframework = ["fastapi",]
# known_frameworkext = ["starlette",]
[tool.ruff.pyupgrade] [tool.ruff.pyupgrade]
keep-runtime-typing = true keep-runtime-typing = true

View File

@@ -1,5 +1,6 @@
import httpx import httpx
response = httpx.get("http://localhost:8080/healthcheck") response = httpx.get("http://localhost:8080/healthcheck")
print(f"HEALTHCHECK STATUS: {response.status_code}") print(f"HEALTHCHECK STATUS: {response.status_code}")
exit(0 if response.status_code == 200 else 1) exit(0 if response.status_code == 200 else 1)

View File

@@ -1,6 +1,7 @@
from typing import Optional, Union from typing import Optional, Union
from fastapi import HTTPException, status from fastapi import HTTPException, status
import ormsgpack import ormsgpack
from redis import asyncio as aioredis from redis import asyncio as aioredis

View File

@@ -1,7 +1,8 @@
from datetime import datetime from datetime import datetime
from asyncpg.exceptions import UniqueViolationError
from fastapi import APIRouter, Depends, HTTPException, Request, status from fastapi import APIRouter, Depends, HTTPException, Request, status
from asyncpg.exceptions import UniqueViolationError
from fastapi_pagination import Page, Params from fastapi_pagination import Page, Params
from fastapi_pagination.ext.ormar import paginate from fastapi_pagination.ext.ormar import paginate
from redis import asyncio as aioredis from redis import asyncio as aioredis
@@ -17,6 +18,7 @@ from app.serializers import (
) )
from app.services.users_data_manager import UsersDataManager from app.services.users_data_manager import UsersDataManager
users_router = APIRouter( users_router = APIRouter(
prefix="/users", tags=["users"], dependencies=[Depends(check_token)] prefix="/users", tags=["users"], dependencies=[Depends(check_token)]
) )

View File

@@ -1,5 +1,6 @@
from fastapi import FastAPI from fastapi import FastAPI
from fastapi.responses import ORJSONResponse from fastapi.responses import ORJSONResponse
from fastapi_pagination import add_pagination from fastapi_pagination import add_pagination
from prometheus_fastapi_instrumentator import Instrumentator from prometheus_fastapi_instrumentator import Instrumentator
from redis import asyncio as aioredis from redis import asyncio as aioredis

View File

@@ -1,3 +1,4 @@
from fastapi.security import APIKeyHeader from fastapi.security import APIKeyHeader
default_security = APIKeyHeader(name="Authorization") default_security = APIKeyHeader(name="Authorization")

View File

@@ -5,6 +5,7 @@ from sqlalchemy import MetaData
from core.config import env_config from core.config import env_config
DATABASE_URL = ( DATABASE_URL = (
f"postgresql://{env_config.POSTGRES_USER}:{quote(env_config.POSTGRES_PASSWORD)}@" f"postgresql://{env_config.POSTGRES_USER}:{quote(env_config.POSTGRES_PASSWORD)}@"
f"{env_config.POSTGRES_HOST}:{env_config.POSTGRES_PORT}/{env_config.POSTGRES_DB}" f"{env_config.POSTGRES_HOST}:{env_config.POSTGRES_PORT}/{env_config.POSTGRES_DB}"

View File

@@ -4,6 +4,7 @@ from sentry_sdk.integrations.asgi import SentryAsgiMiddleware
from core.app import start_app from core.app import start_app
from core.config import env_config from core.config import env_config
sentry_sdk.init(dsn=env_config.SENTRY_SDN) sentry_sdk.init(dsn=env_config.SENTRY_SDN)
app = SentryAsgiMiddleware(start_app()) app = SentryAsgiMiddleware(start_app())