2024-06-25 13:12:46 +08:00
[ project ]
name = "openpilot"
requires-python = ">= 3.11"
license = { text = "MIT License" }
2024-07-02 16:55:53 +08:00
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" ,
2024-08-20 19:22:22 +08:00
"numpy" ,
2024-07-02 16:55:53 +08:00
# 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
2024-08-20 19:22:22 +08:00
"casadi @ https://github.com/commaai/casadi/releases/download/nightly-release-3.6.6/casadi-3.6.6-cp312-none-manylinux2014_aarch64.whl ; (python_version == '3.12' and platform_machine == 'aarch64')" , # TODO: Go back to pypi casadi when they fix aarch64 for python312
"casadi; platform_machine != 'aarch64' or python_version != '3.12'" ,
2024-07-02 16:55:53 +08:00
"future-fstrings" ,
# these should be removed
"psutil" ,
"pycryptodome" , # used in updated/casync, panda, body, and a test
2024-08-20 19:22:22 +08:00
# logreader
"zstandard" ,
2024-07-02 16:55:53 +08:00
]
[ project . optional-dependencies ]
docs = [
"Jinja2" ,
2024-08-20 19:22:22 +08:00
"natsort" ,
2024-07-13 18:44:15 +08:00
"mkdocs" ,
2024-07-02 16:55:53 +08:00
]
testing = [
"coverage" ,
"hypothesis ==6.47.*" ,
2024-08-20 19:22:22 +08:00
"import-linter" ,
2024-07-02 16:55:53 +08:00
"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" ,
"dictdiffer" ,
"flaky" ,
"inputs" ,
"lru-dict" ,
"matplotlib" ,
2024-08-20 19:22:22 +08:00
"metadrive-simulator@git+https://github.com/commaai/metadrive@opencv_headless ; platform_machine != 'aarch64'" ,
2024-07-02 16:55:53 +08:00
"parameterized >=0.8, <0.9" ,
2024-08-20 19:22:22 +08:00
#"pprofile",
2024-07-02 16:55:53 +08:00
"pyautogui" ,
"pyopencl; platform_machine != 'aarch64'" , # broken on arm64
2024-08-20 19:22:22 +08:00
"pytools < 2024.1.11; platform_machine != 'aarch64'" , # pyopencl use a broken version
2024-07-02 16:55:53 +08:00
"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
]
2024-06-25 13:12:46 +08:00
[ project . urls ]
Homepage = "https://comma.ai"
2024-07-02 16:55:53 +08:00
[ build-system ]
requires = [ "hatchling" ]
build-backend = "hatchling.build"
[ tool . hatch . build . targets . wheel ]
packages = [ "." ]
2024-08-20 19:22:22 +08:00
[ tool . hatch . metadata ]
allow-direct-references = true
2023-12-24 12:18:48 +08:00
[ tool . pytest . ini_options ]
minversion = "6.0"
2024-07-13 18:44:15 +08:00
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"
2023-12-24 12:18:48 +08:00
cpp_files = "test_*"
cpp_harness = "selfdrive/test/cpp_harness.py"
python_files = "test_*.py"
#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" ,
2024-06-25 13:12:46 +08:00
"selfdrive/pandad" ,
2023-12-24 12:18:48 +08:00
"selfdrive/car" ,
"selfdrive/controls" ,
"selfdrive/locationd" ,
"selfdrive/monitoring" ,
"selfdrive/test/longitudinal_maneuvers" ,
2024-02-13 03:50:58 +08:00
"selfdrive/test/process_replay/test_fuzzy.py" ,
2024-06-25 13:12:46 +08:00
"system/updated" ,
"system/athena" ,
2024-02-13 03:50:58 +08:00
"system/camerad" ,
2024-06-25 13:12:46 +08:00
"system/hardware" ,
2023-12-24 12:18:48 +08:00
"system/loggerd" ,
"system/proclogd" ,
"system/tests" ,
"system/ubloxd" ,
"system/webrtc" ,
"tools/lib/tests" ,
"tools/replay" ,
2024-06-25 13:12:46 +08:00
"tools/cabana" ,
"cereal/messaging/tests" ,
2023-12-24 12:18:48 +08:00
]
[ tool . mypy ]
python_version = "3.11"
plugins = [
"numpy.typing.mypy_plugin" ,
]
exclude = [
"body/" ,
"cereal/" ,
"opendbc/" ,
"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
2024-06-25 13:12:46 +08:00
# allow implicit optionals for default args
implicit_optional = true
2023-12-24 12:18:48 +08:00
# https://beta.ruff.rs/docs/configuration/#using-pyprojecttoml
[ tool . ruff ]
2024-06-25 13:12:46 +08:00
indent-width = 2
lint . select = [
"E" , "F" , "W" , "PIE" , "C4" , "ISC" , "A" , "B" ,
"NPY" , # numpy
"UP" , # pyupgrade
"TRY302" , "TRY400" , "TRY401" , # try/excepts
"RUF008" , "RUF100" ,
2024-07-02 16:55:53 +08:00
"TID251" ,
"PLR1704" ,
2024-06-25 13:12:46 +08:00
]
lint . ignore = [
"E741" ,
"E402" ,
"C408" ,
"ISC003" ,
"B027" ,
"B024" ,
"NPY002" , # new numpy random syntax is worse
"UP038" , # (x, y) -> x|y for isinstance
]
2023-12-24 12:18:48 +08:00
line-length = 160
2024-08-20 19:22:22 +08:00
target-version = "py311"
2023-12-24 12:18:48 +08:00
exclude = [
2024-06-25 13:12:46 +08:00
"body" ,
"cereal" ,
2023-12-24 12:18:48 +08:00
"panda" ,
"opendbc" ,
"rednose_repo" ,
"tinygrad_repo" ,
"teleoprtc" ,
"teleoprtc_repo" ,
"third_party" ,
]
2024-08-20 19:22:22 +08:00
lint . flake8-implicit-str-concat . allow-multiline = false
2024-02-13 03:50:58 +08:00
[ tool . ruff . lint . flake8-tidy-imports . banned-api ]
2023-12-24 12:18:48 +08:00
"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"
2024-06-25 13:12:46 +08:00
"pytest.main" . msg = "pytest.main requires special handling that is easy to mess up!"
"unittest" . msg = "Use pytest"
2023-12-24 12:18:48 +08:00
[ tool . coverage . run ]
concurrency = [ "multiprocessing" , "thread" ]
2024-08-20 19:22:22 +08:00
2024-06-25 13:12:46 +08:00
[ tool . ruff . format ]
quote-style = "preserve"