Files
sunnypilot/pyproject.toml
T
Adeeb Shihadeh 1e49eac4d1 rm libyuv (#38306)
* rm libyuv

* cleanup
2026-07-08 20:27:27 -07:00

229 lines
6.2 KiB
TOML

[project]
name = "openpilot"
requires-python = ">= 3.12.3, < 3.13"
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-plus", # cars + qcomgpsd
"tqdm", # cars (fw_versions.py) on start + many one-off uses
# core
"cffi",
"scons",
"pycapnp==2.1.0", # 2.2 introduces a memory leak due to cyclic references
"Cython",
"setuptools",
"numpy >=2.0",
# vendored native dependencies
"comma-deps-bzip2",
"comma-deps-bootstrap-icons",
"comma-deps-capnproto",
"comma-deps-catch2",
"comma-deps-acados",
"comma-deps-eigen",
"comma-deps-ffmpeg",
"comma-deps-zstd",
"comma-deps-ncurses",
"comma-deps-zeromq",
"comma-deps-libusb",
"comma-deps-json11",
"comma-deps-git-lfs",
"comma-deps-gcc-arm-none-eabi",
# body / webrtcd
"av",
"aiortc",
# logging
"pyzmq",
"sentry-sdk",
"xattr", # used in place of 'os.getxattr' for macOS compatibility
# athena
"PyJWT",
"json-rpc",
"websocket_client",
# joystickd
"inputs",
# these should be removed
"psutil",
"setproctitle",
# logreader
"zstandard",
# ui
"comma-deps-raylib",
"qrcode",
"jeepney",
"pillow",
]
[project.optional-dependencies]
docs = [
"Jinja2",
"zensical",
]
testing = [
"coverage",
"hypothesis ==6.47.*",
"ty",
"pytest",
"pytest-cpp",
"pytest-subtests",
# https://github.com/pytest-dev/pytest-xdist/pull/1229
"pytest-xdist @ git+https://github.com/sshane/pytest-xdist@2b4372bd62699fb412c4fe2f95bf9f01bd2018da",
"pytest-mock",
"ruff",
"codespell",
"pre-commit-hooks",
]
dev = [
"matplotlib",
]
tools = [
"comma-deps-imgui",
# this can be added back once it's stripped down some more
#"metadrive-simulator @ git+https://github.com/commaai/metadrive.git@minimal ; (platform_machine != 'aarch64')",
]
[project.urls]
Homepage = "https://github.com/commaai/openpilot"
[dependency-groups]
submodules = [
"msgq",
"opendbc",
"pandacan",
"rednose",
"teleoprtc",
"tinygrad",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = [
"openpilot",
]
[tool.hatch.metadata]
allow-direct-references = true
[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-Werror --strict-config --strict-markers --durations=10 -n auto --dist=loadgroup"
cpp_files = "test_*"
cpp_harness = "openpilot/selfdrive/test/cpp_harness.py"
python_files = "test_*.py"
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",
"skip_tici_setup: mark test to skip tici setup fixture",
"nocapture: don't capture test output",
"shared_download_cache: share download cache between tests",
"xdist_group_class_property: group tests by a property of the class that contains them",
]
testpaths = [
"openpilot",
]
[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,TGE,abl,lite,ser"
builtin = "clear,rare,informal,code,names,en-GB_to_en-US"
skip = "*.po, uv.lock, *.onnx, *.pem, */c_generated_code/*, docs/assets/*, openpilot/tools/plotjuggler/layouts/*, openpilot/selfdrive/assets/offroad/mici_fcc.html"
# https://docs.astral.sh/ruff/configuration/#using-pyprojecttoml
[tool.ruff]
indent-width = 2
lint.select = [
"E", "F", "W", "PIE", "C4", "ISC", "A", "B",
"NPY", # numpy
"UP", # pyupgrade
"TRY203", "TRY400", "TRY401", # try/excepts
"RUF008", "RUF100",
"TID251",
"PLE", "PLR1704",
]
lint.ignore = [
"E741",
"E402",
"C408",
"ISC003",
"B027",
"B024",
"NPY002", # new numpy random syntax is worse
"UP045", "UP007", # these don't play nice with raylib atm
]
line-length = 160
exclude = [
"openpilot/cereal",
"*.ipynb",
"generated",
]
lint.flake8-implicit-str-concat.allow-multiline = false
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"pytest.main".msg = "pytest.main requires special handling that is easy to mess up!"
"unittest".msg = "Use pytest"
"time.time".msg = "Use time.monotonic"
# raylib banned APIs
"pyray.measure_text_ex".msg = "Use openpilot.system.ui.lib.text_measure"
"pyray.is_mouse_button_pressed".msg = "This can miss events. Use Widget._handle_mouse_press"
"pyray.is_mouse_button_released".msg = "This can miss events. Use Widget._handle_mouse_release"
"pyray.draw_text".msg = "Use a function (such as rl.draw_font_ex) that takes font as an argument"
"pyray.draw_texture".msg = "Use rl.draw_texture_ex for float position support"
[tool.ruff.format]
quote-style = "preserve"
[tool.ty.rules]
unresolved-import = "ignore" # Cython-compiled modules (.pyx)
unresolved-attribute = "ignore" # many from capnp and Cython modules
invalid-method-override = "ignore" # signature variance issues
possibly-missing-attribute = "ignore" # too many false positives
invalid-assignment = "ignore" # often intentional monkey-patching
no-matching-overload = "ignore" # numpy/ctypes overload matching issues
invalid-argument-type = "ignore" # many false positives from raylib, ctypes, numpy
call-non-callable = "ignore" # false positives from dynamic types
unsupported-operator = "ignore" # false positives from dynamic types
not-subscriptable = "ignore" # false positives from dynamic types
[tool.uv]
python-preference = "only-managed"
default-groups = ["submodules"]
override-dependencies = [
"opendbc", # panda pins opendbc from git for standalone use; always use our submodule
"av", # teleoprtc's av<13 pin is stale
]
[tool.uv.sources]
msgq = { path = "msgq_repo", editable = true }
opendbc = { path = "opendbc_repo", editable = true }
pandacan = { path = "panda", editable = true }
rednose = { path = "rednose_repo", editable = true }
teleoprtc = { path = "teleoprtc_repo", editable = true }
tinygrad = { path = "tinygrad_repo", editable = true }