Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ __pycache__/
notebooks/
.python-version
ml/data
.ruff_cache
.ruff_cache
.venv
14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ FROM python:3.12-slim

WORKDIR /app
ENV PYTHONPATH=/app
ENV UV_NO_DEV=1

COPY --from=ghcr.io/astral-sh/uv:0.9.26 /uv /uvx /bin/

RUN apt-get update && apt-get install -y \
build-essential \
libstdc++6 \
&& rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt
COPY pyproject.toml uv.lock* ./
RUN uv sync --locked
ENV PATH="/app/.venv/bin:$PATH"

COPY .env .
COPY pytest.ini .
COPY alembic.ini .
Expand All @@ -19,4 +25,6 @@ COPY ml ./ml
COPY tests ./tests
COPY streamlit ./streamlit

CMD ["python", "discogs_rec_api/main.py"]

CMD ["uv", "run", "python", "discogs_rec_api/main.py"]

27 changes: 27 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[project]
name = "discogs-rec-api"
version = "0.1.0"
requires-python = ">=3.10"
dependencies = [
"alembic==1.16.4",
"annoy==1.17.3",
"asyncpg==0.30.0",
"bcrypt==4.0.1",
"cachetools==6.2.2",
"email-validator==2.2.0",
"fastapi==0.116.1",
"httpx==0.28.1",
"huggingface-hub==0.34.4",
"jwt==1.4.0",
"passlib==1.7.4",
"psycopg2-binary==2.9.10",
"pydantic-settings==2.10.1",
"pytest==8.4.1",
"pytest-asyncio==1.1.0",
"python-dotenv==1.1.1",
"python-jose==3.5.0",
"python-multipart==0.0.20",
"sqlalchemy==2.0.41",
"streamlit==1.51.0",
"uvicorn==0.35.0",
]
21 changes: 0 additions & 21 deletions requirements.txt

This file was deleted.

8 changes: 1 addition & 7 deletions setup_scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,24 @@ async def main():
data_path = ml_path / "data"
Path(data_path).mkdir(exist_ok=True, parents=True)

# download and unzip data
download_files(path=data_path, minimal=args.minimal, ci=args.ci)
if not args.minimal:
unzip_data(path=ml_path, ci=args.ci)

# delete cache from hf
hf_cache_path = ml_path / "data" / ".cache"
shutil.rmtree(hf_cache_path)

# for ci pipeline exit out
if args.ci:
return

# reset alembic and grab latest updates
reset_alembic()
# load releases table

csv_path = ml_path / "data" / "releases.csv"

load_release_from_csv(csv_path=csv_path)

# delete csv (not needed as its loaded to db)
csv_path.unlink()

# create a super user
test_superuser = UserCreate(
username="superuser",
email="super@super.com",
Expand Down
1 change: 0 additions & 1 deletion setup_scripts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def unzip_data(path: Path, ci: bool = False) -> None:
zip_path = path / "data" / f"{file_type}.zip"
with ZipFile(zip_path, "r") as zip_object:
for item in zip_object.namelist():
print(item)
if item in files_to_extract:
zip_object.extract(item, path)

Expand Down
2,146 changes: 2,146 additions & 0 deletions uv.lock

Large diffs are not rendered by default.

Loading