Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: replaced pip with poetry #130

Merged
merged 7 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
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
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 file to install dependencies
COPY ./pyproject.toml /app/pyproject.toml

# Install Python dependencies from requirements.txt and cache the layer
RUN pip install --no-cache-dir -r /app/requirements.txt
# Install dependencies using Poetry, generating a new poetry.lock file
RUN poetry install --no-root --no-interaction --no-ansi

# 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
35 changes: 35 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[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"
black = "24.8.0"
isort = "5.13.2"
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"

vitaliypopel marked this conversation as resolved.
Show resolved Hide resolved

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

This file was deleted.

Loading