Skip to content

Commit

Permalink
Use pdm for llm-service deps (#24)
Browse files Browse the repository at this point in the history
* Use pdm for llm-service deps

* update github workflow

* use setup-pdm

* use quotes
  • Loading branch information
conradocloudera authored Nov 20, 2024
1 parent ec04760 commit b0b009e
Show file tree
Hide file tree
Showing 9 changed files with 2,185 additions and 31 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/pr_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,19 @@ jobs:
working-directory: ui

- name: Set up Python
uses: actions/setup-python@v5
uses: pdm-project/setup-pdm@v3
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: 'llm-service/app/requirements.txt'
cache: true
cache-dependency-path: 'llm-service/pdm.lock'

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r app/requirements.txt
pdm install
working-directory: llm-service

- name: Test with pytest
run: |
python -m pytest -sxvvra
pdm run pytest -sxvvra
working-directory: llm-service

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.env
.idea/*
.vscode/*
!.idea/copyright/
!.idea/prettier.xml
!.idea/google-java-format.xml
Expand Down
8 changes: 5 additions & 3 deletions llm-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
FROM docker-private.infra.cloudera.com/cloudera_base/hardened/cloudera-python:3.10
COPY ./app/requirements.txt /app/
RUN pip install pdm
COPY ./pyproject.toml /app/
COPY ./pdm.lock /app/
WORKDIR /app
RUN pip install -r requirements.txt
RUN pdm install

COPY ./app /app
WORKDIR /app

CMD [ "fastapi", "run", "--host", "0.0.0.0" ]
CMD [ "pdm", "run", "fastapi", "run", "--host", "0.0.0.0" ]
17 changes: 0 additions & 17 deletions llm-service/app/requirements.txt

This file was deleted.

2,149 changes: 2,149 additions & 0 deletions llm-service/pdm.lock

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions llm-service/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,21 @@
addopts = [
"--import-mode=importlib",
]

[tool.pdm]
distribution = false

[project]
name = "llm-service"
version = "0.1.0"
description = "Default template for PDM package"
authors = [
{name = "Conrado Silva Miranda", email = "csilvamiranda@cloudera.com"},
]
dependencies = ["llama-index-core==0.10.68", "llama-index-readers-file==0.1.33", "fastapi==0.111.0", "pydantic==2.8.2", "pydantic-settings==2.3.4", "boto3==1.34.26", "llama-index-embeddings-bedrock==0.2.1", "llama-index-llms-bedrock==0.1.13", "llama-index-llms-openai==0.1.31", "llama-index-llms-mistralai==0.1.20", "llama-index-embeddings-openai==0.1.11", "llama-index-vector-stores-qdrant==0.2.17"]
requires-python = "==3.10.*"
readme = "README.md"
license = {text = "APACHE"}

[dependency-groups]
dev = ["moto[s3]>=5.0.21", "pytest>=8.3.3"]
7 changes: 4 additions & 3 deletions local-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ docker run --name qdrant_dev --rm -d -p 6333:6333 -p 6334:6334 -v $(pwd)/databas
cd llm-service
python3.10 -m venv venv
source venv/bin/activate
python -m pip install -r app/requirements.txt
python -m pytest -sxvvra
python -m pip install pdm
pdm install
pdm run pytest -sxvvra

fastapi dev &
pdm run fastapi dev &

# start up the jarva
cd ../backend
Expand Down
3 changes: 2 additions & 1 deletion scripts/refresh_project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ cd ui/express
npm install

cd ../../llm-service
pip install -r app/requirements.txt
pip install pdm
pdm install

cd ..
mkdir -p artifacts
Expand Down
2 changes: 1 addition & 1 deletion scripts/startup_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ qdrant/qdrant &

# start Python backend
cd llm-service
fastapi run --host 127.0.0.1 --port 8081 &
pdm run fastapi run --host 127.0.0.1 --port 8081 &

# start up the jarva
cd ..
Expand Down

0 comments on commit b0b009e

Please sign in to comment.