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

Use uv as python package manager instead of poetry in docker #32530

Closed
wants to merge 13 commits into from
Closed
7 changes: 0 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,6 @@ repos:
language: script
pass_filenames: false
files: '^selfdrive/ui/translations/'
- repo: https://github.com/python-poetry/poetry
rev: '1.8.0'
hooks:
- id: poetry-check
name: validate poetry lock
args:
- --lock
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.3
hooks:
Expand Down
21 changes: 10 additions & 11 deletions Dockerfile.openpilot_base
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
vim \
lsb-core \
libx11-6 \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/*

ARG INTEL_DRIVER=l_opencl_p_18.1.0.015.tgz
ARG INTEL_DRIVER_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/vcp/15532
Expand Down Expand Up @@ -63,20 +63,19 @@ RUN usermod -aG sudo $USER
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER $USER

ENV POETRY_VIRTUALENVS_CREATE=false
ENV PYENV_VERSION=3.11.4
ENV PYENV_ROOT="/home/$USER/pyenv"
ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"
ENV VIRTUAL_ENV_ROOT="/home/$USER/venv"
ENV PATH="$VIRTUAL_ENV_ROOT/bin:$PATH"

COPY --chown=$USER pyproject.toml poetry.lock .python-version /tmp/
COPY --chown=$USER tools/install_python_dependencies.sh /tmp/tools/
COPY --chown=$USER pyproject.toml /tmp/

RUN cd /tmp && \
tools/install_python_dependencies.sh && \
python3 -m venv --system-site-packages $VIRTUAL_ENV_ROOT && \
. $VIRTUAL_ENV_ROOT/bin/activate && \
pip install uv && \
uv pip compile pyproject.toml -o requirements.txt && \
uv pip install -r requirements.txt && \
rm -rf /tmp/* && \
rm -rf /home/$USER/.cache && \
find /home/$USER/pyenv -type d -name ".git" | xargs rm -rf && \
rm -rf /home/$USER/pyenv/versions/3.11.4/lib/python3.11/test
rm -rf /home/$USER/.cache

USER root
RUN sudo git config --global --add safe.directory /tmp/openpilot
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "openpilot"
requires-python = ">= 3.11"
readme = "README.md"
license = {text = "MIT License"}
dynamic = ["dependencies"]

[project.urls]
Homepage = "https://comma.ai"
Expand Down Expand Up @@ -83,9 +84,9 @@ version = "0.1.0"
description = "an open source driver assistance system"
authors = ["Vehicle Researcher <user@comma.ai>"]
license = "MIT"
readme = "README.md"
repository = "https://github.com/commaai/openpilot"
documentation = "https://docs.comma.ai"
packages = [{ include = "openpilot" }]


[tool.poetry.dependencies]
Expand Down Expand Up @@ -126,7 +127,7 @@ markdown-it-py = "*"
timezonefinder = "*"
setproctitle = "*"

[tool.poetry.group.dev.dependencies]
# dev dependencies
av = "*"
azure-identity = "*"
azure-storage-blob = "*"
Expand Down
Loading