pyproject.toml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. [project]
  2. name = "openpilot"
  3. requires-python = ">= 3.11"
  4. license = {text = "MIT License"}
  5. version = "0.1.0"
  6. description = "an open source driver assistance system"
  7. authors = [
  8. {name ="Vehicle Researcher", email="user@comma.ai"}
  9. ]
  10. dependencies = [
  11. # multiple users
  12. "sounddevice", # micd + soundd
  13. "pyserial", # pigeond + qcomgpsd
  14. "requests", # many one-off uses
  15. "sympy", # rednose + friends
  16. "crcmod", # cars + qcomgpsd
  17. "tqdm", # cars (fw_versions.py) on start + many one-off uses
  18. # hardwared
  19. "smbus2", # configuring amp
  20. # core
  21. "cffi",
  22. "scons",
  23. "pycapnp",
  24. "Cython",
  25. "setuptools",
  26. "numpy < 2.0.0",
  27. # body / webrtcd
  28. "aiohttp",
  29. "aiortc",
  30. "pyaudio",
  31. # panda
  32. "libusb1",
  33. "spidev; platform_system == 'Linux'",
  34. # modeld
  35. "onnx >= 1.14.0",
  36. "onnxruntime >=1.16.3; platform_system == 'Linux' and platform_machine == 'aarch64'",
  37. "onnxruntime-gpu >=1.16.3; platform_system == 'Linux' and platform_machine == 'x86_64'",
  38. # logging
  39. "pyzmq",
  40. "sentry-sdk",
  41. # athena
  42. "PyJWT",
  43. "json-rpc",
  44. "websocket_client",
  45. # acados deps
  46. "casadi >=3.6.6", # 3.12 fixed in 3.6.6
  47. "future-fstrings",
  48. # joystickd
  49. "inputs",
  50. # these should be removed
  51. "psutil",
  52. "pycryptodome", # used in updated/casync, panda, body, and a test
  53. "setproctitle",
  54. # logreader
  55. "zstandard",
  56. ]
  57. [project.optional-dependencies]
  58. docs = [
  59. "Jinja2",
  60. "natsort",
  61. "mkdocs",
  62. ]
  63. testing = [
  64. "coverage",
  65. "hypothesis ==6.47.*",
  66. "mypy",
  67. "pytest",
  68. "pytest-cov",
  69. "pytest-cpp",
  70. "pytest-subtests",
  71. "pytest-xdist",
  72. "pytest-timeout",
  73. "pytest-randomly",
  74. "pytest-asyncio",
  75. "pytest-mock",
  76. "pytest-repeat",
  77. "ruff",
  78. "codespell",
  79. "pre-commit-hooks",
  80. ]
  81. dev = [
  82. "av",
  83. "azure-identity",
  84. "azure-storage-blob",
  85. "dictdiffer",
  86. "flaky",
  87. "lru-dict",
  88. "matplotlib",
  89. "parameterized >=0.8, <0.9",
  90. #"pprofile",
  91. "pyautogui",
  92. "pyopencl; platform_machine != 'aarch64'", # broken on arm64
  93. "pytools < 2024.1.11; platform_machine != 'aarch64'", # pyopencl use a broken version
  94. "pywinctl",
  95. "pyprof2calltree",
  96. "tabulate",
  97. "types-requests",
  98. "types-tabulate",
  99. # this is only pinned since 5.15.11 is broken
  100. "pyqt5 ==5.15.2; platform_machine == 'x86_64'", # no aarch64 wheels for macOS/linux
  101. ]
  102. tools = [
  103. "metadrive-simulator @ https://github.com/commaai/metadrive/releases/download/MetaDrive-minimal/metadrive_simulator-0.4.2.3-py3-none-any.whl ; (platform_machine != 'aarch64')",
  104. "rerun-sdk >= 0.18",
  105. ]
  106. [project.urls]
  107. Homepage = "https://comma.ai"
  108. [build-system]
  109. requires = ["hatchling"]
  110. build-backend = "hatchling.build"
  111. [tool.hatch.build.targets.wheel]
  112. packages = [ "." ]
  113. [tool.hatch.metadata]
  114. allow-direct-references = true
  115. [tool.pytest.ini_options]
  116. minversion = "6.0"
  117. 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"
  118. cpp_files = "test_*"
  119. cpp_harness = "selfdrive/test/cpp_harness.py"
  120. python_files = "test_*.py"
  121. asyncio_default_fixture_loop_scope = "function"
  122. #timeout = "30" # you get this long by default
  123. markers = [
  124. "slow: tests that take awhile to run and can be skipped with -m 'not slow'",
  125. "tici: tests that are only meant to run on the C3/C3X",
  126. ]
  127. testpaths = [
  128. "common",
  129. "selfdrive",
  130. "system/updated",
  131. "system/athena",
  132. "system/camerad",
  133. "system/hardware",
  134. "system/loggerd",
  135. "system/proclogd",
  136. "system/tests",
  137. "system/ubloxd",
  138. "system/webrtc",
  139. "tools/lib/tests",
  140. "tools/replay",
  141. "tools/cabana",
  142. "cereal/messaging/tests",
  143. ]
  144. [tool.codespell]
  145. quiet-level = 3
  146. # if you've got a short variable name that's getting flagged, add it here
  147. 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"
  148. builtin = "clear,rare,informal,code,names,en-GB_to_en-US"
  149. 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/*"
  150. [tool.mypy]
  151. python_version = "3.11"
  152. plugins = [
  153. "numpy.typing.mypy_plugin",
  154. ]
  155. exclude = [
  156. "cereal/",
  157. "msgq/",
  158. "msgq_repo/",
  159. "opendbc/",
  160. "opendbc_repo/",
  161. "panda/",
  162. "rednose/",
  163. "rednose_repo/",
  164. "tinygrad/",
  165. "tinygrad_repo/",
  166. "teleoprtc/",
  167. "teleoprtc_repo/",
  168. "third_party/",
  169. ]
  170. # third-party packages
  171. ignore_missing_imports=true
  172. # helpful warnings
  173. warn_redundant_casts=true
  174. warn_unreachable=true
  175. warn_unused_ignores=true
  176. # restrict dynamic typing
  177. warn_return_any=true
  178. # allow implicit optionals for default args
  179. implicit_optional = true
  180. local_partial_types=true
  181. explicit_package_bases=true
  182. disable_error_code = "annotation-unchecked"
  183. # https://beta.ruff.rs/docs/configuration/#using-pyprojecttoml
  184. [tool.ruff]
  185. indent-width = 2
  186. lint.select = [
  187. "E", "F", "W", "PIE", "C4", "ISC", "A", "B",
  188. "NPY", # numpy
  189. "UP", # pyupgrade
  190. "TRY302", "TRY400", "TRY401", # try/excepts
  191. "RUF008", "RUF100",
  192. "TID251",
  193. "PLR1704",
  194. ]
  195. lint.ignore = [
  196. "E741",
  197. "E402",
  198. "C408",
  199. "ISC003",
  200. "B027",
  201. "B024",
  202. "NPY002", # new numpy random syntax is worse
  203. "UP038", # (x, y) -> x|y for isinstance
  204. ]
  205. line-length = 160
  206. target-version ="py311"
  207. exclude = [
  208. "body",
  209. "cereal",
  210. "panda",
  211. "opendbc",
  212. "rednose_repo",
  213. "tinygrad_repo",
  214. "teleoprtc",
  215. "teleoprtc_repo",
  216. "third_party",
  217. "*.ipynb",
  218. ]
  219. lint.flake8-implicit-str-concat.allow-multiline = false
  220. [tool.ruff.lint.flake8-tidy-imports.banned-api]
  221. "selfdrive".msg = "Use openpilot.selfdrive"
  222. "common".msg = "Use openpilot.common"
  223. "system".msg = "Use openpilot.system"
  224. "third_party".msg = "Use openpilot.third_party"
  225. "tools".msg = "Use openpilot.tools"
  226. "pytest.main".msg = "pytest.main requires special handling that is easy to mess up!"
  227. "unittest".msg = "Use pytest"
  228. [tool.coverage.run]
  229. concurrency = ["multiprocessing", "thread"]
  230. [tool.ruff.format]
  231. quote-style = "preserve"