mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-11-20 04:23:01 +03:00
tweak agents file
This commit is contained in:
@@ -6,7 +6,7 @@ This document provides coding guidelines and best practices for contributing to
|
|||||||
|
|
||||||
Frigate NVR is a realtime object detection system for IP cameras that uses:
|
Frigate NVR is a realtime object detection system for IP cameras that uses:
|
||||||
|
|
||||||
- **Backend**: Python 3.13+ with FastAPI, OpenCV, TensorFlow/ONNX
|
- **Backend**: Python 3.11 with FastAPI, OpenCV, TensorFlow/ONNX
|
||||||
- **Frontend**: React with TypeScript, Vite, TailwindCSS
|
- **Frontend**: React with TypeScript, Vite, TailwindCSS
|
||||||
- **Architecture**: Multiprocessing design with ZMQ and MQTT communication
|
- **Architecture**: Multiprocessing design with ZMQ and MQTT communication
|
||||||
- **Focus**: Minimal resource usage with maximum performance
|
- **Focus**: Minimal resource usage with maximum performance
|
||||||
@@ -23,7 +23,7 @@ When reviewing code, do NOT comment on:
|
|||||||
|
|
||||||
### Python Requirements
|
### Python Requirements
|
||||||
|
|
||||||
- **Compatibility**: Python 3.13+
|
- **Compatibility**: Python 3.11 (the version in the Docker image)
|
||||||
- **Language Features**: Use modern Python features:
|
- **Language Features**: Use modern Python features:
|
||||||
- Pattern matching
|
- Pattern matching
|
||||||
- Type hints (comprehensive typing preferred)
|
- Type hints (comprehensive typing preferred)
|
||||||
@@ -97,11 +97,12 @@ When reviewing code, do NOT comment on:
|
|||||||
|
|
||||||
### Async Programming
|
### Async Programming
|
||||||
|
|
||||||
- **External I/O**: All external I/O operations must be async
|
- **Scope**: Frigate is mostly synchronous multiprocess code, and most API handlers are plain `def` running in FastAPI's threadpool. These rules apply to code that is already `async def`.
|
||||||
- **Best Practices**:
|
- **Blocking I/O**: A handler that does blocking work (peewee queries, `requests`, subprocess) should be a plain `def`, not an `async def` that blocks the event loop
|
||||||
- Avoid sleeping in loops - use `asyncio.sleep()` not `time.sleep()`
|
- **Best Practices** (inside `async def`):
|
||||||
|
- Use `asyncio.sleep()`, not `time.sleep()`
|
||||||
- Avoid awaiting in loops - use `asyncio.gather()` instead
|
- Avoid awaiting in loops - use `asyncio.gather()` instead
|
||||||
- No blocking calls in async functions
|
- No blocking calls
|
||||||
- Use `asyncio.create_task()` for background operations
|
- Use `asyncio.create_task()` for background operations
|
||||||
- **Thread Safety**: Use proper synchronization for shared state
|
- **Thread Safety**: Use proper synchronization for shared state
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user