Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 6 additions & 9 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,15 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install and configure Poetry
uses: snok/install-poetry@v1
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: 2.1.3
virtualenvs-create: true
virtualenvs-in-project: false
virtualenvs-path: ~/.venv
installer-parallel: true
version: '0.9.17'

- name: Install dependencies
run: |
poetry install --only=docker-image-builder
uv venv
uv pip install --group docker-image-builder

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down Expand Up @@ -103,7 +100,7 @@ jobs:
DOCKER_BUILDKIT: 1
BUILDKIT_PROGRESS: plain
run: |
poetry run python -m tools.image_builder \
uv run python -m tools.image_builder \
--build-target=${{ matrix.board }} \
--service=${{ matrix.service }} \
--push
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/generate-openapi-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,15 @@ jobs:
with:
python-version: "3.11"

- name: Install and configure Poetry
uses: snok/install-poetry@v1
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: 1.8.3
virtualenvs-create: true
virtualenvs-in-project: false
virtualenvs-path: ~/.venv
installer-parallel: true
version: '0.9.17'

- name: Install dependencies
run: |
poetry install --only=docker-image-builder
uv venv
uv pip install --group docker-image-builder

- name: Cache Docker layers
uses: actions/cache@v4
Expand All @@ -85,7 +82,7 @@ jobs:

- name: Build Images
run: |
poetry run python -m tools.image_builder \
uv run python -m tools.image_builder \
--dockerfiles-only \
--disable-cache-mounts \
--environment=development
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/python-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,20 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install and configure Poetry
uses: snok/install-poetry@v1
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: 1.8.3
virtualenvs-create: true
virtualenvs-in-project: false
virtualenvs-path: ~/.venv
installer-parallel: true
version: '0.9.17'

- name: Install dependencies
run: |
poetry install --only=dev-host
uv venv
uv pip install --group dev-host

- name: Run Ruff linting checks
run: |
poetry run ruff check .
uv run ruff check .

- name: Run Ruff formatting checks
run: |
poetry run ruff format --check .
uv run ruff format --check .
4 changes: 2 additions & 2 deletions .github/workflows/sbom.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- master
paths:
- 'package-lock.json'
- 'poetry.lock'
- 'uv.lock'

jobs:
run-tests:
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
env:
TOKEN: ${{ secrets.SBOMIFY_TOKEN }}
COMPONENT_ID: 'Vhc4zm8pdV'
SBOM_FILE: 'poetry.lock'
SBOM_FILE: 'uv.lock'
AUGMENT: true
UPLOAD: true
OUTPUT_FILE: python.cdx.json
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/test-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,19 @@ jobs:
with:
python-version: ${{ inputs.python-version }}

- name: Install and configure Poetry
uses: snok/install-poetry@v1
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: 1.8.3
virtualenvs-create: true
virtualenvs-in-project: false
virtualenvs-path: ~/.venv
installer-parallel: true
version: '0.9.17'

- name: Install dependencies
run: |
poetry install --only=docker-image-builder
uv venv
uv pip install --group docker-image-builder

- name: Build Containers
run: |
poetry run python -m tools.image_builder \
uv run python -m tools.image_builder \
--dockerfiles-only \
--disable-cache-mounts \
--service celery \
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
3 changes: 2 additions & 1 deletion bin/generate_dev_mode_dockerfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ docker run \
--rm \
--name="$BUILDER_CONTAINER_NAME" \
-v "$(pwd):/app" \
-v "${BUILDER_IMAGE_NAME}-venv:/app/.venv" \
"$BUILDER_IMAGE_NAME" \
poetry run python -m tools.image_builder \
uv run python -m tools.image_builder \
--environment="$ENVIRONMENT" \
--dockerfiles-only \
--disable-cache-mounts \
Expand Down
11 changes: 7 additions & 4 deletions docker/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
FROM python:3.11-bookworm

RUN apt-get update -y && \
curl --proto "=https" -sSL https://install.python-poetry.org | python3 - && \
ln -s /root/.local/bin/poetry /usr/local/bin/poetry
pip install uv

WORKDIR /app

COPY pyproject.toml poetry.lock /app/
COPY pyproject.toml uv.lock /app/

RUN uv sync --group docker-image-builder

RUN poetry install --only=docker-image-builder
RUN git config --global --add safe.directory /app

ENV VIRTUAL_ENV=/app/.venv
ENV PATH="${VIRTUAL_ENV}/bin:$PATH"
19 changes: 10 additions & 9 deletions docs/developer-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ $ ./bin/start_development_server.sh

> [!NOTE]
> Running the script will install Python 3.11, [pyenv](https://github.com/pyenv/pyenv),
> and [Poetry](https://python-poetry.org/) inside a Docker container on your machine.
> and [uv](https://docs.astral.sh/uv/) inside a Docker container on your machine.
> This is to ensure that the development environment is consistent across different
> machines.
>
Expand Down Expand Up @@ -91,7 +91,7 @@ and login with the credentials you just created.
Build and start the containers.

```bash
$ poetry run python -m tools.image_builder \
$ uv run python -m tools.image_builder \
--dockerfiles-only \
--disable-cache-mounts \
--service celery \
Expand Down Expand Up @@ -184,23 +184,24 @@ $ act -W .github/workflows/python-lint.yaml
The command above will run the linter on the all the Python files in the repository. If you want to run the linter
on a specific file, you can try the commands in the next section.

### Running the linter using Poetry
### Running the linter using `uv`

You have to install Poetry first. You can find the installation instructions
[here](https://python-poetry.org/docs/#installing-with-the-official-installer).
You have to install `uv` first. You can find the installation instructions
[here](https://docs.astral.sh/uv/getting-started/installation/).

After installing Poetry, run the following commands:
After installing uv, run the following commands:

```bash
# Install the dependencies
$ poetry install --only=dev-host
$ poetry run ruff check .
$ uv venv
$ uv pip install --group dev-host
$ uv run ruff check .
```

To run the linter on a specific file, run the following command:

```bash
$ poetry run ruff check /path/to/file.py
$ uv run ruff check /path/to/file.py
```


Expand Down
Loading
Loading