Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
build(uv): replaces pip with uv (#116)
Browse files Browse the repository at this point in the history
* ci(github): replaces pip with uv

* chore(docker): add uv to dockerfile

* chore(docker): clean cache in docker

* chore(docker): optimize layers
  • Loading branch information
frgfm authored Mar 6, 2024
1 parent d40e2da commit d950f24
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 41 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,20 @@ jobs:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: pg_pwd
OLLAMA_MODEL: tinydolphin:1.1b-v2.8-q4_0
run: docker-compose up -d --build
- name: Debug
run: sleep 20 && docker-compose logs backend
run: docker compose up -d --build
- name: Docker sanity check
run: nc -vz localhost 8050
- name: Debug
run: docker-compose logs
- name: Ping server
run: curl http://localhost:8050/docs
env:
SUPERADMIN_GH_PAT: ${{ secrets.SUPERADMIN_GH_PAT }}
SUPERADMIN_LOGIN: dummy_login
SUPERADMIN_PWD: dummy_pwd
GH_OAUTH_ID: ${{ secrets.GH_OAUTH_ID }}
GH_OAUTH_SECRET: ${{ secrets.GH_OAUTH_SECRET }}
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: pg_pwd
OLLAMA_MODEL: tinydolphin:1.1b-v2.8-q4_0
run: |
sleep 20 && docker compose logs backend
nc -vz localhost 8050
docker compose logs
curl http://localhost:8050/docs
4 changes: 2 additions & 2 deletions .github/workflows/scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
run: sleep 20 && nc -vz localhost 8050
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install "requests>=2.31.0,<3.0.0" python-dotenv
python -m pip install --upgrade uv
uv pip install --system "requests>=2.31.0,<3.0.0" python-dotenv
- name: Run integration test
env:
SUPERUSER_LOGIN: ${{ secrets.SUPERUSER_LOGIN }}
Expand Down
37 changes: 10 additions & 27 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ jobs:
python: [3.9]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: x64
Expand All @@ -25,15 +24,10 @@ jobs:
poetry-version: "1.7.1"
- name: Resolve dependencies
run: poetry export -f requirements.txt --without-hashes --only quality --output requirements.txt
- name: Cache python modules
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('requirements.txt') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python -m pip install --upgrade uv
uv pip install --system -r requirements.txt
- name: Run ruff
run: |
ruff --version
Expand All @@ -56,15 +50,10 @@ jobs:
poetry-version: "1.7.1"
- name: Resolve dependencies
run: poetry export -f requirements.txt --without-hashes --with quality --output requirements.txt
- name: Cache python modules
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('requirements.txt') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python -m pip install --upgrade uv
uv pip install --system -r requirements.txt
- name: Run mypy
run: |
mypy --version
Expand All @@ -78,8 +67,7 @@ jobs:
python: [3.9]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: x64
Expand All @@ -88,15 +76,10 @@ jobs:
poetry-version: "1.7.1"
- name: Resolve dependencies
run: poetry export -f requirements.txt --without-hashes --only quality --output requirements.txt
- name: Cache python modules
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('requirements.txt') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python -m pip install --upgrade uv
uv pip install --system -r requirements.txt
- name: Run ruff
run: |
ruff --version
Expand All @@ -121,8 +104,8 @@ jobs:
run: poetry export -f requirements.txt --without-hashes --only quality --output requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python -m pip install --upgrade uv
uv pip install --system -r requirements.txt
- name: Run pre-commit hooks
run: |
git checkout -b temp
Expand Down
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ COPY requirements.txt /app/requirements.txt

# install dependencies
RUN set -eux \
&& pip install -r /app/requirements.txt \
&& rm -rf /root/.cache/pip
&& pip install --no-cache-dir uv \
&& uv pip install --no-cache --system -r /app/requirements.txt \
&& rm -rf /root/.cache

# copy project
COPY src/app /app/app
COPY src/alembic /app/alembic
COPY src/alembic.ini /app/alembic.ini
COPY src/alembic /app/alembic
COPY src/app /app/app

0 comments on commit d950f24

Please sign in to comment.