mirror of
https://github.com/commaai/agnos-builder.git
synced 2026-08-23 17:23:54 +08:00
Split out openpilot and agnos python dependencies (#265)
* make openpilot a dependency of agnos * cleaner curls [upload] * adding required dbus-python and pyopencl [upload] * check in openpilot pyproject.toml and uv.lock * ignore openpilot uv.lock * remove allow-direct-references * codespell: ignore openpilot python deps folder * use a uv workspace instead https://docs.astral.sh/uv/concepts/workspaces/ * codespell: ignore uv folder * uv lock in sync * agnos optional deps are never installed * uv temp fix for dbus-python error * uv agnos virtual * update openpilot pyproject.toml * also install openpilot testing * sourcing is needed [upload] * [upload] * update openpilot uv.lock * fix wrong env for uv sync * added openpilot[testing] * openpilot uv.lock is now workspace uv.lock * [upload] * no more uv.lock download * new uv.lock * openpilot[dev] + uv lock --upgrade * [upload] --------- Co-authored-by: Comma Device <device@comma.ai>
This commit is contained in:
@@ -19,7 +19,7 @@ repos:
|
||||
rev: v2.2.4
|
||||
hooks:
|
||||
- id: codespell
|
||||
exclude: '^(userspace/files/serviceproviders.xml)|(tools/)|(userspace/uv.lock)'
|
||||
exclude: '^(userspace/files/serviceproviders.xml)|(tools/)|(userspace/uv/)'
|
||||
args:
|
||||
# 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
|
||||
|
||||
+4
-3
@@ -98,8 +98,7 @@ RUN export MAKEFLAGS="-j$(nproc)" && \
|
||||
uv pip install /tmp/PyQt5-5.15.9-cp38-abi3-manylinux_2_17_aarch64.whl --verbose --config-settings="--confirm-license="
|
||||
|
||||
# Install openpilot python packages
|
||||
RUN mkdir -p /tmp/agnos/uv
|
||||
COPY ./userspace/pyproject.toml ./userspace/uv.lock /tmp/agnos/uv
|
||||
COPY ./userspace/uv /tmp/agnos/uv
|
||||
RUN source $XDG_DATA_HOME/venv/bin/activate && \
|
||||
cd /tmp/agnos/uv && \
|
||||
export PYOPENCL_CL_PRETEND_VERSION="2.0" && \
|
||||
@@ -110,7 +109,9 @@ RUN source $XDG_DATA_HOME/venv/bin/activate && \
|
||||
sed -i 's|prefix=/install|prefix='$pc'|' $pypcpath && \
|
||||
pypcpathembed=$pcpath"/python-3.12-embed.pc" && \
|
||||
sed -i 's|prefix=/install|prefix='$pc'|' $pypcpathembed && \
|
||||
MAKEFLAGS="-j$(nproc)" UV_NO_CACHE=1 uv pip install --no-cache-dir .
|
||||
export MAKEFLAGS="-j$(nproc)" && export UV_NO_CACHE=1 && \
|
||||
export UV_PROJECT_ENVIRONMENT=$XDG_DATA_HOME/venv && \
|
||||
uv sync --frozen
|
||||
|
||||
# Install nice to haves
|
||||
COPY ./userspace/install_extras.sh /tmp/agnos/
|
||||
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Make sure we're in the correct spot
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
cd $DIR
|
||||
|
||||
cd userspace/uv
|
||||
curl -sSo openpilot/pyproject.toml https://raw.githubusercontent.com/commaai/openpilot/master/pyproject.toml
|
||||
|
||||
export PYOPENCL_CL_PRETEND_VERSION="2.0" && \
|
||||
pc="$(python -c "import sysconfig;print(sysconfig.get_config_vars('installed_base')[0])")" && \
|
||||
pcpath=$pc"/lib/pkgconfig" && \
|
||||
export PKG_CONFIG_PATH="$pcpath:$PKG_CONFIG_PATH" && \
|
||||
uv lock --upgrade
|
||||
@@ -1,115 +0,0 @@
|
||||
[project]
|
||||
name = "agnos"
|
||||
version = "0.1.0"
|
||||
authors = [{name = "Vehicle Researcher", email = "user@comma.ai"}]
|
||||
requires-python = "~=3.11"
|
||||
description = ""
|
||||
dependencies = [
|
||||
"aiohttp",
|
||||
"aiortc",
|
||||
"atomicwrites",
|
||||
"casadi",
|
||||
"cffi",
|
||||
"crcmod",
|
||||
"cryptography",
|
||||
"cython",
|
||||
"dbus-python",
|
||||
"evdev",
|
||||
"flake8",
|
||||
"flask",
|
||||
"future-fstrings", # needed for acados
|
||||
"gunicorn",
|
||||
"hatanaka == 2.4",
|
||||
"hexdump",
|
||||
"hypothesis",
|
||||
"jinja2",
|
||||
"json-rpc",
|
||||
"libusb1",
|
||||
"markdown-it-py",
|
||||
"nose",
|
||||
"numpy < 2.0.0", # pending bumping in openpilot
|
||||
"onnx",
|
||||
"onnxruntime >= 1.16.3",
|
||||
"pillow",
|
||||
"protobuf",
|
||||
"psutil",
|
||||
"pyaudio",
|
||||
"pycapnp",
|
||||
"pyclean",
|
||||
"pycryptodome",
|
||||
"pydub",
|
||||
"pyjwt",
|
||||
"pylint",
|
||||
"pyopencl == 2024.1", # pinned until cmake update coming with 24.04
|
||||
"pyserial",
|
||||
"pytest",
|
||||
"pytest-asyncio",
|
||||
"pytest-cov",
|
||||
"pytest-cpp",
|
||||
"pytest-forked",
|
||||
"pytest-mock",
|
||||
"pytest-random-order",
|
||||
"pytest-randomly",
|
||||
"pytest-repeat",
|
||||
"pytest-subtests",
|
||||
"pytest-timeout",
|
||||
"pytest-xdist",
|
||||
"python-dateutil",
|
||||
"pyyaml",
|
||||
"pyzmq",
|
||||
"pyzstd",
|
||||
"requests",
|
||||
"scons",
|
||||
"sconscontrib",
|
||||
"sentry-sdk",
|
||||
"setproctitle",
|
||||
"six",
|
||||
"smbus2",
|
||||
"sounddevice",
|
||||
"spidev",
|
||||
"spidev2",
|
||||
"sympy != 1.6.1",
|
||||
"timezonefinder",
|
||||
"torch",
|
||||
"tqdm",
|
||||
"urllib3",
|
||||
"utm",
|
||||
"websocket-client",
|
||||
"zstandard",
|
||||
"zstd"
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
"ipython",
|
||||
"azure-identity",
|
||||
"azure-storage-blob",
|
||||
"pycurl",
|
||||
"git-pylint-commit-hook",
|
||||
"tenacity",
|
||||
"mock",
|
||||
"dictdiffer",
|
||||
"aenum",
|
||||
"coverage",
|
||||
"paramiko",
|
||||
"lru-dict",
|
||||
"pprofile",
|
||||
"pyprof2calltree",
|
||||
"pre-commit",
|
||||
"mypy",
|
||||
"parameterized",
|
||||
"inputs",
|
||||
"future-fstrings",
|
||||
"tabulate",
|
||||
"flaky"
|
||||
]
|
||||
|
||||
[tool.uv.sources]
|
||||
sconscontrib = { git = "https://github.com/SCons/scons-contrib.git" }
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = [ "." ]
|
||||
Generated
-3154
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,266 @@
|
||||
[project]
|
||||
name = "openpilot"
|
||||
requires-python = ">= 3.11"
|
||||
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",
|
||||
|
||||
# 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 >=3.6.6", # 3.12 fixed in 3.6.6
|
||||
"future-fstrings",
|
||||
|
||||
# these should be removed
|
||||
"psutil",
|
||||
"pycryptodome", # used in updated/casync, panda, body, and a test
|
||||
"setproctitle",
|
||||
|
||||
# logreader
|
||||
"zstandard",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
docs = [
|
||||
"Jinja2",
|
||||
"natsort",
|
||||
"mkdocs",
|
||||
]
|
||||
|
||||
testing = [
|
||||
"coverage",
|
||||
"hypothesis ==6.47.*",
|
||||
"mypy",
|
||||
"pytest",
|
||||
"pytest-cov",
|
||||
"pytest-cpp",
|
||||
"pytest-subtests",
|
||||
"pytest-xdist",
|
||||
"pytest-timeout",
|
||||
"pytest-randomly",
|
||||
"pytest-asyncio",
|
||||
"pytest-mock",
|
||||
"pytest-repeat",
|
||||
"ruff",
|
||||
"codespell",
|
||||
"pre-commit-hooks",
|
||||
]
|
||||
|
||||
dev = [
|
||||
"av",
|
||||
"azure-identity",
|
||||
"azure-storage-blob",
|
||||
"dictdiffer",
|
||||
"flaky",
|
||||
"inputs",
|
||||
"lru-dict",
|
||||
"matplotlib",
|
||||
"metadrive-simulator @ https://github.com/commaai/metadrive/releases/download/MetaDrive-minimal/metadrive_simulator-0.4.2.3-py3-none-any.whl ; (platform_machine != 'aarch64')",
|
||||
"parameterized >=0.8, <0.9",
|
||||
#"pprofile",
|
||||
"pyautogui",
|
||||
"pyopencl; platform_machine != 'aarch64'", # broken on arm64
|
||||
"pytools < 2024.1.11; platform_machine != 'aarch64'", # pyopencl use a broken version
|
||||
"pywinctl",
|
||||
"pyprof2calltree",
|
||||
"rerun-sdk >= 0.18",
|
||||
"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
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://comma.ai"
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = [ "." ]
|
||||
|
||||
[tool.hatch.metadata]
|
||||
allow-direct-references = true
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
minversion = "6.0"
|
||||
addopts = "--ignore=openpilot/ --ignore=opendbc/ --ignore=panda/ --ignore=rednose_repo/ --ignore=tinygrad_repo/ --ignore=teleoprtc_repo/ --ignore=msgq/ -Werror --strict-config --strict-markers --durations=10 -n auto --dist=loadgroup"
|
||||
cpp_files = "test_*"
|
||||
cpp_harness = "selfdrive/test/cpp_harness.py"
|
||||
python_files = "test_*.py"
|
||||
asyncio_default_fixture_loop_scope = "function"
|
||||
#timeout = "30" # you get this long by default
|
||||
markers = [
|
||||
"slow: tests that take awhile to run and can be skipped with -m 'not slow'",
|
||||
"tici: tests that are only meant to run on the C3/C3X",
|
||||
]
|
||||
testpaths = [
|
||||
"common",
|
||||
"selfdrive/pandad",
|
||||
"selfdrive/car",
|
||||
"selfdrive/opcar",
|
||||
"selfdrive/controls",
|
||||
"selfdrive/locationd",
|
||||
"selfdrive/monitoring",
|
||||
"selfdrive/test/longitudinal_maneuvers",
|
||||
"selfdrive/test/process_replay/test_fuzzy.py",
|
||||
"system/updated",
|
||||
"system/athena",
|
||||
"system/camerad",
|
||||
"system/hardware",
|
||||
"system/loggerd",
|
||||
"system/proclogd",
|
||||
"system/tests",
|
||||
"system/ubloxd",
|
||||
"system/webrtc",
|
||||
"tools/lib/tests",
|
||||
"tools/replay",
|
||||
"tools/cabana",
|
||||
"cereal/messaging/tests",
|
||||
]
|
||||
|
||||
[tool.codespell]
|
||||
quiet-level = 3
|
||||
# if you've got a short variable name that's getting flagged, add it here
|
||||
ignore-words-list = "bu,ro,te,ue,alo,hda,ois,nam,nams,ned,som,parm,setts,inout,warmup,bumb,nd,sie,preints,whit,indexIn,ws,uint,grey,deque,stdio,amin,BA,LITE,atEnd,UIs,errorString,arange,FocusIn,od,tim,relA,hist,copyable,jupyter,thead"
|
||||
builtin = "clear,rare,informal,code,names,en-GB_to_en-US"
|
||||
skip = "./third_party/*, ./tinygrad/*, ./tinygrad_repo/*, ./msgq/*, ./panda/*, ./opendbc/*, ./opendbc_repo/*, ./rednose/*, ./rednose_repo/*, ./teleoprtc/*, ./teleoprtc_repo/*, *.ts, uv.lock, *.onnx, ./cereal/gen/*, */c_generated_code/*"
|
||||
|
||||
[tool.mypy]
|
||||
python_version = "3.11"
|
||||
plugins = [
|
||||
"numpy.typing.mypy_plugin",
|
||||
]
|
||||
exclude = [
|
||||
"cereal/",
|
||||
"msgq/",
|
||||
"msgq_repo/",
|
||||
"opendbc/",
|
||||
"opendbc_repo/",
|
||||
"panda/",
|
||||
"rednose/",
|
||||
"rednose_repo/",
|
||||
"tinygrad/",
|
||||
"tinygrad_repo/",
|
||||
"teleoprtc/",
|
||||
"teleoprtc_repo/",
|
||||
"third_party/",
|
||||
]
|
||||
|
||||
# third-party packages
|
||||
ignore_missing_imports=true
|
||||
|
||||
# helpful warnings
|
||||
warn_redundant_casts=true
|
||||
warn_unreachable=true
|
||||
warn_unused_ignores=true
|
||||
|
||||
# restrict dynamic typing
|
||||
warn_return_any=true
|
||||
|
||||
# allow implicit optionals for default args
|
||||
implicit_optional = true
|
||||
|
||||
local_partial_types=true
|
||||
explicit_package_bases=true
|
||||
disable_error_code = "annotation-unchecked"
|
||||
|
||||
# https://beta.ruff.rs/docs/configuration/#using-pyprojecttoml
|
||||
[tool.ruff]
|
||||
indent-width = 2
|
||||
lint.select = [
|
||||
"E", "F", "W", "PIE", "C4", "ISC", "A", "B",
|
||||
"NPY", # numpy
|
||||
"UP", # pyupgrade
|
||||
"TRY302", "TRY400", "TRY401", # try/excepts
|
||||
"RUF008", "RUF100",
|
||||
"TID251",
|
||||
"PLR1704",
|
||||
]
|
||||
lint.ignore = [
|
||||
"E741",
|
||||
"E402",
|
||||
"C408",
|
||||
"ISC003",
|
||||
"B027",
|
||||
"B024",
|
||||
"NPY002", # new numpy random syntax is worse
|
||||
"UP038", # (x, y) -> x|y for isinstance
|
||||
]
|
||||
line-length = 160
|
||||
target-version ="py311"
|
||||
exclude = [
|
||||
"body",
|
||||
"cereal",
|
||||
"panda",
|
||||
"opendbc",
|
||||
"rednose_repo",
|
||||
"tinygrad_repo",
|
||||
"teleoprtc",
|
||||
"teleoprtc_repo",
|
||||
"third_party",
|
||||
"*.ipynb",
|
||||
]
|
||||
lint.flake8-implicit-str-concat.allow-multiline = false
|
||||
|
||||
[tool.ruff.lint.flake8-tidy-imports.banned-api]
|
||||
"selfdrive".msg = "Use openpilot.selfdrive"
|
||||
"common".msg = "Use openpilot.common"
|
||||
"system".msg = "Use openpilot.system"
|
||||
"third_party".msg = "Use openpilot.third_party"
|
||||
"tools".msg = "Use openpilot.tools"
|
||||
"pytest.main".msg = "pytest.main requires special handling that is easy to mess up!"
|
||||
"unittest".msg = "Use pytest"
|
||||
|
||||
[tool.coverage.run]
|
||||
concurrency = ["multiprocessing", "thread"]
|
||||
|
||||
[tool.ruff.format]
|
||||
quote-style = "preserve"
|
||||
@@ -0,0 +1,21 @@
|
||||
[project]
|
||||
name = "agnos"
|
||||
version = "0.1.0"
|
||||
authors = [{name = "Vehicle Researcher", email = "user@comma.ai"}]
|
||||
requires-python = "~=3.11"
|
||||
description = ""
|
||||
dependencies = [
|
||||
"openpilot",
|
||||
"openpilot[dev]",
|
||||
"openpilot[testing]",
|
||||
# required
|
||||
"dbus-python",
|
||||
# tinygrad
|
||||
"pyopencl == 2024.1", # pinned until cmake update coming with 24.04
|
||||
]
|
||||
|
||||
[tool.uv.sources]
|
||||
openpilot = { workspace = true }
|
||||
|
||||
[tool.uv.workspace]
|
||||
members = ["openpilot"]
|
||||
Generated
+5425
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user