Skip to content

Commit 92b9a5c

Browse files
Bump 2025 06 (#108)
* Bump the all-dependencies group with 36 updates Bumps the all-dependencies group with 36 updates: | Package | From | To | | --- | --- | --- | | [alembic](https://github.com/sqlalchemy/alembic) | `1.14.1` | `1.16.1` | | [fastapi](https://github.com/fastapi/fastapi) | `0.115.10` | `0.115.12` | | [pydantic](https://github.com/pydantic/pydantic) | `2.10.6` | `2.11.5` | | [pydantic-settings](https://github.com/pydantic/pydantic-settings) | `2.8.1` | `2.9.1` | | [sqlalchemy](https://github.com/sqlalchemy/sqlalchemy) | `2.0.38` | `2.0.41` | | [coverage](https://github.com/nedbat/coveragepy) | `7.6.12` | `7.8.2` | | [freezegun](https://github.com/spulec/freezegun) | `1.5.1` | `1.5.2` | | [greenlet](https://github.com/python-greenlet/greenlet) | `3.1.1` | `3.2.2` | | [mypy](https://github.com/python/mypy) | `1.15.0` | `1.16.0` | | [pre-commit](https://github.com/pre-commit/pre-commit) | `4.1.0` | `4.2.0` | | [pytest](https://github.com/pytest-dev/pytest) | `8.3.4` | `8.3.5` | | [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) | `0.25.3` | `0.26.0` | | [pytest-cov](https://github.com/pytest-dev/pytest-cov) | `6.0.0` | `6.1.1` | | [pytest-xdist](https://github.com/pytest-dev/pytest-xdist) | `3.6.1` | `3.7.0` | | [ruff](https://github.com/astral-sh/ruff) | `0.9.9` | `0.11.12` | | [uvicorn](https://github.com/encode/uvicorn) | `0.34.0` | `0.34.3` | | [anyio](https://github.com/agronholm/anyio) | `4.8.0` | `4.9.0` | | [certifi](https://github.com/certifi/python-certifi) | `2025.1.31` | `2025.4.26` | | [click](https://github.com/pallets/click) | `8.1.8` | `8.2.1` | | [filelock](https://github.com/tox-dev/py-filelock) | `3.17.0` | `3.18.0` | | [h11](https://github.com/python-hyper/h11) | `0.14.0` | `0.16.0` | | [httpcore](https://github.com/encode/httpcore) | `1.0.7` | `1.0.9` | | [identify](https://github.com/pre-commit/identify) | `2.6.8` | `2.6.12` | | [iniconfig](https://github.com/pytest-dev/iniconfig) | `2.0.0` | `2.1.0` | | [mako](https://github.com/sqlalchemy/mako) | `1.3.9` | `1.3.10` | | [mypy-extensions](https://github.com/python/mypy_extensions) | `1.0.0` | `1.1.0` | | [packaging](https://github.com/pypa/packaging) | `24.2` | `25.0` | | [platformdirs](https://github.com/tox-dev/platformdirs) | `4.3.6` | `4.3.8` | | [pluggy](https://github.com/pytest-dev/pluggy) | `1.5.0` | `1.6.0` | | [pydantic-core](https://github.com/pydantic/pydantic-core) | `2.27.2` | `2.33.2` | | [python-dotenv](https://github.com/theskumar/python-dotenv) | `1.0.1` | `1.1.0` | | [starlette](https://github.com/encode/starlette) | `0.46.0` | `0.46.2` | | [typing-extensions](https://github.com/python/typing_extensions) | `4.12.2` | `4.13.2` | | [virtualenv](https://github.com/pypa/virtualenv) | `20.29.2` | `20.31.2` | | [watchfiles](https://github.com/samuelcolvin/watchfiles) | `1.0.4` | `1.0.5` | | [websockets](https://github.com/python-websockets/websockets) | `15.0` | `15.0.1` | Updates `alembic` from 1.14.1 to 1.16.1 - [Release notes](https://github.com/sqlalchemy/alembic/releases) - [Changelog](https://github.com/sqlalchemy/alembic/blob/main/CHANGES) - [Commits](https://github.com/sqlalchemy/alembic/commits) Updates `fastapi` from 0.115.10 to 0.115.12 - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](fastapi/fastapi@0.115.10...0.115.12) Updates `pydantic` from 2.10.6 to 2.11.5 - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](pydantic/pydantic@v2.10.6...v2.11.5) Updates `pydantic-settings` from 2.8.1 to 2.9.1 - [Release notes](https://github.com/pydantic/pydantic-settings/releases) - [Commits](pydantic/pydantic-settings@v2.8.1...v2.9.1) Updates `sqlalchemy` from 2.0.38 to 2.0.41 - [Release notes](https://github.com/sqlalchemy/sqlalchemy/releases) - [Changelog](https://github.com/sqlalchemy/sqlalchemy/blob/main/CHANGES.rst) - [Commits](https://github.com/sqlalchemy/sqlalchemy/commits) Updates `coverage` from 7.6.12 to 7.8.2 - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](coveragepy/coveragepy@7.6.12...7.8.2) Updates `freezegun` from 1.5.1 to 1.5.2 - [Release notes](https://github.com/spulec/freezegun/releases) - [Changelog](https://github.com/spulec/freezegun/blob/master/CHANGELOG) - [Commits](spulec/freezegun@1.5.1...1.5.2) Updates `greenlet` from 3.1.1 to 3.2.2 - [Changelog](https://github.com/python-greenlet/greenlet/blob/master/CHANGES.rst) - [Commits](python-greenlet/greenlet@3.1.1...3.2.2) Updates `mypy` from 1.15.0 to 1.16.0 - [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md) - [Commits](python/mypy@v1.15.0...v1.16.0) Updates `pre-commit` from 4.1.0 to 4.2.0 - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](pre-commit/pre-commit@v4.1.0...v4.2.0) Updates `pytest` from 8.3.4 to 8.3.5 - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](pytest-dev/pytest@8.3.4...8.3.5) Updates `pytest-asyncio` from 0.25.3 to 0.26.0 - [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) - [Commits](pytest-dev/pytest-asyncio@v0.25.3...v0.26.0) Updates `pytest-cov` from 6.0.0 to 6.1.1 - [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst) - [Commits](pytest-dev/pytest-cov@v6.0.0...v6.1.1) Updates `pytest-xdist` from 3.6.1 to 3.7.0 - [Release notes](https://github.com/pytest-dev/pytest-xdist/releases) - [Changelog](https://github.com/pytest-dev/pytest-xdist/blob/master/CHANGELOG.rst) - [Commits](pytest-dev/pytest-xdist@v3.6.1...v3.7.0) Updates `ruff` from 0.9.9 to 0.11.12 - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](astral-sh/ruff@0.9.9...0.11.12) Updates `uvicorn` from 0.34.0 to 0.34.3 - [Release notes](https://github.com/encode/uvicorn/releases) - [Changelog](https://github.com/encode/uvicorn/blob/master/docs/release-notes.md) - [Commits](Kludex/uvicorn@0.34.0...0.34.3) Updates `anyio` from 4.8.0 to 4.9.0 - [Release notes](https://github.com/agronholm/anyio/releases) - [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst) - [Commits](agronholm/anyio@4.8.0...4.9.0) Updates `certifi` from 2025.1.31 to 2025.4.26 - [Commits](certifi/python-certifi@2025.01.31...2025.04.26) Updates `click` from 8.1.8 to 8.2.1 - [Release notes](https://github.com/pallets/click/releases) - [Changelog](https://github.com/pallets/click/blob/main/CHANGES.rst) - [Commits](pallets/click@8.1.8...8.2.1) Updates `filelock` from 3.17.0 to 3.18.0 - [Release notes](https://github.com/tox-dev/py-filelock/releases) - [Changelog](https://github.com/tox-dev/filelock/blob/main/docs/changelog.rst) - [Commits](tox-dev/filelock@3.17.0...3.18.0) Updates `h11` from 0.14.0 to 0.16.0 - [Commits](python-hyper/h11@v0.14.0...v0.16.0) Updates `httpcore` from 1.0.7 to 1.0.9 - [Release notes](https://github.com/encode/httpcore/releases) - [Changelog](https://github.com/encode/httpcore/blob/master/CHANGELOG.md) - [Commits](encode/httpcore@1.0.7...1.0.9) Updates `identify` from 2.6.8 to 2.6.12 - [Commits](pre-commit/identify@v2.6.8...v2.6.12) Updates `iniconfig` from 2.0.0 to 2.1.0 - [Release notes](https://github.com/pytest-dev/iniconfig/releases) - [Changelog](https://github.com/pytest-dev/iniconfig/blob/main/CHANGELOG) - [Commits](pytest-dev/iniconfig@v2.0.0...v2.1.0) Updates `mako` from 1.3.9 to 1.3.10 - [Release notes](https://github.com/sqlalchemy/mako/releases) - [Changelog](https://github.com/sqlalchemy/mako/blob/main/CHANGES) - [Commits](https://github.com/sqlalchemy/mako/commits) Updates `mypy-extensions` from 1.0.0 to 1.1.0 - [Commits](python/mypy_extensions@1.0.0...1.1.0) Updates `packaging` from 24.2 to 25.0 - [Release notes](https://github.com/pypa/packaging/releases) - [Changelog](https://github.com/pypa/packaging/blob/main/CHANGELOG.rst) - [Commits](pypa/packaging@24.2...25.0) Updates `platformdirs` from 4.3.6 to 4.3.8 - [Release notes](https://github.com/tox-dev/platformdirs/releases) - [Changelog](https://github.com/tox-dev/platformdirs/blob/main/CHANGES.rst) - [Commits](tox-dev/platformdirs@4.3.6...4.3.8) Updates `pluggy` from 1.5.0 to 1.6.0 - [Changelog](https://github.com/pytest-dev/pluggy/blob/main/CHANGELOG.rst) - [Commits](pytest-dev/pluggy@1.5.0...1.6.0) Updates `pydantic-core` from 2.27.2 to 2.33.2 - [Release notes](https://github.com/pydantic/pydantic-core/releases) - [Commits](pydantic/pydantic-core@v2.27.2...v2.33.2) Updates `python-dotenv` from 1.0.1 to 1.1.0 - [Release notes](https://github.com/theskumar/python-dotenv/releases) - [Changelog](https://github.com/theskumar/python-dotenv/blob/main/CHANGELOG.md) - [Commits](theskumar/python-dotenv@v1.0.1...v1.1.0) Updates `starlette` from 0.46.0 to 0.46.2 - [Release notes](https://github.com/encode/starlette/releases) - [Changelog](https://github.com/encode/starlette/blob/master/docs/release-notes.md) - [Commits](Kludex/starlette@0.46.0...0.46.2) Updates `typing-extensions` from 4.12.2 to 4.13.2 - [Release notes](https://github.com/python/typing_extensions/releases) - [Changelog](https://github.com/python/typing_extensions/blob/main/CHANGELOG.md) - [Commits](python/typing_extensions@4.12.2...4.13.2) Updates `virtualenv` from 20.29.2 to 20.31.2 - [Release notes](https://github.com/pypa/virtualenv/releases) - [Changelog](https://github.com/pypa/virtualenv/blob/main/docs/changelog.rst) - [Commits](pypa/virtualenv@20.29.2...20.31.2) Updates `watchfiles` from 1.0.4 to 1.0.5 - [Release notes](https://github.com/samuelcolvin/watchfiles/releases) - [Commits](samuelcolvin/watchfiles@v1.0.4...v1.0.5) Updates `websockets` from 15.0 to 15.0.1 - [Release notes](https://github.com/python-websockets/websockets/releases) - [Commits](python-websockets/websockets@15.0...15.0.1) --- updated-dependencies: - dependency-name: alembic dependency-version: 1.16.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: fastapi dependency-version: 0.115.12 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: all-dependencies - dependency-name: pydantic dependency-version: 2.11.5 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: pydantic-settings dependency-version: 2.9.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: sqlalchemy dependency-version: 2.0.41 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: all-dependencies - dependency-name: coverage dependency-version: 7.8.2 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: freezegun dependency-version: 1.5.2 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: all-dependencies - dependency-name: greenlet dependency-version: 3.2.2 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: mypy dependency-version: 1.16.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: pre-commit dependency-version: 4.2.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: pytest dependency-version: 8.3.5 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: all-dependencies - dependency-name: pytest-asyncio dependency-version: 0.26.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: pytest-cov dependency-version: 6.1.1 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: pytest-xdist dependency-version: 3.7.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: ruff dependency-version: 0.11.12 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: uvicorn dependency-version: 0.34.3 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: all-dependencies - dependency-name: anyio dependency-version: 4.9.0 dependency-type: indirect update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: certifi dependency-version: 2025.4.26 dependency-type: indirect update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: click dependency-version: 8.2.1 dependency-type: indirect update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: filelock dependency-version: 3.18.0 dependency-type: indirect update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: h11 dependency-version: 0.16.0 dependency-type: indirect update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: httpcore dependency-version: 1.0.9 dependency-type: indirect update-type: version-update:semver-patch dependency-group: all-dependencies - dependency-name: identify dependency-version: 2.6.12 dependency-type: indirect update-type: version-update:semver-patch dependency-group: all-dependencies - dependency-name: iniconfig dependency-version: 2.1.0 dependency-type: indirect update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: mako dependency-version: 1.3.10 dependency-type: indirect update-type: version-update:semver-patch dependency-group: all-dependencies - dependency-name: mypy-extensions dependency-version: 1.1.0 dependency-type: indirect update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: packaging dependency-version: '25.0' dependency-type: indirect update-type: version-update:semver-major dependency-group: all-dependencies - dependency-name: platformdirs dependency-version: 4.3.8 dependency-type: indirect update-type: version-update:semver-patch dependency-group: all-dependencies - dependency-name: pluggy dependency-version: 1.6.0 dependency-type: indirect update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: pydantic-core dependency-version: 2.33.2 dependency-type: indirect update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: python-dotenv dependency-version: 1.1.0 dependency-type: indirect update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: starlette dependency-version: 0.46.2 dependency-type: indirect update-type: version-update:semver-patch dependency-group: all-dependencies - dependency-name: typing-extensions dependency-version: 4.13.2 dependency-type: indirect update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: virtualenv dependency-version: 20.31.2 dependency-type: indirect update-type: version-update:semver-minor dependency-group: all-dependencies - dependency-name: watchfiles dependency-version: 1.0.5 dependency-type: indirect update-type: version-update:semver-patch dependency-group: all-dependencies - dependency-name: websockets dependency-version: 15.0.1 dependency-type: indirect update-type: version-update:semver-patch dependency-group: all-dependencies ... Signed-off-by: dependabot[bot] <support@github.com> * poetry bump Signed-off-by: rafsaf <rafal.safin@rafsaf.pl> * bump pre-commit Signed-off-by: rafsaf <rafal.safin@rafsaf.pl> * fix alembic migration and dockerfile Signed-off-by: rafsaf <rafal.safin@rafsaf.pl> * fix fixture_default_user_headers Signed-off-by: rafsaf <rafal.safin@rafsaf.pl> * imrpove config setup to work without .env file Signed-off-by: rafsaf <rafal.safin@rafsaf.pl> * fix mypy - unused comment Signed-off-by: rafsaf <rafal.safin@rafsaf.pl> * final fixes to dockerfile Signed-off-by: rafsaf <rafal.safin@rafsaf.pl> --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: rafsaf <rafal.safin@rafsaf.pl> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 577824e commit 92b9a5c

9 files changed

Lines changed: 804 additions & 682 deletions

File tree

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ repos:
55
- id: check-yaml
66

77
- repo: https://github.com/astral-sh/ruff-pre-commit
8-
rev: v0.8.2
8+
rev: v0.11.12
99
hooks:
1010
- id: ruff-format
1111

1212
- repo: https://github.com/astral-sh/ruff-pre-commit
13-
rev: v0.8.2
13+
rev: v0.11.12
1414
hooks:
1515
- id: ruff
1616
args: [--fix]

Dockerfile

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
FROM python:3.13.3-slim-bookworm as base
1+
FROM python:3.13.3-slim-bookworm AS base
22

3-
ENV PYTHONUNBUFFERED 1
3+
ENV PYTHONUNBUFFERED=1
44
WORKDIR /build
55

66
# Create requirements.txt file
7-
FROM base as poetry
8-
RUN pip install poetry==1.8.2
7+
FROM base AS poetry
8+
RUN pip install poetry==2.1.3
9+
RUN poetry self add poetry-plugin-export
910
COPY poetry.lock pyproject.toml ./
1011
RUN poetry export -o /requirements.txt --without-hashes
1112

12-
FROM base as common
13+
FROM base AS final
1314
COPY --from=poetry /requirements.txt .
15+
1416
# Create venv, add it to path and install requirements
1517
RUN python -m venv /venv
1618
ENV PATH="/venv/bin:$PATH"
@@ -26,12 +28,15 @@ COPY alembic.ini .
2628
COPY pyproject.toml .
2729
COPY init.sh .
2830

29-
# Create new user to run app process as unprivilaged user
30-
RUN addgroup --gid 1001 --system uvicorn && \
31-
adduser --gid 1001 --shell /bin/false --disabled-password --uid 1001 uvicorn
31+
# Expose port
32+
EXPOSE 8000
33+
34+
# Make the init script executable
35+
RUN chmod +x ./init.sh
36+
37+
# Set ENTRYPOINT to always run init.sh
38+
ENTRYPOINT ["./init.sh"]
3239

33-
# Run init.sh script then start uvicorn
34-
RUN chown -R uvicorn:uvicorn /build
35-
CMD bash init.sh && \
36-
runuser -u uvicorn -- /venv/bin/uvicorn app.main:app --app-dir /build --host 0.0.0.0 --port 8000 --workers 2 --loop uvloop
37-
EXPOSE 8000
40+
# Set CMD to uvicorn
41+
# /venv/bin/uvicorn is used because from entrypoint script PATH is new
42+
CMD ["/venv/bin/uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "2", "--loop", "uvloop"]

alembic.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ script_location = alembic
66

77
# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
88
# Uncomment the line below if you want the files to be prepended with date and time
9-
file_template = %%(year)d%%(month).2d%%(day).2d%%(minute).2d_%%(slug)s_%%(rev)s
9+
file_template = %%(year)d%%(month).2d%%(day).2d_%%(hour).2d%%(minute).2d_%%(slug)s_%%(rev)s
1010

1111
# sys.path path, will be prepended to sys.path if present.
1212
# defaults to the current working directory.

alembic/versions/2024030345_init_user_and_refresh_token_c79b0938ea4b.py renamed to alembic/versions/20250602_2142_initial_migration_be24780c0da0.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
"""init user and refresh token
1+
"""initial_migration
22
3-
Revision ID: c79b0938ea4b
3+
Revision ID: be24780c0da0
44
Revises:
5-
Create Date: 2024-03-03 11:45:21.361225
5+
Create Date: 2025-06-02 21:42:16.031375
66
77
"""
88

@@ -11,7 +11,7 @@
1111
from alembic import op
1212

1313
# revision identifiers, used by Alembic.
14-
revision = "c79b0938ea4b"
14+
revision = "be24780c0da0"
1515
down_revision = None
1616
branch_labels = None
1717
depends_on = None

app/core/config.py

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
# Note, complex types like lists are read as json-encoded strings.
1515

1616

17+
import logging.config
1718
from functools import lru_cache
1819
from pathlib import Path
1920

20-
from pydantic import AnyHttpUrl, BaseModel, SecretStr, computed_field
21+
from pydantic import AnyHttpUrl, BaseModel, Field, SecretStr, computed_field
2122
from pydantic_settings import BaseSettings, SettingsConfigDict
2223
from sqlalchemy.engine.url import URL
2324

@@ -26,7 +27,7 @@
2627

2728
class Security(BaseModel):
2829
jwt_issuer: str = "my-app"
29-
jwt_secret_key: SecretStr
30+
jwt_secret_key: SecretStr = SecretStr("sk-change-me")
3031
jwt_access_token_expire_secs: int = 24 * 3600 # 1d
3132
refresh_token_expire_secs: int = 28 * 24 * 3600 # 28d
3233
password_bcrypt_rounds: int = 12
@@ -37,14 +38,15 @@ class Security(BaseModel):
3738
class Database(BaseModel):
3839
hostname: str = "postgres"
3940
username: str = "postgres"
40-
password: SecretStr
41+
password: SecretStr = SecretStr("passwd-change-me")
4142
port: int = 5432
4243
db: str = "postgres"
4344

4445

4546
class Settings(BaseSettings):
46-
security: Security
47-
database: Database
47+
security: Security = Field(default_factory=Security)
48+
database: Database = Field(default_factory=Database)
49+
log_level: str = "INFO"
4850

4951
@computed_field # type: ignore[prop-decorator]
5052
@property
@@ -67,4 +69,35 @@ def sqlalchemy_database_uri(self) -> URL:
6769

6870
@lru_cache(maxsize=1)
6971
def get_settings() -> Settings:
70-
return Settings() # type: ignore
72+
return Settings()
73+
74+
75+
def logging_config(log_level: str) -> None:
76+
conf = {
77+
"version": 1,
78+
"disable_existing_loggers": False,
79+
"formatters": {
80+
"verbose": {
81+
"format": "{asctime} [{levelname}] {name}: {message}",
82+
"style": "{",
83+
},
84+
},
85+
"handlers": {
86+
"stream": {
87+
"class": "logging.StreamHandler",
88+
"formatter": "verbose",
89+
"level": "DEBUG",
90+
},
91+
},
92+
"loggers": {
93+
"": {
94+
"level": log_level,
95+
"handlers": ["stream"],
96+
"propagate": True,
97+
},
98+
},
99+
}
100+
logging.config.dictConfig(conf)
101+
102+
103+
logging_config(log_level=get_settings().log_level)

app/tests/conftest.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,6 @@
2424
default_user_access_token = create_jwt_token(default_user_id).access_token
2525

2626

27-
# @pytest.fixture(scope="session")
28-
# def event_loop_policy():
29-
# return uvloop.EventLoopPolicy()
30-
31-
32-
# @pytest.fixture(scope="session")
33-
# def event_loop() -> Generator[asyncio.AbstractEventLoop, None, None]:
34-
# loop = asyncio.new_event_loop()
35-
# asyncio.set_event_loop(loop)
36-
# yield loop
37-
# loop.close()
38-
39-
4027
@pytest_asyncio.fixture(scope="session", autouse=True)
4128
async def fixture_setup_new_test_database() -> None:
4229
worker_name = os.getenv("PYTEST_XDIST_WORKER", "gw0")
@@ -139,5 +126,5 @@ async def fixture_default_user(
139126

140127

141128
@pytest_asyncio.fixture(name="default_user_headers", scope="function")
142-
def fixture_default_user_headers(default_user: User) -> dict[str, str]:
129+
async def fixture_default_user_headers(default_user: User) -> dict[str, str]:
143130
return {"Authorization": f"Bearer {default_user_access_token}"}

init.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
#!/bin/bash
2+
set -e
23

34
echo "Run migrations"
45
alembic upgrade head
6+
7+
# Run whatever CMD was passed
8+
exec "$@"

0 commit comments

Comments
 (0)