Skip to content

Commit

Permalink
Merge pull request #130 from vitaliypopel/feat/poetry-set-up
Browse files Browse the repository at this point in the history
Feat: replaced pip with poetry
  • Loading branch information
djeck1432 authored Oct 27, 2024
2 parents 6cb27ca + bcd3ca3 commit 433c1c8
Show file tree
Hide file tree
Showing 8 changed files with 3,382 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

- name: Run tests
run: |
docker-compose exec backend pytest web_app/tests
docker-compose exec backend poetry run pytest web_app/tests
- name: Tear down
run: |
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ __pycache__/
# local
local.py
images/
poetry.lock

.idea

Expand Down
20 changes: 13 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ FROM python:3.12-slim
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1

# Create app directory
RUN mkdir /app
WORKDIR /app
# Set PATH for Poetry
ENV PATH="/root/.local/bin:$PATH"

# Add system-level dependencies (including gcc and npm)
RUN apt-get update \
Expand All @@ -15,11 +14,18 @@ RUN apt-get update \
curl nodejs npm \
&& rm -rf /var/lib/apt/lists/*

# Copy only requirements.txt to leverage Docker cache
COPY ./requirements.txt /app/requirements.txt
# Install Poetry
RUN curl -sSL https://install.python-poetry.org | python3 -

# Create app directory
RUN mkdir /app
WORKDIR /app

# Copy the pyproject.toml and poetry.lock files into container's /app/ directory
COPY pyproject.toml poetry.lock /app/

# Install Python dependencies from requirements.txt and cache the layer
RUN pip install --no-cache-dir -r /app/requirements.txt
# Install dependencies from the poetry.lock file
RUN poetry install --no-dev --no-interaction --no-root

# Copy the rest of the application code
ADD . /app
Expand Down
5 changes: 2 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/bin/bash

echo "Run migration with alembic"
alembic -c web_app/alembic.ini upgrade head
poetry run alembic -c web_app/alembic.ini upgrade head

echo "Starting the server ..."

uvicorn web_app.api.main:app --host 0.0.0.0 --port 8000
poetry run uvicorn web_app.api.main:app --host 0.0.0.0 --port 8000
3,329 changes: 3,329 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[tool.poetry]
name = "spotnet"
version = "0.1.0"
description = "The functionality allows users to leverage their positions on assets (e.g., ETH) by looping through lending protocols (ZkLend) and automated market makers (AMMs)."
authors = ["djeck1432 <[email protected]>"]
readme = "README.md"
package-mode = false

[tool.poetry.dependencies]
python = ">=3.12,<3.13"
fastapi = "0.115.0"
psycopg2-binary = "2.9.9"
python-dotenv = "1.0.1"
uvicorn = "0.30.6"
starknet-py = "0.24.2"
jinja2 = "3.1.4"
python-multipart = "0.0.9"
itsdangerous = "2.2.0"
alembic = "1.13.3"
sqlalchemy = "2.0.35"
pytest = "8.3.3"
pytest-asyncio = "0.24.0"
pytest-env = "1.1.5"
pytest-mock = "3.14.0"
httpx = "0.27.2"
celery = "5.4.0"
redis = "5.2.0"
trio = "0.27.0"

[tool.poetry.group.dev.dependencies]
black = "24.8.0"
isort = "5.13.2"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
21 changes: 0 additions & 21 deletions requirements.txt

This file was deleted.

1 change: 0 additions & 1 deletion web_app/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
../.idea/
poetry.lock
__pycache__/

0 comments on commit 433c1c8

Please sign in to comment.