Use uv instead of make/venv for frigate detector

Runs the detector script directly via `uv run --with` with inline
dependencies, eliminating the need for `make install` and a managed venv.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Erich Blume 2026-02-17 17:21:44 -08:00
commit 02d44c35b4
3 changed files with 36 additions and 15 deletions

View file

@ -4,3 +4,5 @@ frigate_detector_dir: "{{ ansible_env.HOME }}/code/3rd/apple-silicon-detector"
frigate_detector_endpoint: "tcp://*:5555"
frigate_detector_model: AUTO
frigate_detector_log_dir: "{{ ansible_env.HOME }}/Library/Logs"
frigate_detector_uv_binary: "{{ ansible_env.HOME }}/.local/share/mise/installs/uv/latest/uv-aarch64-apple-darwin/uv"
frigate_detector_python: "3.12"

View file

@ -2,32 +2,39 @@
# Apple Silicon ZMQ detector for Frigate
# Runs natively on macOS, using CoreML / Neural Engine for ~15ms inference.
# Communicates with Frigate via ZMQ over TCP.
# Dependencies managed inline by uv — no venv or make install needed.
#
# ONE-TIME SETUP (before running ansible):
#
# 1. Clone the repo (use localhost:3001 - hairpinning doesn't work):
# ssh indri 'git clone http://localhost:3001/eblume/apple-silicon-detector.git ~/code/3rd/apple-silicon-detector'
#
# 2. Install dependencies:
# ssh indri 'cd ~/code/3rd/apple-silicon-detector && make install'
#
# 3. Run ansible to deploy LaunchAgent:
# 2. Run ansible to deploy LaunchAgent:
# mise run provision-indri -- --tags frigate_detector
- name: Verify apple-silicon-detector repo exists
ansible.builtin.stat:
path: "{{ frigate_detector_dir }}/Makefile"
path: "{{ frigate_detector_dir }}/detector/zmq_onnx_client.py"
register: frigate_detector_stat
- name: Fail if apple-silicon-detector not found
ansible.builtin.fail:
msg: |
apple-silicon-detector not found at {{ frigate_detector_dir }}.
Please clone and install first:
Please clone first:
ssh indri 'git clone {{ frigate_detector_repo }} {{ frigate_detector_dir }}'
ssh indri 'cd {{ frigate_detector_dir }} && make install'
when: not frigate_detector_stat.stat.exists
- name: Verify uv binary exists
ansible.builtin.stat:
path: "{{ frigate_detector_uv_binary }}"
register: frigate_detector_uv_stat
- name: Fail if uv not found
ansible.builtin.fail:
msg: "uv not found at {{ frigate_detector_uv_binary }}. Install via mise: mise use uv@latest"
when: not frigate_detector_uv_stat.stat.exists
- name: Deploy frigate-detector LaunchAgent plist
ansible.builtin.template:
src: mcquack.eblume.frigate-detector.plist.j2

View file

@ -7,18 +7,30 @@
<string>mcquack.eblume.frigate-detector</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/make</string>
<string>{{ frigate_detector_uv_binary }}</string>
<string>run</string>
<string>--python</string>
<string>{{ frigate_detector_python }}</string>
<string>--with</string>
<string>numpy==1.26.*</string>
<string>--with</string>
<string>opencv-python-headless==4.11.0.*</string>
<string>--with</string>
<string>opencv-contrib-python==4.11.0.*</string>
<string>--with</string>
<string>onnxruntime==1.22.*</string>
<string>--with</string>
<string>pyzmq==26.2.*</string>
<string>--with</string>
<string>pydantic==2.10.*</string>
<string>detector/zmq_onnx_client.py</string>
<string>--model</string>
<string>{{ frigate_detector_model }}</string>
<string>--endpoint</string>
<string>{{ frigate_detector_endpoint }}</string>
</array>
<key>WorkingDirectory</key>
<string>{{ frigate_detector_dir }}</string>
<key>EnvironmentVariables</key>
<dict>
<key>ENDPOINT</key>
<string>{{ frigate_detector_endpoint }}</string>
<key>MODEL</key>
<string>{{ frigate_detector_model }}</string>
</dict>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>