M api/Dockerfile => api/Dockerfile +3 -3
@@ 1,6 1,6 @@
-FROM python:3.9-slim-buster as production
+FROM python:3.11-slim-buster as production
-COPY requirements/production.txt /tmp/requirements.txt
+COPY requirements/requirements.txt /tmp/requirements.txt
RUN apt-get update && apt-get install -y gcc \
&& python -m venv /opt/venv \
@@ 22,5 22,5 @@ EXPOSE 8000
CMD ["./start.sh"]
FROM production as development
-COPY ./requirements/development.txt /tmp/requirements.txt
+COPY ./requirements/dev-requirements.txt /tmp/requirements.txt
RUN /opt/venv/bin/pip install -r /tmp/requirements.txt
M api/app/core/config.py => api/app/core/config.py +9 -13
@@ 1,14 1,12 @@
-from pydantic import BaseSettings
+from pydantic_settings import BaseSettings, SettingsConfigDict
class PostgresConfig(BaseSettings):
- user: str
- password: str
- host: str
- db: str
-
- class Config:
- env_prefix = "POSTGRES_"
+ user: str = "aita"
+ password: str = "aita"
+ host: str = "localhost"
+ db: str = "aita_db"
+ model_config = SettingsConfigDict(env_prefix="POSTGRES_")
class RedditConfig(BaseSettings):
@@ 16,14 14,12 @@ class RedditConfig(BaseSettings):
client_secret: str
password: str
username: str
-
- class Config:
- env_prefix = "REDDIT_"
+ model_config = SettingsConfigDict(env_prefix="REDDIT_")
class Settings(BaseSettings):
- pg = PostgresConfig()
- reddit = RedditConfig()
+ pg: PostgresConfig = PostgresConfig()
+ reddit: RedditConfig = RedditConfig()
debug: bool = False
api_version: str = "/api/v1"
uri: str = f"postgresql://{pg.user}:{pg.password}@{pg.host}/{pg.db}"
M api/app/schemas/base.py => api/app/schemas/base.py +2 -3
@@ 1,8 1,7 @@
-from pydantic import BaseModel
+from pydantic import BaseModel, ConfigDict
class BaseSchema(BaseModel):
"""All pydantic schemas should use ORM mode"""
- class Config:
- orm_mode = True
+ model_config = ConfigDict(from_attributes=True)
M api/app/schemas/reddit.py => api/app/schemas/reddit.py +5 -5
@@ 23,8 23,8 @@ class RedditLastSync(BaseModel):
class PostCount(BaseModel):
- YTA: Optional[int]
- NTA: Optional[int]
- ESH: Optional[int]
- NAH: Optional[int]
- NAN: Optional[int]
+ YTA: Optional[int] = None
+ NTA: Optional[int] = None
+ ESH: Optional[int] = None
+ NAH: Optional[int] = None
+ NAN: Optional[int] = None
A api/requirements/dev-requirements.txt => api/requirements/dev-requirements.txt +6 -0
@@ 0,0 1,6 @@
+asgi-lifespan
+debugpy
+httpx
+mypy
+pytest
+pytest-asyncio
D api/requirements/development.txt => api/requirements/development.txt +0 -76
@@ 1,76 0,0 @@
-aiofiles==0.6.0; python_version >= "3.6"
-aiohttp==3.8.1; python_version >= "3.6"
-aiosignal==1.2.0; python_version >= "3.6"
-aiosqlite==0.17.0; python_version >= "3.6"
-alembic==1.8.0; python_version >= "3.7"
-anyio==3.6.1; python_version >= "3.7" and python_full_version >= "3.6.2"
-asgi-lifespan==1.0.1; python_version >= "3.6"
-asgiref==3.5.2; python_version >= "3.7"
-async-generator==1.10; python_version >= "3.6"
-async-timeout==4.0.2; python_version >= "3.6"
-asyncio-extras==1.3.2; python_version >= "3.6"
-asyncpg==0.25.0; python_full_version >= "3.6.0"
-asyncpraw==7.5.0; python_version >= "3.6"
-asyncprawcore==2.3.0; python_version >= "3.6"
-atomicwrites==1.4.0; python_version >= "3.7" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.4.0"
-attrs==21.4.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
-blis==0.7.8; python_version >= "3.6"
-catalogue==2.0.7; python_version >= "3.6"
-certifi==2022.6.15; python_version >= "3.7" and python_version < "4"
-charset-normalizer==2.1.0; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
-click==8.1.3; python_version >= "3.7"
-colorama==0.4.5; python_version >= "3.7" and python_full_version < "3.0.0" and sys_platform == "win32" and platform_system == "Windows" or sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.5.0" and platform_system == "Windows"
-cymem==2.0.6; python_version >= "3.6"
-debugpy==1.6.0; python_version >= "3.7"
-fastapi-pagination==0.9.3; python_version >= "3.7" and python_version < "4.0"
-fastapi==0.70.1; python_full_version >= "3.6.1"
-frozenlist==1.3.0; python_version >= "3.7"
-greenlet==1.1.2; python_version >= "3" and python_full_version < "3.0.0" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32") and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7") or python_version >= "3" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32") and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7") and python_full_version >= "3.5.0"
-gunicorn==20.1.0; python_version >= "3.5"
-h11==0.12.0; python_version >= "3.7"
-httpcore==0.15.0; python_version >= "3.7"
-httpx==0.23.0; python_version >= "3.7"
-idna==3.3; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.2"
-iniconfig==1.1.1; python_version >= "3.7"
-jinja2==3.1.2; python_version >= "3.7"
-langcodes==3.3.0; python_version >= "3.6"
-loguru==0.5.3; python_version >= "3.5"
-mako==1.2.1; python_version >= "3.7"
-markupsafe==2.1.1; python_version >= "3.7"
-multidict==6.0.2; python_version >= "3.7"
-murmurhash==1.0.7; python_version >= "3.6"
-mypy-extensions==0.4.3; python_version >= "3.5"
-mypy==0.910; python_version >= "3.5"
-numpy==1.23.0; python_version >= "3.8"
-packaging==21.3; python_version >= "3.7"
-pathy==0.6.2; python_version >= "3.6"
-pluggy==1.0.0; python_version >= "3.7"
-preshed==3.0.6; python_version >= "3.6"
-psycopg2-binary==2.9.3; python_version >= "3.6"
-py==1.11.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
-pydantic==1.8.2; python_full_version >= "3.6.1"
-pyparsing==3.0.9; python_full_version >= "3.6.8" and python_version >= "3.6"
-pytest-asyncio==0.18.3; python_version >= "3.7"
-pytest==6.2.5; python_version >= "3.6"
-python-dotenv==0.20.0; python_full_version >= "3.6.1" and python_version >= "3.7" and python_version < "4.0"
-requests==2.28.1; python_version >= "3.7" and python_version < "4"
-rfc3986==1.5.0; python_version >= "3.7"
-smart-open==5.2.1; python_version >= "3.6" and python_version < "4.0"
-sniffio==1.2.0; python_version >= "3.7" and python_full_version >= "3.6.2"
-spacy-legacy==3.0.9; python_version >= "3.6"
-spacy-loggers==1.0.2; python_version >= "3.6"
-spacy==3.3.1; python_version >= "3.6"
-sqlalchemy==1.4.39; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7"
-srsly==2.4.3; python_version >= "3.6"
-starlette==0.16.0; python_version >= "3.7" and python_full_version >= "3.6.1" and python_version < "4.0"
-thinc==8.0.17; python_version >= "3.6"
-toml==0.10.2; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.7"
-tqdm==4.64.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
-typer==0.4.2; python_version >= "3.6"
-typing-extensions==4.3.0; python_version >= "3.7" and python_full_version >= "3.6.1" and python_version < "4.0"
-update-checker==0.18.0; python_version >= "3.6"
-urllib3==1.26.9; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4" or python_full_version >= "3.5.0" and python_version < "4" and python_version >= "3.7"
-uvicorn==0.15.0
-wasabi==0.9.1; python_version >= "3.6"
-win32-setctime==1.1.0; sys_platform == "win32" and python_version >= "3.5"
-yarl==1.7.2; python_version >= "3.6"
D api/requirements/production.txt => api/requirements/production.txt +0 -62
@@ 1,62 0,0 @@
-aiofiles==0.6.0; python_version >= "3.6"
-aiohttp==3.8.1; python_version >= "3.6"
-aiosignal==1.2.0; python_version >= "3.6"
-aiosqlite==0.17.0; python_version >= "3.6"
-alembic==1.8.0; python_version >= "3.7"
-anyio==3.6.1; python_version >= "3.6" and python_full_version >= "3.6.2"
-asgiref==3.5.2; python_version >= "3.7"
-async-generator==1.10; python_version >= "3.6"
-async-timeout==4.0.2; python_version >= "3.6"
-asyncio-extras==1.3.2; python_version >= "3.6"
-asyncpg==0.25.0; python_full_version >= "3.6.0"
-asyncpraw==7.5.0; python_version >= "3.6"
-asyncprawcore==2.3.0; python_version >= "3.6"
-attrs==21.4.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
-blis==0.7.8; python_version >= "3.6"
-catalogue==2.0.7; python_version >= "3.6"
-certifi==2022.6.15; python_version >= "3.7" and python_version < "4"
-charset-normalizer==2.1.0; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
-click==8.1.3; python_version >= "3.7"
-colorama==0.4.5; python_version >= "3.7" and python_full_version < "3.0.0" and sys_platform == "win32" and platform_system == "Windows" or sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.5.0" and platform_system == "Windows"
-cymem==2.0.6; python_version >= "3.6"
-fastapi-pagination==0.9.3; python_version >= "3.7" and python_version < "4.0"
-fastapi==0.70.1; python_full_version >= "3.6.1"
-frozenlist==1.3.0; python_version >= "3.7"
-greenlet==1.1.2; python_version >= "3" and python_full_version < "3.0.0" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32") and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7") or python_version >= "3" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32") and (python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7") and python_full_version >= "3.5.0"
-gunicorn==20.1.0; python_version >= "3.5"
-h11==0.12.0; python_version >= "3.6"
-idna==3.3; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.2"
-jinja2==3.1.2; python_version >= "3.7"
-langcodes==3.3.0; python_version >= "3.6"
-loguru==0.5.3; python_version >= "3.5"
-mako==1.2.1; python_version >= "3.7"
-markupsafe==2.1.1; python_version >= "3.7"
-multidict==6.0.2; python_version >= "3.7"
-murmurhash==1.0.7; python_version >= "3.6"
-numpy==1.23.0; python_version >= "3.8"
-packaging==21.3; python_version >= "3.6"
-pathy==0.6.2; python_version >= "3.6"
-preshed==3.0.6; python_version >= "3.6"
-psycopg2-binary==2.9.3; python_version >= "3.6"
-pydantic==1.8.2; python_full_version >= "3.6.1"
-pyparsing==3.0.9; python_full_version >= "3.6.8" and python_version >= "3.6"
-python-dotenv==0.20.0; python_full_version >= "3.6.1" and python_version >= "3.7" and python_version < "4.0"
-requests==2.28.1; python_version >= "3.7" and python_version < "4"
-smart-open==5.2.1; python_version >= "3.6" and python_version < "4.0"
-sniffio==1.2.0; python_version >= "3.6" and python_full_version >= "3.6.2"
-spacy-legacy==3.0.9; python_version >= "3.6"
-spacy-loggers==1.0.2; python_version >= "3.6"
-spacy==3.3.1; python_version >= "3.6"
-sqlalchemy==1.4.39; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.7"
-srsly==2.4.3; python_version >= "3.6"
-starlette==0.16.0; python_version >= "3.7" and python_full_version >= "3.6.1" and python_version < "4.0"
-thinc==8.0.17; python_version >= "3.6"
-tqdm==4.64.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
-typer==0.4.2; python_version >= "3.6"
-typing-extensions==4.3.0; python_version >= "3.7" and python_full_version >= "3.6.1" and python_version < "4.0"
-update-checker==0.18.0; python_version >= "3.6"
-urllib3==1.26.9; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4" or python_full_version >= "3.5.0" and python_version < "4" and python_version >= "3.7"
-uvicorn==0.15.0
-wasabi==0.9.1; python_version >= "3.6"
-win32-setctime==1.1.0; sys_platform == "win32" and python_version >= "3.5"
-yarl==1.7.2; python_version >= "3.6"
A api/requirements/requirements.in => api/requirements/requirements.in +12 -0
@@ 0,0 1,12 @@
+alembic
+asyncpg
+asyncpraw
+fastapi
+fastapi-pagination
+gunicorn
+loguru
+psycopg2-binary
+pydantic
+pydantic-settings
+spacy
+uvicorn
A api/requirements/requirements.txt => api/requirements/requirements.txt +190 -0
@@ 0,0 1,190 @@
+#
+# This file is autogenerated by pip-compile with Python 3.11
+# by the following command:
+#
+# pip-compile --output-file=- -
+#
+aiofiles==0.8.0
+ # via asyncpraw
+aiohttp==3.8.5
+ # via
+ # asyncpraw
+ # asyncprawcore
+aiosignal==1.3.1
+ # via aiohttp
+aiosqlite==0.17.0
+ # via asyncpraw
+alembic==1.11.2
+ # via -r -
+annotated-types==0.5.0
+ # via pydantic
+anyio==3.7.1
+ # via starlette
+async-timeout==4.0.2
+ # via aiohttp
+asyncpg==0.28.0
+ # via -r -
+asyncpraw==7.7.1
+ # via -r -
+asyncprawcore==2.3.0
+ # via asyncpraw
+attrs==23.1.0
+ # via aiohttp
+blis==0.7.10
+ # via thinc
+catalogue==2.0.9
+ # via
+ # spacy
+ # srsly
+ # thinc
+certifi==2023.7.22
+ # via requests
+charset-normalizer==3.2.0
+ # via
+ # aiohttp
+ # requests
+click==8.1.6
+ # via
+ # typer
+ # uvicorn
+confection==0.1.1
+ # via thinc
+cymem==2.0.7
+ # via
+ # preshed
+ # spacy
+ # thinc
+fastapi==0.101.0
+ # via
+ # -r -
+ # fastapi-pagination
+fastapi-pagination==0.12.7
+ # via -r -
+frozenlist==1.4.0
+ # via
+ # aiohttp
+ # aiosignal
+greenlet==2.0.2
+ # via sqlalchemy
+gunicorn==21.2.0
+ # via -r -
+h11==0.14.0
+ # via uvicorn
+idna==3.4
+ # via
+ # anyio
+ # requests
+ # yarl
+jinja2==3.1.2
+ # via spacy
+langcodes==3.3.0
+ # via spacy
+loguru==0.7.0
+ # via -r -
+mako==1.2.4
+ # via alembic
+markupsafe==2.1.3
+ # via
+ # jinja2
+ # mako
+multidict==6.0.4
+ # via
+ # aiohttp
+ # yarl
+murmurhash==1.0.9
+ # via
+ # preshed
+ # spacy
+ # thinc
+numpy==1.25.2
+ # via
+ # blis
+ # spacy
+ # thinc
+packaging==23.1
+ # via
+ # gunicorn
+ # spacy
+ # thinc
+pathy==0.10.2
+ # via spacy
+preshed==3.0.8
+ # via
+ # spacy
+ # thinc
+psycopg2-binary==2.9.7
+ # via -r -
+pydantic==2.1.1
+ # via
+ # -r -
+ # confection
+ # fastapi
+ # fastapi-pagination
+ # pydantic-settings
+ # spacy
+ # thinc
+pydantic-core==2.4.0
+ # via pydantic
+pydantic-settings==2.0.2
+ # via -r -
+python-dotenv==1.0.0
+ # via pydantic-settings
+requests==2.31.0
+ # via
+ # spacy
+ # update-checker
+smart-open==6.3.0
+ # via
+ # pathy
+ # spacy
+sniffio==1.3.0
+ # via anyio
+spacy==3.6.1
+ # via -r -
+spacy-legacy==3.0.12
+ # via spacy
+spacy-loggers==1.0.4
+ # via spacy
+sqlalchemy==2.0.19
+ # via alembic
+srsly==2.4.7
+ # via
+ # confection
+ # spacy
+ # thinc
+starlette==0.27.0
+ # via fastapi
+thinc==8.1.11
+ # via spacy
+tqdm==4.65.1
+ # via spacy
+typer==0.9.0
+ # via
+ # pathy
+ # spacy
+typing-extensions==4.7.1
+ # via
+ # aiosqlite
+ # alembic
+ # fastapi
+ # pydantic
+ # pydantic-core
+ # sqlalchemy
+ # typer
+update-checker==0.18.0
+ # via asyncpraw
+urllib3==2.0.4
+ # via requests
+uvicorn==0.23.2
+ # via -r -
+wasabi==1.1.2
+ # via
+ # spacy
+ # thinc
+yarl==1.9.2
+ # via
+ # aiohttp
+ # asyncprawcore
+
+# The following packages are considered to be unsafe in a requirements file:
+# setuptools