switch to uv (#32853)
* switch to uv * pin back numpy * remove lock * try without cache * test with no cache * no cache for all * debug * remove debug * remove pygame dep * Update README.md * remove lower bound * update repo maintenance job * upgradable * repo maintenance * copy poetry api * build system * unpin pygame * readd cache * readd cache * basic command * lower delay * macos * fix authors * macos fix * use uv * preview * other way * new metadrive * uv sync * cp lock in docker * fix docker * use hatchling * fix devcontainer * fix container * path * uv run * cleanup * pre-commit * format * release_file
This commit is contained in:
parent
4a70934625
commit
12d5afba73
|
@ -1,7 +1,8 @@
|
||||||
FROM ghcr.io/commaai/openpilot-base:latest
|
FROM ghcr.io/commaai/openpilot-base:latest
|
||||||
|
|
||||||
RUN apt update && apt install -y vim net-tools usbutils htop ripgrep tmux wget mesa-utils xvfb libxtst6 libxv1 libglu1-mesa gdb bash-completion
|
RUN apt update && apt install -y vim net-tools usbutils htop ripgrep tmux wget mesa-utils xvfb libxtst6 libxv1 libglu1-mesa gdb bash-completion
|
||||||
RUN pip install ipython jupyter jupyterlab
|
RUN python3 -m ensurepip --upgrade
|
||||||
|
RUN pip3 install ipython jupyter jupyterlab
|
||||||
|
|
||||||
RUN cd /tmp && \
|
RUN cd /tmp && \
|
||||||
ARCH=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \
|
ARCH=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \
|
||||||
|
|
|
@ -41,10 +41,10 @@ jobs:
|
||||||
if: github.repository == 'commaai/openpilot'
|
if: github.repository == 'commaai/openpilot'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: poetry lock
|
- name: uv lock
|
||||||
run: |
|
run: |
|
||||||
pip install poetry
|
pip install uv
|
||||||
poetry lock
|
uv lock
|
||||||
- name: pre-commit autoupdate
|
- name: pre-commit autoupdate
|
||||||
run: |
|
run: |
|
||||||
git config --global --add safe.directory '*'
|
git config --global --add safe.directory '*'
|
||||||
|
|
|
@ -62,7 +62,6 @@ jobs:
|
||||||
cd $GITHUB_WORKSPACE
|
cd $GITHUB_WORKSPACE
|
||||||
cp .pre-commit-config.yaml $STRIPPED_DIR
|
cp .pre-commit-config.yaml $STRIPPED_DIR
|
||||||
cp pyproject.toml $STRIPPED_DIR
|
cp pyproject.toml $STRIPPED_DIR
|
||||||
cp poetry.lock $STRIPPED_DIR
|
|
||||||
cd $STRIPPED_DIR
|
cd $STRIPPED_DIR
|
||||||
${{ env.RUN }} "unset PYTHONWARNINGS && SKIP=check-added-large-files,check-hooks-apply,check-useless-excludes pre-commit run --all && chmod -R 777 /tmp/pre-commit"
|
${{ env.RUN }} "unset PYTHONWARNINGS && SKIP=check-added-large-files,check-hooks-apply,check-useless-excludes pre-commit run --all && chmod -R 777 /tmp/pre-commit"
|
||||||
|
|
||||||
|
@ -86,7 +85,7 @@ jobs:
|
||||||
docker_hub_pat: ${{ secrets.DOCKER_HUB_PAT }}
|
docker_hub_pat: ${{ secrets.DOCKER_HUB_PAT }}
|
||||||
- uses: ./.github/workflows/compile-openpilot
|
- uses: ./.github/workflows/compile-openpilot
|
||||||
timeout-minutes: ${{ ((steps.restore-scons-cache.outputs.cache-hit == 'true') && 15 || 30) }} # allow more time when we missed the scons cache
|
timeout-minutes: ${{ ((steps.restore-scons-cache.outputs.cache-hit == 'true') && 15 || 30) }} # allow more time when we missed the scons cache
|
||||||
|
|
||||||
build_mac:
|
build_mac:
|
||||||
name: build macos
|
name: build macos
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
@ -102,7 +101,7 @@ jobs:
|
||||||
# package install has DeprecationWarnings
|
# package install has DeprecationWarnings
|
||||||
PYTHONWARNINGS: default
|
PYTHONWARNINGS: default
|
||||||
- name: Test openpilot environment
|
- name: Test openpilot environment
|
||||||
run: poetry run scons -h
|
run: . .venv/bin/activate && scons -h
|
||||||
|
|
||||||
static_analysis:
|
static_analysis:
|
||||||
name: static analysis
|
name: static analysis
|
||||||
|
|
|
@ -53,10 +53,8 @@ jobs:
|
||||||
python-version: '3.11.4'
|
python-version: '3.11.4'
|
||||||
- name: Installing pip
|
- name: Installing pip
|
||||||
run: pip install pip==24.0
|
run: pip install pip==24.0
|
||||||
- name: Installing poetry
|
- name: Installing uv
|
||||||
run: pip install poetry==1.7.0
|
run: pip install uv
|
||||||
- name: Installing python dependencies
|
|
||||||
run: poetry install --no-cache --no-root
|
|
||||||
- name: git LFS
|
- name: git LFS
|
||||||
run: git lfs pull
|
run: git lfs pull
|
||||||
- run: echo "CACHE_COMMIT_DATE=$(git log -1 --pretty='format:%cd' --date=format:'%Y-%m-%d-%H:%M')" >> $GITHUB_ENV
|
- run: echo "CACHE_COMMIT_DATE=$(git log -1 --pretty='format:%cd' --date=format:'%Y-%m-%d-%H:%M')" >> $GITHUB_ENV
|
||||||
|
@ -69,7 +67,7 @@ jobs:
|
||||||
scons-${{ runner.arch }}-ubuntu2004-${{ env.CACHE_COMMIT_DATE }}
|
scons-${{ runner.arch }}-ubuntu2004-${{ env.CACHE_COMMIT_DATE }}
|
||||||
scons-${{ runner.arch }}-ubuntu2004
|
scons-${{ runner.arch }}-ubuntu2004
|
||||||
- name: Building openpilot
|
- name: Building openpilot
|
||||||
run: poetry run scons -u -j$(nproc)
|
run: uv run scons -u -j$(nproc)
|
||||||
- name: Saving scons cache
|
- name: Saving scons cache
|
||||||
uses: actions/cache/save@v4
|
uses: actions/cache/save@v4
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
|
@ -100,6 +98,6 @@ jobs:
|
||||||
- name: Test environment
|
- name: Test environment
|
||||||
run: |
|
run: |
|
||||||
devcontainer exec --workspace-folder . scons -j$(nproc) cereal/ common/
|
devcontainer exec --workspace-folder . scons -j$(nproc) cereal/ common/
|
||||||
devcontainer exec --workspace-folder . pip install pip-install-test
|
devcontainer exec --workspace-folder . pip3 install pip-install-test
|
||||||
devcontainer exec --workspace-folder . touch /home/batman/.comma/auth.json
|
devcontainer exec --workspace-folder . touch /home/batman/.comma/auth.json
|
||||||
devcontainer exec --workspace-folder . sudo touch /root/test.txt
|
devcontainer exec --workspace-folder . sudo touch /root/test.txt
|
||||||
|
|
|
@ -19,7 +19,7 @@ repos:
|
||||||
- id: check-executables-have-shebangs
|
- id: check-executables-have-shebangs
|
||||||
- id: check-shebang-scripts-are-executable
|
- id: check-shebang-scripts-are-executable
|
||||||
- id: check-added-large-files
|
- id: check-added-large-files
|
||||||
exclude: '(docs/CARS.md)|(poetry.lock)|(third_party/acados/include/blasfeo/include/blasfeo_d_kernel.h)'
|
exclude: '(docs/CARS.md)|(uv.lock)|(third_party/acados/include/blasfeo/include/blasfeo_d_kernel.h)'
|
||||||
args:
|
args:
|
||||||
- --maxkb=120
|
- --maxkb=120
|
||||||
- --enforce-all
|
- --enforce-all
|
||||||
|
@ -27,7 +27,7 @@ repos:
|
||||||
rev: v2.3.0
|
rev: v2.3.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: codespell
|
- id: codespell
|
||||||
exclude: '^(third_party/)|(body/)|(msgq/)|(panda/)|(opendbc/)|(rednose/)|(rednose_repo/)|(teleoprtc/)|(teleoprtc_repo/)|(selfdrive/ui/translations/.*.ts)|(poetry.lock)'
|
exclude: '^(third_party/)|(body/)|(msgq/)|(panda/)|(opendbc/)|(rednose/)|(rednose_repo/)|(teleoprtc/)|(teleoprtc_repo/)|(selfdrive/ui/translations/.*.ts)|(uv.lock)'
|
||||||
args:
|
args:
|
||||||
# if you've got a short variable name that's getting flagged, add it here
|
# if you've got a short variable name that's getting flagged, add it here
|
||||||
- -L bu,ro,te,ue,alo,hda,ois,nam,nams,ned,som,parm,setts,inout,warmup,bumb,nd,sie,preints,whit,indexIn
|
- -L bu,ro,te,ue,alo,hda,ois,nam,nams,ned,som,parm,setts,inout,warmup,bumb,nd,sie,preints,whit,indexIn
|
||||||
|
@ -92,13 +92,6 @@ repos:
|
||||||
language: system
|
language: system
|
||||||
pass_filenames: false
|
pass_filenames: false
|
||||||
files: '^selfdrive/ui/translations/'
|
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
|
- repo: https://github.com/python-jsonschema/check-jsonschema
|
||||||
rev: 0.28.5
|
rev: 0.28.5
|
||||||
hooks:
|
hooks:
|
||||||
|
|
|
@ -68,16 +68,15 @@ RUN usermod -aG sudo $USER
|
||||||
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
||||||
USER $USER
|
USER $USER
|
||||||
|
|
||||||
COPY --chown=$USER pyproject.toml poetry.lock /tmp/
|
COPY --chown=$USER pyproject.toml uv.lock /tmp/
|
||||||
COPY --chown=$USER tools/install_python_dependencies.sh /tmp/tools/
|
COPY --chown=$USER tools/install_python_dependencies.sh /tmp/tools/
|
||||||
|
|
||||||
ENV POETRY_VIRTUALENVS_CREATE=false
|
ENV VIRTUAL_ENV=/home/$USER/.venv
|
||||||
ENV VIRTUAL_ENV=/home/$USER/venv/.venv
|
|
||||||
RUN python3 -m venv $VIRTUAL_ENV
|
|
||||||
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||||
RUN . $VIRTUAL_ENV/bin/activate && \
|
RUN cd /tmp && \
|
||||||
cd /tmp && \
|
|
||||||
tools/install_python_dependencies.sh && \
|
tools/install_python_dependencies.sh && \
|
||||||
|
mkdir -p $VIRTUAL_ENV && \
|
||||||
|
cp -r /tmp/.venv/* $VIRTUAL_ENV && \
|
||||||
rm -rf /tmp/* && \
|
rm -rf /tmp/* && \
|
||||||
rm -rf /home/$USER/.cache
|
rm -rf /home/$USER/.cache
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
255
pyproject.toml
255
pyproject.toml
|
@ -1,12 +1,140 @@
|
||||||
[project]
|
[project]
|
||||||
name = "openpilot"
|
name = "openpilot"
|
||||||
requires-python = ">= 3.11"
|
requires-python = ">= 3.11"
|
||||||
readme = "README.md"
|
|
||||||
license = {text = "MIT License"}
|
license = {text = "MIT License"}
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "an open source driver assistance system"
|
||||||
|
authors = [
|
||||||
|
{name ="Vehicle Researcher", email="user@comma.ai"}
|
||||||
|
]
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
# multiple users
|
||||||
|
"sounddevice", # micd + soundd
|
||||||
|
"pyserial", # pigeond + qcomgpsd
|
||||||
|
"requests", # many one-off uses
|
||||||
|
"sympy", # rednose + friends
|
||||||
|
"crcmod", # cars + qcomgpsd
|
||||||
|
"tqdm", # cars (fw_versions.py) on start + many one-off uses
|
||||||
|
|
||||||
|
# hardwared
|
||||||
|
"smbus2", # configuring amp
|
||||||
|
|
||||||
|
# core
|
||||||
|
"cffi",
|
||||||
|
"scons",
|
||||||
|
"pycapnp",
|
||||||
|
"Cython",
|
||||||
|
"setuptools",
|
||||||
|
"numpy < 2.0.0", # control does not support numpy 2
|
||||||
|
|
||||||
|
# body / webrtcd
|
||||||
|
"aiohttp",
|
||||||
|
"aiortc",
|
||||||
|
"pyaudio",
|
||||||
|
|
||||||
|
# panda
|
||||||
|
"libusb1",
|
||||||
|
"spidev; platform_system == 'Linux'",
|
||||||
|
|
||||||
|
# modeld
|
||||||
|
"onnx >= 1.14.0",
|
||||||
|
"onnxruntime >=1.16.3; platform_system == 'Linux' and platform_machine == 'aarch64'",
|
||||||
|
"onnxruntime-gpu >=1.16.3; platform_system == 'Linux' and platform_machine == 'x86_64'",
|
||||||
|
|
||||||
|
# logging
|
||||||
|
"pyzmq",
|
||||||
|
"sentry-sdk",
|
||||||
|
|
||||||
|
# athena
|
||||||
|
"PyJWT",
|
||||||
|
"json-rpc",
|
||||||
|
"websocket_client",
|
||||||
|
|
||||||
|
# acados deps
|
||||||
|
"casadi",
|
||||||
|
"future-fstrings",
|
||||||
|
|
||||||
|
# these should be removed
|
||||||
|
"psutil",
|
||||||
|
"pycryptodome", # used in updated/casync, panda, body, and a test
|
||||||
|
|
||||||
|
#logreader
|
||||||
|
"zstd",
|
||||||
|
]
|
||||||
|
|
||||||
|
[project.optional-dependencies]
|
||||||
|
docs = [
|
||||||
|
"Jinja2",
|
||||||
|
"sphinx",
|
||||||
|
"sphinx-rtd-theme",
|
||||||
|
"sphinx-sitemap"
|
||||||
|
]
|
||||||
|
|
||||||
|
testing = [
|
||||||
|
"coverage",
|
||||||
|
"hypothesis ==6.47.*",
|
||||||
|
"mypy",
|
||||||
|
"pre-commit",
|
||||||
|
"pytest",
|
||||||
|
"pytest-cov",
|
||||||
|
"pytest-cpp",
|
||||||
|
"pytest-subtests",
|
||||||
|
"pytest-xdist",
|
||||||
|
"pytest-timeout",
|
||||||
|
"pytest-randomly",
|
||||||
|
"pytest-asyncio",
|
||||||
|
"pytest-mock",
|
||||||
|
"pytest-repeat",
|
||||||
|
"ruff"
|
||||||
|
]
|
||||||
|
|
||||||
|
dev = [
|
||||||
|
"av",
|
||||||
|
"azure-identity",
|
||||||
|
"azure-storage-blob",
|
||||||
|
"breathe",
|
||||||
|
"control",
|
||||||
|
"dictdiffer",
|
||||||
|
"flaky",
|
||||||
|
"inputs",
|
||||||
|
"lru-dict",
|
||||||
|
"matplotlib",
|
||||||
|
"metadrive-simulator; platform_machine != 'aarch64'",
|
||||||
|
"mpld3",
|
||||||
|
"myst-parser",
|
||||||
|
"natsort",
|
||||||
|
"opencv-python-headless",
|
||||||
|
"parameterized >=0.8, <0.9",
|
||||||
|
#pprofile = "*"
|
||||||
|
"pyautogui",
|
||||||
|
"pygame",
|
||||||
|
"pyopencl; platform_machine != 'aarch64'", # broken on arm64
|
||||||
|
"pywinctl",
|
||||||
|
"pyprof2calltree",
|
||||||
|
"rerun-sdk",
|
||||||
|
"tabulate",
|
||||||
|
"types-requests",
|
||||||
|
"types-tabulate",
|
||||||
|
|
||||||
|
# this is only pinned since 5.15.11 is broken
|
||||||
|
"pyqt5 ==5.15.2; platform_machine == 'x86_64'", # no aarch64 wheels for macOS/linux
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.uv.sources]
|
||||||
|
metadrive-simulator = { git = "https://github.com/commaai/metadrive.git", branch = "opencv_headless" }
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
Homepage = "https://comma.ai"
|
Homepage = "https://comma.ai"
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["hatchling"]
|
||||||
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
|
[tool.hatch.build.targets.wheel]
|
||||||
|
packages = [ "." ]
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
minversion = "6.0"
|
minversion = "6.0"
|
||||||
addopts = "--ignore=openpilot/ --ignore=cereal/ --ignore=opendbc/ --ignore=panda/ --ignore=rednose_repo/ --ignore=tinygrad_repo/ --ignore=teleoprtc_repo/ -Werror --strict-config --strict-markers --durations=10 -n auto --dist=loadgroup"
|
addopts = "--ignore=openpilot/ --ignore=cereal/ --ignore=opendbc/ --ignore=panda/ --ignore=rednose_repo/ --ignore=tinygrad_repo/ --ignore=teleoprtc_repo/ -Werror --strict-config --strict-markers --durations=10 -n auto --dist=loadgroup"
|
||||||
|
@ -75,131 +203,6 @@ warn_return_any=true
|
||||||
# allow implicit optionals for default args
|
# allow implicit optionals for default args
|
||||||
implicit_optional = true
|
implicit_optional = true
|
||||||
|
|
||||||
|
|
||||||
[tool.poetry]
|
|
||||||
name = "openpilot"
|
|
||||||
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"
|
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
|
||||||
python = ">=3.11, <3.13"
|
|
||||||
|
|
||||||
# multiple users
|
|
||||||
sounddevice = "*" # micd + soundd
|
|
||||||
pyserial = "*" # pigeond + qcomgpsd
|
|
||||||
requests = "*" # many one-off uses
|
|
||||||
sympy = "*" # rednose + friends
|
|
||||||
crcmod = "*" # cars + qcomgpsd
|
|
||||||
tqdm = "*" # cars (fw_versions.py) on start + many one-off uses
|
|
||||||
|
|
||||||
# hardwared
|
|
||||||
smbus2 = "*" # configuring amp
|
|
||||||
|
|
||||||
# core
|
|
||||||
cffi = "*"
|
|
||||||
scons = "*"
|
|
||||||
pycapnp = "*"
|
|
||||||
Cython = "*"
|
|
||||||
setuptools = "*"
|
|
||||||
numpy = "*"
|
|
||||||
|
|
||||||
# body / webrtcd
|
|
||||||
aiohttp = "*"
|
|
||||||
aiortc = "*"
|
|
||||||
pyaudio = "*"
|
|
||||||
|
|
||||||
# panda
|
|
||||||
libusb1 = "*"
|
|
||||||
spidev = { version = "*", platform = "linux" }
|
|
||||||
|
|
||||||
# modeld
|
|
||||||
onnx = ">=1.14.0"
|
|
||||||
onnxruntime = { version = ">=1.16.3", platform = "linux", markers = "platform_machine == 'aarch64'" }
|
|
||||||
onnxruntime-gpu = { version = ">=1.16.3", platform = "linux", markers = "platform_machine == 'x86_64'" }
|
|
||||||
|
|
||||||
# logging
|
|
||||||
pyzmq = "*"
|
|
||||||
sentry-sdk = "*"
|
|
||||||
|
|
||||||
# athena
|
|
||||||
PyJWT = "*"
|
|
||||||
json-rpc = "*"
|
|
||||||
websocket_client = "*"
|
|
||||||
|
|
||||||
# acados deps
|
|
||||||
casadi = "*"
|
|
||||||
future-fstrings = "*"
|
|
||||||
|
|
||||||
# these should be removed
|
|
||||||
psutil = "*"
|
|
||||||
pycryptodome = "*" # used in updated/casync, panda, body, and a test
|
|
||||||
|
|
||||||
#logreader
|
|
||||||
zstd = "*"
|
|
||||||
|
|
||||||
[tool.poetry.group.docs.dependencies]
|
|
||||||
Jinja2 = "*"
|
|
||||||
sphinx = "*"
|
|
||||||
sphinx-rtd-theme = "*"
|
|
||||||
sphinx-sitemap = "*"
|
|
||||||
|
|
||||||
[tool.poetry.group.testing.dependencies]
|
|
||||||
coverage = "*"
|
|
||||||
hypothesis = "~6.47"
|
|
||||||
mypy = "*"
|
|
||||||
pre-commit = "*"
|
|
||||||
pytest = "*"
|
|
||||||
pytest-cov = "*"
|
|
||||||
pytest-cpp = "*"
|
|
||||||
pytest-subtests = "*"
|
|
||||||
pytest-xdist = "*"
|
|
||||||
pytest-timeout = "*"
|
|
||||||
pytest-randomly = "*"
|
|
||||||
pytest-asyncio = "*"
|
|
||||||
pytest-mock = "*"
|
|
||||||
pytest-repeat = "*"
|
|
||||||
ruff = "*"
|
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
|
||||||
av = "*"
|
|
||||||
azure-identity = "*"
|
|
||||||
azure-storage-blob = "*"
|
|
||||||
breathe = "*"
|
|
||||||
control = "*"
|
|
||||||
dictdiffer = "*"
|
|
||||||
flaky = "*"
|
|
||||||
inputs = "*"
|
|
||||||
lru-dict = "*"
|
|
||||||
matplotlib = "*"
|
|
||||||
metadrive-simulator = { git = "https://github.com/commaai/metadrive.git", branch = "anisotropic_off", markers = "platform_machine != 'aarch64'" } # no linux/aarch64 wheels for certain dependencies
|
|
||||||
mpld3 = "*"
|
|
||||||
myst-parser = "*"
|
|
||||||
natsort = "*"
|
|
||||||
opencv-python-headless = "*"
|
|
||||||
parameterized = "^0.8"
|
|
||||||
#pprofile = "*"
|
|
||||||
pyautogui = "*"
|
|
||||||
pygame = "*"
|
|
||||||
pyopencl = { version = "*", markers = "platform_machine != 'aarch64'" } # broken on arm64
|
|
||||||
pywinctl = "*"
|
|
||||||
pyprof2calltree = "*"
|
|
||||||
rerun-sdk = "*"
|
|
||||||
tabulate = "*"
|
|
||||||
types-requests = "*"
|
|
||||||
types-tabulate = "*"
|
|
||||||
|
|
||||||
# this is only pinned since 5.15.11 is broken
|
|
||||||
pyqt5 = { version = "==5.15.2", markers = "platform_machine == 'x86_64'" } # no aarch64 wheels for macOS/linux
|
|
||||||
|
|
||||||
[build-system]
|
|
||||||
requires = ["poetry-core"]
|
|
||||||
build-backend = "poetry.core.masonry.api"
|
|
||||||
|
|
||||||
# https://beta.ruff.rs/docs/configuration/#using-pyprojecttoml
|
# https://beta.ruff.rs/docs/configuration/#using-pyprojecttoml
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
indent-width = 2
|
indent-width = 2
|
||||||
|
|
|
@ -23,7 +23,7 @@ blacklist = [
|
||||||
"^common/tests/",
|
"^common/tests/",
|
||||||
|
|
||||||
# particularly large text files
|
# particularly large text files
|
||||||
"poetry.lock",
|
"uv.lock",
|
||||||
"third_party/catch2",
|
"third_party/catch2",
|
||||||
"selfdrive/car/tests/test_models.*",
|
"selfdrive/car/tests/test_models.*",
|
||||||
|
|
||||||
|
|
|
@ -26,16 +26,23 @@ git clone --recurse-submodules https://github.com/commaai/openpilot.git
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
cd openpilot
|
cd openpilot
|
||||||
git lfs pull
|
|
||||||
tools/ubuntu_setup.sh
|
tools/ubuntu_setup.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
Activate a shell with the Python dependencies installed:
|
**3. Git LFS**
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
poetry shell
|
git lfs pull
|
||||||
```
|
```
|
||||||
|
|
||||||
**3. Build openpilot**
|
**4. Activate a python shell**
|
||||||
|
|
||||||
|
Activate a shell with the Python dependencies installed:
|
||||||
|
``` bash
|
||||||
|
source .venv/bin/activate
|
||||||
|
```
|
||||||
|
|
||||||
|
**5. Build openpilot**
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
scons -u -j$(nproc)
|
scons -u -j$(nproc)
|
||||||
|
|
|
@ -8,22 +8,17 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||||
ROOT=$DIR/../
|
ROOT=$DIR/../
|
||||||
cd $ROOT
|
cd $ROOT
|
||||||
|
|
||||||
RC_FILE="${HOME}/.$(basename ${SHELL})rc"
|
if ! command -v "uv" > /dev/null 2>&1; then
|
||||||
if [ "$(uname)" == "Darwin" ] && [ $SHELL == "/bin/bash" ]; then
|
echo "installing uv..."
|
||||||
RC_FILE="$HOME/.bash_profile"
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
fi
|
UV_BIN='$HOME/.cargo/env'
|
||||||
|
ADD_PATH_CMD=". \"$UV_BIN\""
|
||||||
if ! command -v "poetry" > /dev/null 2>&1; then
|
|
||||||
echo "installing poetry..."
|
|
||||||
curl -sSL https://install.python-poetry.org | python3 -
|
|
||||||
POETRY_BIN='$HOME/.local/bin'
|
|
||||||
ADD_PATH_CMD="export PATH=\"$POETRY_BIN:\$PATH\""
|
|
||||||
eval $ADD_PATH_CMD
|
eval $ADD_PATH_CMD
|
||||||
printf "\n#poetry path\n$ADD_PATH_CMD\n" >> $RC_FILE
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
poetry config virtualenvs.prefer-active-python true --local
|
echo "installing python packages..."
|
||||||
poetry config virtualenvs.in-project true --local
|
uv sync --all-extras
|
||||||
|
source .venv/bin/activate
|
||||||
|
|
||||||
echo "PYTHONPATH=${PWD}" > $ROOT/.env
|
echo "PYTHONPATH=${PWD}" > $ROOT/.env
|
||||||
if [[ "$(uname)" == 'Darwin' ]]; then
|
if [[ "$(uname)" == 'Darwin' ]]; then
|
||||||
|
@ -32,15 +27,8 @@ if [[ "$(uname)" == 'Darwin' ]]; then
|
||||||
echo "export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES" >> $ROOT/.env
|
echo "export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES" >> $ROOT/.env
|
||||||
fi
|
fi
|
||||||
|
|
||||||
poetry self add poetry-dotenv-plugin@^0.1.0
|
|
||||||
|
|
||||||
echo "installing python packages..."
|
|
||||||
poetry install --no-cache --no-root
|
|
||||||
|
|
||||||
[ -n "$POETRY_VIRTUALENVS_CREATE" ] && RUN="" || RUN="poetry run"
|
|
||||||
|
|
||||||
if [ "$(uname)" != "Darwin" ] && [ -e "$ROOT/.git" ]; then
|
if [ "$(uname)" != "Darwin" ] && [ -e "$ROOT/.git" ]; then
|
||||||
echo "pre-commit hooks install..."
|
echo "pre-commit hooks install..."
|
||||||
$RUN pre-commit install
|
pre-commit install
|
||||||
$RUN git submodule foreach pre-commit install
|
git submodule foreach pre-commit install
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue