Files
onepilot/pyproject.toml

252 lines
7.4 KiB
TOML
Raw Normal View History

[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
2025-12-29 16:41:52 -08:00
"crcmod-plus", # cars + qcomgpsd
"tqdm", # cars (fw_versions.py) on start + many one-off uses
# core
"cffi",
"scons",
2026-02-20 18:35:24 -08:00
"pycapnp",
"Cython",
"setuptools",
2025-07-12 13:16:14 -07:00
"numpy >=2.0",
# vendored native dependencies
"bzip2 @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=bzip2",
"capnproto @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=capnproto",
"eigen @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=eigen",
"ffmpeg @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=ffmpeg",
2026-02-24 12:00:39 -08:00
"libjpeg @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=libjpeg",
"libyuv @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=libyuv",
"python3-dev @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=python3-dev",
2026-02-23 23:02:53 -08:00
"zstd @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=zstd",
"ncurses @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=ncurses",
"zeromq @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=zeromq",
"git-lfs @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=git-lfs",
"gcc-arm-none-eabi @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=gcc-arm-none-eabi",
# body / webrtcd
2026-02-20 18:35:24 -08:00
"av",
"aiohttp",
"aiortc",
# panda
"libusb1",
"spidev; platform_system == 'Linux'",
# logging
"pyzmq",
"sentry-sdk",
2025-12-21 16:49:15 -08:00
"xattr", # used in place of 'os.getxattr' for macOS compatibility
# athena
"PyJWT",
"json-rpc",
"websocket_client",
# acados deps
"casadi >=3.6.6", # 3.12 fixed in 3.6.6
# joystickd
"inputs",
# these should be removed
"psutil",
"pycryptodome", # used in updated/casync, panda, body, and a test
"setproctitle",
# logreader
"zstandard",
# ui
2025-12-21 16:49:15 -08:00
"raylib > 5.5.0.3",
"qrcode",
"jeepney",
2026-03-04 12:36:40 -08:00
"pillow",
]
[project.optional-dependencies]
docs = [
"Jinja2",
"mkdocs",
]
testing = [
"coverage",
"hypothesis ==6.47.*",
2025-12-28 10:42:49 -08:00
"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-asyncio",
"pytest-mock",
"ruff",
"codespell",
"pre-commit-hooks",
]
dev = [
"matplotlib",
"opencv-python-headless",
]
tools = [
"metadrive-simulator @ git+https://github.com/commaai/metadrive.git@minimal ; (platform_machine != 'aarch64')",
]
[project.urls]
Homepage = "https://github.com/commaai/openpilot"
[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"
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"
]
testpaths = [
"common",
"selfdrive",
"system",
"tools",
"cereal",
Modular Assistive Driving System (MADS) (#446) * allow re-regage * bump opendbc * bump panda * apply pause/resume fix for hyundai (should do this in a separate PR) * bump opendbc * fix * rename * Fix? * make sure to disengage for allow always cars * fix * combine * more fix * not needed * check if engagement is from openpilot's state machine * Rename * fix panda safety * fix * no fake lfa button for @devtekve ;) * fix non drive gear re-engage * fix settings * combine * add replace method * use replace * remoev already checks if it exists * fix * group * add todo * reserve events * cleaner * hyundai: only allow for cars with lfa button * sunnyParams * make sure it's car only * Move car-specific changes to opendbc * no need * bump opendbc * more fixes * no more available * more! * final? * always emit user disable * no longer needed * move unit test * add sunnypilot to unit tests * bump opendbc * use new cereal * bump opendbc * static analysis * no unittest * no need available * UI border update * show MADS updates * Add TODO * no longer needed * fix changed events * fix cluster enabled * don't add pre enable if not long * should use enabled * enabled <-> active * better format * bump opendbc * static analysis * static analysis * Rename test as collector was dying * Show our overriding * Revert "show MADS updates" This reverts commit daf0ad62 Revert "fix changed events" This reverts commit 31d8c97f * ignoring reserved events * adjusting creation delays * back to stock removing allow_cancel * should be enabled * revert * silent lkas disable * no need * user disable tests * just warning * MUST REMOVE test process replay * fix no entry * fixme * bump opendbc * need this check * cleanup * allow entering paused state if no entry from disabled * brake hold should apply to all * in lists * update unit test * simpler * unused * same thing * fix * only mads in enabled state and long in disabled state * unify silent enable * do this for dlob * bump submodules * fix * bump submodules * bump opendbc * less frequent * more events * fix * allow no entry to paused for non-drive gears * fix * use cereal * Revert "allow no entry to paused for non-drive gears" This reverts commit 6d64a4dd9c6de5ad14ef1e88dbc3b6ad174232d8. * allow in all * Revert "allow in all" This reverts commit 6375f1489176dc6c69cb7fa388676e482713f80a. * should not be all! * rename for clarity * silent park brake * flipped * bump submodules * Bump to latest mads-new panda * bump panda * more nissan * bump panda * bump msgq * bump panda * bump submodules * bump opendbc * bump opendbc * improving the state * Revert "PlayStation® model (#34133)" This reverts commit 5160bee5437e58ab0ace59c6db1c6d7b416c4025. * should be none * bump panda * bump opendbc * Apply suggestions from code review * bump panda * bump ref panda * add todo-sp * bump panda ref * bump more panda * changing refs * nuke nuke nuke * use sunny's newer states * bump with new panda * bump panda * Parse more flags from alt exp, more tests, hyundai main cruise allowed * Parse more flags from alt exp, more tests, hyundai main cruise allowed * missed * mutation for controls allowed rising edge * ford mutation * license * remove * unused * bump submodules * use always allowed mads button alt exp * fix * whitelist jason's lastname to codespell * test_processes: update ref logs to 82c0278 * bump submodules * bump submodules * bump submodules * bump panda * add controls mismatch lateral event * Simplify lateral disengagement logic for MADS configuration Reversed the conditional to align the logic with the `disengage_lateral_on_brake` parameter. This ensures that lateral disengagement behavior is more intuitive and matches the expected configuration. Improves code readability and reduces potential misconfigurations. * remove unified engagement mode in panda * controls allow should be allowed at all times * squash! treat MADS button as user entry * heartbeat for mads * heartbeat mismatch exit control * remove always allow mads button from alt * move to safety_mads * remove main cruise allowed from alt * bump panda * heartbeat engaged mads mismatch mutation test * bump panda * use mads the third panda * ignore pre enable with mads * only force exit if actually actuating * use brake signal instead of pedal events when dlob is active * fix tests * fix panda tests * bump panda * new events to retain long blocks * format * uem: do not engage mads if long is engaged * bump submodules * fix not allowed engaged bug * block uem from engaging * flipped * use different heartbeat check if dlob * hard code to skip heartbeat check * remove toyota lta status for lkas, causes weird behaviors * block tesla * bump panda * bump to merged panda * bump opendbc * bump opendbc * bump opendbc * bump opendbc * Apply suggestions from code review * code ignore spells * needs to be in carstate * Bump opendbc * Update MADS toggle descriptions for clarity. Added notes to clarify behavior of the "MadsMainCruiseAllowed" setting, particularly its impact on vehicles without LFA/LKAS buttons. This ensures users are informed about potential implications when disabling this feature. * Updating translations + Adding spanish * Disengage Lateral on Brake -> Pause Lateral on Brake * test_processes: update ref logs to dd41005 * Apply suggestions from code review * fix mads button not allowed * bump submodules * bump submodule * test_processes: update ref logs to 0a0b998 * has multiple lists * Revert "has multiple lists" This reverts commit a37c1d26feac02f63bfb86a08f9b6fb06b095cf1. * base * Reapply "has multiple lists" This reverts commit d1cd8dcc815721a4113b26ab98ee2571c071e225. * migrate mads toggles to sp panel * this is why it keeps crashing * house keeping * more housekeeping * more housekeeping * don't show description by default (yet) * reset to main panel when clicked away * more * some more with interactions * don't stretch cause it looks weird with descriptions * simpler to handle offroad transition * some are toggleable while onroad * remove unused event * slight cleanup * default to true for HKG main cruise toggle * append to list after * add Customize MADS to UI preview * simpler * move to sp list * how tf was this removed * update mads settings button on show event * test_processes: update ref logs to efa9c32 --------- Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
2025-01-05 02:48:02 +01:00
"sunnypilot",
]
[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"
2025-11-17 21:40:08 -08:00
skip = "./third_party/*, ./tinygrad/*, ./tinygrad_repo/*, ./msgq/*, ./panda/*, ./opendbc/*, ./opendbc_repo/*, ./rednose/*, ./rednose_repo/*, ./teleoprtc/*, ./teleoprtc_repo/*, *.po, uv.lock, *.onnx, ./cereal/gen/*, */c_generated_code/*, docs/assets/*, tools/plotjuggler/layouts/*, 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
2025-11-17 22:40:33 -08:00
"UP045", "UP007", # these don't play nice with raylib atm
]
line-length = 160
target-version ="py311"
exclude = [
"body",
"cereal",
"panda",
"opendbc",
"opendbc_repo",
"rednose_repo",
"tinygrad_repo",
webrtcd: webrtc streaming server (audio/video/cereal) (#30186) * WebRTCClient and WebRTCServer abstractions * webrtc client implementation * Interactive test scripts * Send localDescriptions as offer/asnwer, as they are different * Tracks need to be added after setting remote description for multi-cam streaming to work * Remove WebRTCStreamingMetadata * Wait for tracks * Move stuff to separate files, rename some things * Refactor everything, create WebRTCStreamBuilder for both offer and answers * ta flight done time to grind * wait for incoming tracks and channels * Dummy track and frame reader track. Fix timing. * dt based on camera type * first trial of the new api * Fix audio track * methods for checking for incoming tracks * Web migration part 2 * Fixes for stream api * use rtc description for web.py * experimental cereal proxy * remove old code from bodyav * fix is_started * serialize session description * fix audio * messaging channel wrapper * fix audiotrack * h264 codec preference * Add codec preference to tracks * override sdp codecs * add logging * Move cli stuff to separate file * slight cleanup * Fix audio track * create codec_mime inside force_codec function * fix incoming media estimation * move builders to __init__ * stream updates following builders * Update example script * web.py support for new builder * web speaker fixes * StreamingMediaInfo API * Move things around * should_add_data_channel rename * is_connected_and_ready * fix linter errors * make cli executable * remove dumb comments * logging support * fix parse_info_from_offer * improve type annotations * satisfy linters * Support for waiting for disconnection * Split device tracks into video/audio files. Move audio speaker to audio.py * default dt for dummy video track * Fix cli * new speaker fixes * Remove almost all functionality from web.py * webrtcd * continue refactoring web.py * after handling joystick reset in controlsd with #30409, controls are not necessary anymore * ping endpoint * Update js files to at least support what worked previously * Fixes after some tests on the body * Streaming fixes * Remove the use of WebRTCStreamBuilder. Subclass use is now required * Add todo * delete all streams on shutdown * Replace lastPing with lastChannelMessageTime * Update ping text only if rtc is still on * That should affect the chart too * Fix paths in web * use protocol in SSLContext * remove warnings since aiortc is not used directly anymore * check if task is done in stop * remove channel handler wrapper, since theres only one channel * Move things around * Moved webrtc abstractions to separate repository * Moved webrtcd to tools/webrtc * Update imports * Add bodyrtc as dependency * Add webrtcd to process_config * Remove usage of DummyVideoStreamTrack * Add main to webrtcd * Move webrtcd to system * Fix imports * Move cereal proxy logic outside of runner * Incoming proxy abstractions * Add some tests * Make it executable * Fix process config * Fix imports * Additional tests. Add tests to pyproject.toml * Update poetry lock * New line * Bump aiortc to 1.6.0 * Added teleoprtc_repo as submodule, and linked its source dir * Add init file to webrtc module * Handle aiortc warnings * Ignore deprecation warnings * Ignore resource warning too * Ignore the warnings * find free port for test_webrtcd * Start process inside the test case * random sleep test * test 2 * Test endpoint function instead * Update comment * Add system/webrtc to release * default arguments for body fields * Add teleoprtc to release * Bump teleoprtc * Exclude teleoprtc from static analysis * Use separate event loop for stream session tests old-commit-hash: f058b5d64eed31878533a85f25eb53386ff9e330
2023-12-01 21:13:37 -08:00
"teleoprtc",
"teleoprtc_repo",
"third_party",
"*.ipynb",
2025-09-07 12:21:13 -07:00
"generated",
]
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"
"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"
[tool.ruff.format]
quote-style = "preserve"
2025-12-28 10:42:49 -08:00
[tool.ty.src]
exclude = [
"cereal/",
"msgq/",
"msgq_repo/",
"opendbc/",
"opendbc_repo/",
"panda/",
"rednose/",
"rednose_repo/",
"tinygrad/",
"tinygrad_repo/",
"teleoprtc/",
"teleoprtc_repo/",
"third_party/",
]
[tool.ty.rules]
# Ignore unresolved imports for Cython-compiled modules (.pyx)
unresolved-import = "ignore"
# Ignore unresolved attributes - many from capnp and Cython modules
unresolved-attribute = "ignore"
# Ignore invalid method overrides - signature variance issues
invalid-method-override = "ignore"
# Ignore possibly-missing-attribute - too many false positives
possibly-missing-attribute = "ignore"
# Ignore invalid assignment - often intentional monkey-patching
invalid-assignment = "ignore"
# Ignore no-matching-overload - numpy/ctypes overload matching issues
no-matching-overload = "ignore"
# Ignore invalid-argument-type - many false positives from raylib, ctypes, numpy
invalid-argument-type = "ignore"
# Ignore call-non-callable - false positives from dynamic types
call-non-callable = "ignore"
# Ignore unsupported-operator - false positives from dynamic types
unsupported-operator = "ignore"
# Ignore not-subscriptable - false positives from dynamic types
not-subscriptable = "ignore"
2025-12-28 10:42:49 -08:00
# not-iterable errors are now fixed