Skip to content

Commit 76a8c3b

Browse files
committed
update repo
1 parent 3dc170b commit 76a8c3b

File tree

9 files changed

+362
-37
lines changed

9 files changed

+362
-37
lines changed

backend/.dockerignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
__pycache__/
2+
*.pyc
3+
*.pyo
4+
*.db
5+
*.sqlite3
6+
.env
7+
.git
8+
.gitignore
9+
Dockerfile
10+
docker-compose.yml
11+
README.md

backend/Dockerfile

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
# backend/Dockerfile
2-
FROM python:3.9-slim
2+
FROM python:3.10-slim
33

4+
# Set working directory
45
WORKDIR /app
56

7+
# Install system dependencies (for packages like psycopg2, etc.)
8+
RUN apt-get update && apt-get install -y --no-install-recommends \
9+
build-essential gcc \
10+
&& rm -rf /var/lib/apt/lists/*
11+
12+
# Upgrade pip and setuptools for better package handling
13+
RUN pip install --upgrade pip setuptools
14+
15+
# Copy only requirements first to leverage Docker cache
616
COPY requirements.txt .
17+
18+
# Install Python dependencies
719
RUN pip install --no-cache-dir -r requirements.txt
820

21+
# Copy the rest of the application
922
COPY . .
1023

11-
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
24+
# Set entrypoint and default command
25+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
26+

backend/alembic/README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Generic single-database configuration.

backend/alembic/env.py

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
from logging.config import fileConfig
2+
3+
from sqlalchemy import engine_from_config
4+
from sqlalchemy import pool
5+
6+
from alembic import context
7+
8+
# this is the Alembic Config object, which provides
9+
# access to the values within the .ini file in use.
10+
config = context.config
11+
12+
# Interpret the config file for Python logging.
13+
# This line sets up loggers basically.
14+
if config.config_file_name is not None:
15+
fileConfig(config.config_file_name)
16+
17+
# add your model's MetaData object here
18+
# for 'autogenerate' support
19+
# from myapp import mymodel
20+
# target_metadata = mymodel.Base.metadata
21+
target_metadata = None
22+
23+
# other values from the config, defined by the needs of env.py,
24+
# can be acquired:
25+
# my_important_option = config.get_main_option("my_important_option")
26+
# ... etc.
27+
28+
29+
def run_migrations_offline() -> None:
30+
"""Run migrations in 'offline' mode.
31+
32+
This configures the context with just a URL
33+
and not an Engine, though an Engine is acceptable
34+
here as well. By skipping the Engine creation
35+
we don't even need a DBAPI to be available.
36+
37+
Calls to context.execute() here emit the given string to the
38+
script output.
39+
40+
"""
41+
url = config.get_main_option("sqlalchemy.url")
42+
context.configure(
43+
url=url,
44+
target_metadata=target_metadata,
45+
literal_binds=True,
46+
dialect_opts={"paramstyle": "named"},
47+
)
48+
49+
with context.begin_transaction():
50+
context.run_migrations()
51+
52+
53+
def run_migrations_online() -> None:
54+
"""Run migrations in 'online' mode.
55+
56+
In this scenario we need to create an Engine
57+
and associate a connection with the context.
58+
59+
"""
60+
connectable = engine_from_config(
61+
config.get_section(config.config_ini_section, {}),
62+
prefix="sqlalchemy.",
63+
poolclass=pool.NullPool,
64+
)
65+
66+
with connectable.connect() as connection:
67+
context.configure(
68+
connection=connection, target_metadata=target_metadata
69+
)
70+
71+
with context.begin_transaction():
72+
context.run_migrations()
73+
74+
75+
if context.is_offline_mode():
76+
run_migrations_offline()
77+
else:
78+
run_migrations_online()

backend/alembic/script.py.mako

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""${message}
2+
3+
Revision ID: ${up_revision}
4+
Revises: ${down_revision | comma,n}
5+
Create Date: ${create_date}
6+
7+
"""
8+
from typing import Sequence, Union
9+
10+
from alembic import op
11+
import sqlalchemy as sa
12+
${imports if imports else ""}
13+
14+
# revision identifiers, used by Alembic.
15+
revision: str = ${repr(up_revision)}
16+
down_revision: Union[str, None] = ${repr(down_revision)}
17+
branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
18+
depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}
19+
20+
21+
def upgrade() -> None:
22+
"""Upgrade schema."""
23+
${upgrades if upgrades else "pass"}
24+
25+
26+
def downgrade() -> None:
27+
"""Downgrade schema."""
28+
${downgrades if downgrades else "pass"}

backend/app/models/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from sqlalchemy.orm import declarative_base
2+
3+
Base = declarative_base()

backend/docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# backend/docker-compose.yml
2-
version: '3.8'
3-
42
services:
53
web:
64
build: .

backend/requirements.txt

Lines changed: 175 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,177 @@
1+
aiohappyeyeballs==2.6.1
2+
aiohttp==3.12.6
3+
aiosignal==1.3.2
4+
anyio==4.6.0
5+
argcomplete==3.5.0
6+
argon2-cffi==23.1.0
7+
argon2-cffi-bindings==21.2.0
8+
arrow==1.3.0
9+
asttokens==2.4.1
10+
async-lru==2.0.4
11+
attrs==24.2.0
12+
Automat==24.8.1
13+
babel==2.16.0
14+
beautifulsoup4==4.12.3
15+
bleach==6.1.0
16+
blinker==1.9.0
17+
bs4==0.0.2
18+
certifi==2024.8.30
19+
cffi==1.17.1
20+
charset-normalizer==3.3.2
21+
click==8.1.7
22+
colorama==0.4.6
23+
comm==0.2.2
24+
constantly==23.10.4
25+
contourpy==1.3.0
26+
cryptography==43.0.1
27+
cssselect==1.2.0
28+
cycler==0.12.1
29+
dash==2.18.2
30+
dash-core-components==2.0.0
31+
dash-html-components==2.0.0
32+
dash-table==5.0.0
33+
debugpy==1.8.6
34+
decorator==5.1.1
35+
defusedxml==0.7.1
36+
distlib==0.3.8
37+
executing==2.1.0
38+
Faker==30.0.0
39+
fastjsonschema==2.20.0
140
fastapi==0.95.2
41+
filelock==3.15.4
42+
Flask==3.0.3
43+
fonttools==4.54.1
44+
fpdf==1.7.2
45+
fqdn==1.5.1
46+
frozenlist==1.6.0
47+
h11==0.14.0
48+
httpcore==1.0.6
49+
httpx==0.27.2
50+
hyperlink==21.0.0
51+
idna==3.10
52+
importlib_metadata==8.6.1
53+
incremental==24.7.2
54+
ipykernel==6.29.5
55+
ipython
56+
isoduration==20.11.0
57+
itemadapter==0.9.0
58+
itemloaders==1.3.1
59+
itsdangerous==2.2.0
60+
jedi==0.19.1
61+
Jinja2==3.1.4
62+
jmespath==1.0.1
63+
joblib==1.4.2
64+
json5==0.9.25
65+
jsonpointer==3.0.0
66+
jsonschema==4.23.0
67+
jsonschema-specifications==2023.12.1
68+
jupyter-events==0.10.0
69+
jupyter-lsp==2.2.5
70+
jupyter_client==8.6.3
71+
jupyter_core==5.7.2
72+
jupyter_server==2.14.2
73+
jupyter_server_terminals==0.5.3
74+
jupyterlab==4.2.5
75+
jupyterlab_pygments==0.3.0
76+
jupyterlab_server==2.27.3
77+
kiwisolver==1.4.7
78+
Levenshtein==0.27.1
79+
lxml==5.3.0
80+
MarkupSafe==2.1.5
81+
matplotlib==3.9.2
82+
matplotlib-inline==0.1.7
83+
mistune==3.0.2
84+
multidict==6.4.4
85+
mysql-connector-python==9.0.0
86+
nbclient==0.10.0
87+
nbconvert==7.16.4
88+
nbformat==5.10.4
89+
nest-asyncio==1.6.0
90+
networkx==3.2.1
91+
notebook==7.2.2
92+
notebook_shim==0.2.4
93+
numpy==2.1.1 # ok now with Python 3.10+
94+
overrides==7.7.0
95+
packaging==24.1
96+
pandas==2.2.3
97+
pandocfilters==1.5.1
98+
parsel==1.9.1
99+
parso==0.8.4
100+
patsy==0.5.6
101+
phe==1.5.0
102+
pillow==10.4.0
103+
pipenv==2024.0.1
104+
platformdirs==4.2.2
105+
plotly==5.24.1
106+
prometheus_client==0.21.0
107+
prompt_toolkit==3.0.48
108+
propcache==0.3.1
109+
Protego==0.3.1
110+
psutil==6.0.0
111+
pure_eval==0.2.3
112+
pyasn1==0.6.1
113+
pyasn1_modules==0.4.1
114+
pycparser==2.22
115+
PyDispatcher==2.0.7
116+
Pygments==2.18.0
117+
pyOpenSSL==24.2.1
118+
psycopg2-binary
119+
pyparsing==3.1.4
120+
python-dateutil==2.9.0.post0
121+
python-json-logger==2.0.7
122+
python-Levenshtein==0.27.1
123+
pytz==2024.2
124+
pywinpty==2.0.13
125+
PyYAML==6.0.2
126+
pyzmq==26.2.0
127+
queuelib==1.7.0
128+
RapidFuzz==3.13.0
129+
redis==5.0.1 # or latest stable version
130+
referencing==0.35.1
131+
requests==2.32.3
132+
requests-file==2.1.0
133+
retrying==1.3.4
134+
rfc3339-validator==0.1.4
135+
rfc3986-validator==0.1.1
136+
rpds-py==0.20.0
137+
scikit-learn==1.5.2
138+
scipy==1.14.1
139+
Scrapy==2.11.2
140+
seaborn==0.13.2
141+
Send2Trash==1.8.3
142+
service-identity==24.1.0
143+
setuptools==74.0.0
144+
six==1.16.0
145+
sniffio==1.3.1
146+
soupsieve==2.6
147+
sqlparse==0.5.1
148+
sqlalchemy
149+
stack-data==0.6.3
150+
statsmodels==0.14.4
151+
tenacity==9.0.0
152+
terminado==0.18.1
153+
threadpoolctl==3.5.0
154+
tinycss2==1.3.0
155+
tldextract==5.1.2
156+
tornado==6.4.1
157+
traitlets==5.14.3
158+
Twisted==24.7.0
159+
types-python-dateutil==2.9.0.20241003
160+
typing_extensions==4.12.2
161+
tzdata==2024.1
162+
uri-template==1.3.0
163+
urllib3==2.2.3
164+
userpath==1.9.2
2165
uvicorn==0.22.0
3-
sqlalchemy==2.0.15
4-
psycopg2-binary==2.9.6
5-
python-dotenv==1.0.0
6-
aiohttp==3.8.4
7-
redis==4.5.5
8-
alembic==1.11.1
9-
python-multipart==0.0.6
10-
pydantic==1.10.7
166+
virtualenv==20.26.3
167+
w3lib==2.2.1
168+
wcwidth==0.2.13
169+
webcolors==24.8.0
170+
webencodings==0.5.1
171+
websocket-client==1.8.0
172+
Werkzeug==3.0.6
173+
wget==3.2
174+
wheel==0.45.1
175+
yarl==1.20.0
176+
zipp==3.21.0
177+
zope.interface==7.0.3

0 commit comments

Comments
 (0)