Skip to content

Commit ea0c240

Browse files
authored
feat(rye): changed package manager (#3019)
Needs export UV_INDEX_STRATEGY=unsafe-first-match to work Completes CORE-153
1 parent 3f4c256 commit ea0c240

29 files changed

+2313
-30162
lines changed

.github/workflows/backend-core-tests.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,18 @@ jobs:
2020
- 9998:9998
2121

2222
steps:
23-
- name: Checkout code
23+
- name: 👀 Checkout code
2424
uses: actions/checkout@v2
2525

26-
- name: Set up Python
27-
uses: actions/setup-python@v2
26+
- name: 🔨 Install the latest version of rye
27+
uses: eifinger/setup-rye@v4
2828
with:
29-
python-version: "3.11"
30-
31-
- name: Install dependencies
29+
enable-cache: true
30+
working-directory: backend
31+
- name: 🔄 Sync dependencies
3232
run: |
33-
cd backend/core
34-
python -m pip install --upgrade pip
35-
pip install poetry
36-
poetry install -E base --with dev,test
33+
cd backend
34+
UV_INDEX_STRATEGY=unsafe-first-match rye sync --no-lock
3735
3836
- name: Run tests
3937
env:
@@ -42,6 +40,5 @@ jobs:
4240
run: |
4341
sudo apt-get update
4442
sudo apt-get install -y libmagic-dev poppler-utils libreoffice tesseract-ocr pandoc
45-
tesseract --version
4643
cd backend/core
47-
poetry run tox
44+
rye test

.github/workflows/backend-tests.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,22 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- name: Checkout code
14+
- name: 👀 Checkout code
1515
uses: actions/checkout@v2
1616

17-
- name: Install poetry
18-
run: pipx install poetry
19-
20-
- name: Set up Python
21-
uses: actions/setup-python@v5
17+
- name: 🔨 Install the latest version of rye
18+
uses: eifinger/setup-rye@v4
2219
with:
23-
python-version: "3.11"
24-
cache: poetry
20+
enable-cache: true
21+
working-directory: backend
22+
23+
- name: 🔄 Sync dependencies
24+
run: |
25+
cd backend
26+
UV_INDEX_STRATEGY=unsafe-first-match rye sync --no-lock
2527
2628
27-
- name: Install Supabase CLI
29+
- name: 🚤 Install Supabase CLI
2830
run: |
2931
ARCHITECTURE=$(uname -m)
3032
if [ "$ARCHITECTURE" = "x86_64" ]; then
@@ -35,7 +37,7 @@ jobs:
3537
sudo dpkg -i supabase_1.163.6_linux_arm64.deb
3638
fi
3739
38-
- name: Install system dependencies
40+
- name: 😭 Install system dependencies
3941
run: |
4042
sudo apt-get update
4143
sudo apt-get install -y libmagic-dev poppler-utils libreoffice tesseract-ocr pandoc
@@ -55,10 +57,8 @@ jobs:
5557
CELEBRY_BROKER_QUEUE_NAME: quivr-preview.fifo
5658
QUIVR_DOMAIN: http://localhost:3000/
5759
BACKEND_URL: http://localhost:5050
60+
EMBEDDING_DIM: 1536
5861
run: |
59-
tesseract --version
6062
cd backend
61-
poetry install --with dev,test
6263
supabase db start
63-
poetry run pytest worker
64-
poetry run pytest api
64+
rye test -p quivr-api -p quivr-worker

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ dev-build:
1919
## prod: Build and start production environment
2020
.PHONY: prod
2121
prod:
22-
docker compose build backend-core
2322
docker compose -f docker-compose.yml up --build
2423

2524
## front: Build and start frontend
2625
.PHONY: front
2726
front:
28-
cd frontend && yarn build && yarn start
27+
cd frontend && yarn && yarn build && yarn start
2928

3029
## test: Run tests
3130
.PHONY: test

backend/.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# python generated files
2+
__pycache__/
3+
*.py[oc]
4+
build/
5+
dist/
6+
wheels/
7+
*.egg-info
8+
9+
# venv
10+
.venv

backend/Dockerfile

Lines changed: 12 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
# Using a slim version for a smaller base image
21
FROM python:3.11.6-slim-bullseye
32

4-
ARG DEV_MODE
5-
ENV DEV_MODE=$DEV_MODE
3+
WORKDIR /app
64

7-
# Install GEOS library, Rust, and other dependencies, then clean up
8-
RUN apt-get clean && apt-get update && apt-get install -y \
5+
# Install runtime dependencies
6+
RUN apt-get update && apt-get install -y \
97
libgeos-dev \
108
libcurl4-openssl-dev \
119
libssl-dev \
@@ -15,23 +13,14 @@ RUN apt-get clean && apt-get update && apt-get install -y \
1513
git \
1614
poppler-utils \
1715
tesseract-ocr \
18-
autoconf \
19-
automake \
20-
build-essential \
21-
libtool \
22-
python-dev \
23-
wget \
24-
# Additional dependencies for document handling
2516
libmagic-dev \
26-
poppler-utils \
27-
tesseract-ocr \
2817
libreoffice \
2918
libpq-dev \
3019
gcc \
31-
pandoc && \
32-
rm -rf /var/lib/apt/lists/*
33-
20+
wget \
21+
&& rm -rf /var/lib/apt/lists/*
3422

23+
# Install Supabase CLI
3524
RUN ARCHITECTURE=$(uname -m) && \
3625
if [ "$ARCHITECTURE" = "x86_64" ]; then \
3726
wget https://github.com/supabase/cli/releases/download/v1.163.6/supabase_1.163.6_linux_amd64.deb && \
@@ -41,43 +30,15 @@ RUN ARCHITECTURE=$(uname -m) && \
4130
wget https://github.com/supabase/cli/releases/download/v1.163.6/supabase_1.163.6_linux_arm64.deb && \
4231
dpkg -i supabase_1.163.6_linux_arm64.deb && \
4332
rm supabase_1.163.6_linux_arm64.deb; \
44-
fi && \
45-
rm -rf /var/lib/apt/lists/*
46-
47-
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python && \
48-
cd /usr/local/bin && \
49-
ln -s /opt/poetry/bin/poetry && \
50-
poetry config virtualenvs.create false
51-
52-
53-
# Add Rust binaries to the PATH
54-
ENV PATH="/root/.cargo/bin:${PATH}" \
55-
POETRY_CACHE_DIR=/tmp/poetry_cache \
56-
PYTHONDONTWRITEBYTECODE=1
57-
58-
WORKDIR /code
59-
60-
# Copy monorepo dependencies
61-
# CORE
62-
COPY core/pyproject.toml core/README.md core/poetry.lock /code/core/
63-
COPY core/quivr_core /code/core/quivr_core
64-
# API
65-
COPY api/pyproject.toml api/poetry.lock api/README.md /code/api/
66-
COPY api/quivr_api /code/api/quivr_api
67-
68-
COPY ./pyproject.toml ./poetry.lock* /code/
69-
70-
COPY ./ci-migration.sh /code/
33+
fi
7134

72-
COPY supabase /code/supabase/
35+
COPY . .
7336

74-
# Run install
75-
RUN poetry install --no-root --with dev,test && \
76-
playwright install --with-deps && \
77-
rm -rf $POETRY_CACHE_DIR
37+
RUN PYTHONDONTWRITEBYTECODE=1 pip install --no-cache-dir -r requirements.lock
7838

39+
RUN playwright install --with-deps
7940

80-
ENV PYTHONPATH=/code
8141

42+
ENV PYTHONPATH=/app
8243

83-
EXPOSE 5050
44+
EXPOSE 5050

backend/Dockerfile.dev

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# Using a slim version for a smaller base image
22
FROM python:3.11.6-slim-bullseye
33

4-
ARG DEV_MODE
5-
ENV DEV_MODE=$DEV_MODE
6-
4+
WORKDIR /app
75
# Install GEOS library, Rust, and other dependencies, then clean up
86
RUN apt-get clean && apt-get update && apt-get install -y \
97
libgeos-dev \
@@ -28,40 +26,18 @@ RUN apt-get clean && apt-get update && apt-get install -y \
2826
pandoc && \
2927
rm -rf /var/lib/apt/lists/* && apt-get clean
3028

31-
# TODO(@aminediro) : multistage build. Probably dont neet poetry once its built
32-
# Install Poetry
33-
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python && \
34-
cd /usr/local/bin && \
35-
ln -s /opt/poetry/bin/poetry && \
36-
poetry config virtualenvs.create false
37-
38-
# Add Rust binaries to the PATH
39-
ENV PATH="/root/.cargo/bin:${PATH}" \
40-
POETRY_CACHE_DIR=/tmp/poetry_cache \
41-
PYTHONDONTWRITEBYTECODE=1
42-
43-
WORKDIR /code/worker
44-
45-
# Copy monorepo dependencies
46-
# CORE
47-
COPY core/pyproject.toml core/README.md core/poetry.lock /code/core/
48-
COPY core/quivr_core /code/core/quivr_core
49-
# API
50-
COPY ../api/pyproject.toml ../api/poetry.lock ../api/README.md /code/api/
51-
COPY ../api/quivr_api /code/api/quivr_api
52-
COPY ./pyproject.toml ./poetry.lock* /code/
53-
54-
# Worker
55-
COPY pyproject.toml poetry.lock README.md /code/api/
56-
COPY quivr_api /code/api/quivr_api
57-
COPY pyproject.toml poetry.lock* /code/
29+
COPY requirements.lock pyproject.toml README.md ./
30+
COPY api/pyproject.toml api/README.md ./api/
31+
COPY api/quivr_api/__init__.py ./api/quivr_api/__init__.py
32+
COPY core/pyproject.toml core/README.md ./core/
33+
COPY core/quivr_core/__init__.py ./core/quivr_core/__init__.py
34+
COPY worker/pyproject.toml worker/README.md ./worker/
35+
COPY worker/quivr_worker/__init__.py ./worker/quivr_worker/__init__.py
5836

59-
# Run install
60-
RUN poetry install --no-root --with dev,test && \
61-
playwright install --with-deps && \
62-
rm -rf $POETRY_CACHE_DIR
37+
RUN PYTHONDONTWRITEBYTECODE=1 pip install --no-cache-dir -r requirements.lock
6338

39+
RUN playwright install --with-deps
6440

65-
ENV PYTHONPATH=/code
41+
COPY . .
6642

67-
EXPOSE 5050
43+
EXPOSE 5050

backend/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# backend
2+
3+
Describe your project here.

backend/api/.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# python generated files
2+
__pycache__/
3+
*.py[oc]
4+
build/
5+
dist/
6+
wheels/
7+
*.egg-info
8+
9+
# venv
10+
.venv

backend/api/.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11.9

backend/api/celerybeat-schedule

-20 KB
Binary file not shown.

0 commit comments

Comments
 (0)