Files
sunnypilot/pyproject.toml
T
Harald Schäfer 493ae5ad0e Replace Git LFS with a custom Hugging Face bucket client (#39206)
* Replace Git LFS with a custom Hugging Face bucket client

* Address review findings in the custom LFS client

- A failed download leaves the pointer (also for delayed blobs) and
  filter.lfs.required is false, so git commands finish and ./lfs.py pull
  fills the files in later.
- install() also replaces the unquoted pre-push hook from #38775 and a stock
  git-lfs hook that `op post-commit` moved into post-commit.d.
- .git/lfs.py and the pre-push hook are replaced atomically.
- Pushing LFS objects without a token prints a one-line hint.
- op warns when the installed LFS client is missing or outdated.
- Ranged downloads write into one preallocated file instead of
  concatenating parts.
- hf-xet moves from the core dependencies to the tools extra.

* Drop the ~/.local/bin PATH addition left from the uv-run transfer agent

* Keep filter.lfs.required so a broken LFS client can't commit raw files

* Keep shipping .lfsconfig only with the big model

* Keep a custom pre-push hook instead of failing the LFS pull

* Let the setup clone use the configured LFS client

The HF LFS repo is mirrored from the bucket, so stock Git LFS can smudge the clone.

* Keep git working without python3 with an sh LFS filter

scripts/lfs-filter runs lfs.py, or without python3 has git abort LFS filtering and keep the pointer files, like the git-lfs shim did. A process filter that can't start otherwise makes git fail regardless of filter.lfs.required. The abort only lets git continue when the filter isn't required.

* Drop the sh LFS filter and require the LFS filter again

lfs.py lives in the git dir and only needs python3, so a missing or rebuilt
venv, or a worktree without one, can't break git like the old git-lfs shim
guarded against. The sh fallback for a machine without python3 needed
filter.lfs.required=false, which also let a failing clean commit the raw file.

This reverts commit 437711998981c8c7bf65c2878881c547516d681a.
2026-11-04 18:40:27 -08:00

167 lines
4.7 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
# core
"scons",
"pycapnp==2.1.0", # 2.2 introduces a memory leak due to cyclic references
"numpy >=2.0",
# vendored native dependencies
"comma-deps-capnproto",
"comma-deps-acados",
"comma-deps-ffmpeg",
"comma-deps-zstd",
"comma-deps-json11",
"comma-deps-gcc-arm-none-eabi",
# athena
"PyJWT[crypto]",
"websocket_client",
# joystickd
"inputs",
# these should be removed
"setproctitle",
"jeepney",
"zstandard", # this can go once we're on Python 3.14+
# ui
"comma-deps-raylib",
]
[project.optional-dependencies]
testing = [
"coverage", # line coverage
"ty", # type checking
"ruff", # linting
"codespell", # spellcheck
]
tools = [
"matplotlib",
# LFS uploads (lfs.py pre-push)
"hf-xet==1.7.0",
"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')",
]
submodules = [
"msgq-ipc[build]",
"opendbc",
"pandacan",
"rednose",
"teleoprtc",
"tinygrad",
]
[project.urls]
Homepage = "https://github.com/commaai/openpilot"
[dependency-groups]
standalone = [
"openpilot[submodules]",
]
[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"
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
"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
[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"
"raylib_nb.measure_text_ex".msg = "Use openpilot.system.ui.lib.text_measure"
"raylib_nb.is_mouse_button_pressed".msg = "This can miss events. Use Widget._handle_mouse_press"
"raylib_nb.is_mouse_button_released".msg = "This can miss events. Use Widget._handle_mouse_release"
"raylib_nb.draw_text".msg = "Use a function (such as rl.draw_font_ex) that takes font as an argument"
"raylib_nb.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
[tool.uv]
python-preference = "only-managed"
default-groups = ["standalone"]
override-dependencies = [
"opendbc", # panda pins opendbc from git for standalone use; always use our submodule
]
[tool.uv.sources]
# 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 }