Skip to content

Commit

Permalink
Update tech stack (closes #119)
Browse files Browse the repository at this point in the history
* Use Py3.10 instead of Py3.9
* Use SQLAlchemy v2
  • Loading branch information
crazyscientist committed Feb 8, 2023
1 parent e1d6099 commit 8a65f26
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: "3.10"
- name: Cache pip
uses: actions/cache@v2
with:
Expand All @@ -47,10 +47,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: "3.10"
- name: Cache pip
uses: actions/cache@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9-slim
FROM python:3.10-slim

COPY . /opt/aimaas
RUN pip3 install -r /opt/aimaas/requirements.txt; \
Expand Down
3 changes: 1 addition & 2 deletions backend/database.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from fastapi import HTTPException
from starlette.status import HTTP_503_SERVICE_UNAVAILABLE
from sqlalchemy import create_engine, text
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm import declarative_base, sessionmaker

from .config import SQLALCHEMY_DATABASE_URL

Expand Down
2 changes: 1 addition & 1 deletion backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ pydantic<1.9.1
python-dotenv
python-jose[cryptography]
python-multipart
SQLAlchemy<2
SQLAlchemy
uvicorn
8 changes: 5 additions & 3 deletions backend/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from alembic.config import Config
from httpx._client import USE_CLIENT_DEFAULT
import pytest
from sqlalchemy import create_engine
from sqlalchemy import create_engine, text
from sqlalchemy.orm import sessionmaker
from fastapi.testclient import TestClient

Expand Down Expand Up @@ -304,14 +304,16 @@ def engine():
pool_timeout=5)
Base.metadata.drop_all(engine)
with engine.connect() as conn:
conn.execute("drop table if exists alembic_version")
conn.execute(text("drop table if exists alembic_version"))
conn.commit()
cfg = Config("alembic.ini")
command.upgrade(cfg, "head")

yield engine
Base.metadata.drop_all(engine)
with engine.connect() as conn:
conn.execute("drop table if exists alembic_version")
conn.execute(text("drop table if exists alembic_version"))
conn.commit()
engine.dispose()


Expand Down

0 comments on commit 8a65f26

Please sign in to comment.