Files
StarPilot/pyproject.toml
T
2026-10-23 20:48:09 -05:00

203 lines
6.6 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"}
]
# ------------------------------------------
# > this dependencies list *only* goes down.
# ------------------------------------------
# Linux and Python is all we need, otherwise
# we write and own the lines ourselves.
# ------------------------------------------
dependencies = [
# multiple users
"sounddevice", # micd + soundd
"requests", # many one-off uses
"tqdm", # cars (fw_versions.py) on start + many one-off uses
# Bugsink error reporting (SDK is also packaged for prebuilt devices)
"sentry-sdk==2.38.0",
# core
"scons",
"pycapnp==2.1.0", # 2.2 introduces a memory leak due to cyclic references
"numpy >=2.0",
"pillow", # Galaxy camera snapshots and Sentry image evidence
# vendored native dependencies
"comma-deps-capnproto",
"comma-deps-acados",
"comma-deps-ffmpeg",
"comma-deps-zstd",
"comma-deps-zeromq",
"comma-deps-json11",
"comma-deps-gcc-arm-none-eabi",
# athena
"PyJWT[crypto]",
"websocket_client",
# joystickd
"inputs",
# these should be removed
"pyzmq",
"setproctitle",
"jeepney",
"zstandard", # this can go once we're on Python 3.14+
# ui
"comma-deps-raylib",
]
[project.optional-dependencies]
dev = [
"pytest>=8,<9",
"pytest-xdist>=3,<4",
"pytest-mock>=3,<4",
]
safety = [
"cffi",
"gcovr==8.6",
"tree-sitter==0.26.0",
"tree-sitter-c==0.24.2",
"cppcheck @ git+https://github.com/commaai/dependencies.git@b7253ddb101ed6add04fc2a2ce0688d5e21a55ee#subdirectory=cppcheck",
]
testing = [
"coverage", # line coverage
"ty", # type checking
"ruff", # linting
"codespell", # spellcheck
]
tools = [
"matplotlib",
"comma-deps-imgui",
"comma-deps-bootstrap-icons",
"comma-deps-libusb",
"comma-deps-ncurses",
# 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')",
]
vendored = [
"jetlink",
"msgq-ipc",
"opendbc",
"pandacan",
"rednose",
"teleoprtc",
"tinygrad",
]
[project.urls]
Homepage = "https://github.com/commaai/openpilot"
[dependency-groups]
standalone = [
"openpilot[vendored]",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = [
"openpilot",
]
dev-mode-dirs = [".", "msgq_repo"]
[tool.hatch.metadata]
allow-direct-references = true
[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,assertIn,HomeState,cancelled,CAS,acknowledgement,writeable,noice,FoF,waitFor,centre,centres,KeyPair,aPoint"
builtin = "clear,rare,informal,code,names,en-GB_to_en-US"
skip = "openpilot/cereal/gen/cpp/*.capnp.c++, openpilot/cereal/gen/cpp/*.capnp.h, *.po, uv.lock, *.onnx, *.pem, */c_generated_code/*, docs/assets/*, openpilot/tools/plotjuggler/layouts/*, openpilot/selfdrive/assets/offroad/mici_fcc.html, openpilot/starpilot/galaxy/web/vendor/vue/vue.esm-browser.js, openpilot/starpilot/ui/assets/fonts/notices/Unifont-COPYING.txt, openpilot/starpilot/galaxy_bluetooth/vendor/*, openpilot/starpilot/soloist/pulseaudio/licenses/*, openpilot/starpilot/companion/android/LICENSE.gradle"
ignore-regex = "scale\\.numer" # codespell:ignore numer
# 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
"ASYNC",
"B904", "B905",
"PLC0207",
"TRY203", "TRY400", "TRY401", # try/excepts
"RUF006", "RUF008", "RUF009", "RUF061", "RUF064", "RUF100", "RUF102", "RUF103", "RUF104",
"TID251",
"PLE", "PLR1704",
]
lint.ignore = [
"E741",
"E402",
"B027",
"UP007", # this doesn't play nice with raylib atm
]
line-length = 160
lint.flake8-implicit-str-concat.allow-multiline = false
extend-exclude = ["openpilot/starpilot/galaxy_bluetooth/vendor"] # unmodified third-party sources
[tool.ruff.lint.per-file-ignores]
# dbus-next declares D-Bus signatures as string annotations ('s', 'ay', 'a{sv}').
"openpilot/starpilot/galaxy_bluetooth/bridge/server.py" = ["F722", "F821"]
# These scripts embed Swift test sources verbatim.
"openpilot/starpilot/companion/ios/tests/*.py" = ["E501"]
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"time.time".msg = "Use time.monotonic. time.time can skip due to its reference clock, you probably want a monotonic clock"
"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.src]
exclude = ["openpilot/starpilot/galaxy_bluetooth/vendor"] # unmodified third-party sources
[tool.ty.environment]
extra-paths = ["opendbc_repo", "msgq_repo", "rednose_repo", "tinygrad_repo", "teleoprtc_repo", "jetlink_repo"]
[tool.ty.rules]
unresolved-import = "ignore" # Cython-compiled modules (.pyx)
unresolved-attribute = "ignore" # many from capnp and Cython modules
[[tool.ty.overrides]]
# dbus-next declares D-Bus signatures as string annotations ('s', 'ay', 'a{sv}').
include = ["openpilot/starpilot/galaxy_bluetooth/bridge/server.py"]
rules = { unresolved-reference = "ignore", invalid-syntax-in-forward-annotation = "ignore" }
[tool.uv]
python-preference = "only-managed"
default-groups = ["standalone"]
override-dependencies = [
"opendbc", # panda pins opendbc from git for standalone use; always use our tracked source
]
[tool.uv.sources]
jetlink = { path = "jetlink_repo", editable = true }
# SCons owns the native build; an editable install would shadow it with a stale .so
msgq-ipc = { path = "msgq_repo", package = false }
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 }