Skip to content

NVR with realtime local object detection for IP cameras

Remove PyYAML usages and dependency (#13889)

Nicolas Mowen6bafb68d77bd
diff --git a/docker/main/requirements-wheels.txt b/docker/main/requirements-wheels.txt
index a704cde164..4819554234 100644
--- a/docker/main/requirements-wheels.txt
+++ b/docker/main/requirements-wheels.txt
@@ -15,12 +15,10 @@ peewee_migrate == 1.13.*
psutil == 5.9.*
pydantic == 2.8.*
git+https://github.com/fbcotter/py3nvml#egg=py3nvml
-PyYAML == 6.0.*
pytz == 2024.1
pyzmq == 26.2.*
ruamel.yaml == 0.18.*
tzlocal == 5.2
-types-PyYAML == 6.0.*
requests == 2.32.*
types-requests == 2.32.*
scipy == 1.13.*
diff --git a/docker/main/rootfs/usr/local/go2rtc/create_config.py b/docker/main/rootfs/usr/local/go2rtc/create_config.py
index a9abbe1d1c..ae2c0128e7 100644
--- a/docker/main/rootfs/usr/local/go2rtc/create_config.py
+++ b/docker/main/rootfs/usr/local/go2rtc/create_config.py
@@ -6,7 +6,7 @@ import shutil
import sys
from pathlib import Path
-import yaml
+from ruamel.yaml import YAML
sys.path.insert(0, "/opt/frigate")
from frigate.const import (
@@ -18,6 +18,7 @@ from frigate.ffmpeg_presets import parse_preset_hardware_acceleration_encode
sys.path.remove("/opt/frigate")
+yaml = YAML()
FRIGATE_ENV_VARS = {k: v for k, v in os.environ.items() if k.startswith("FRIGATE_")}
# read docker secret files as env vars too
@@ -40,7 +41,7 @@ try:
raw_config = f.read()
if config_file.endswith((".yaml", ".yml")):
- config: dict[str, any] = yaml.safe_load(raw_config)
+ config: dict[str, any] = yaml.load(raw_config)
elif config_file.endswith(".json"):
config: dict[str, any] = json.loads(raw_config)
except FileNotFoundError:
diff --git a/docker/main/rootfs/usr/local/nginx/get_tls_settings.py b/docker/main/rootfs/usr/local/nginx/get_tls_settings.py
index a96a829dfc..f1a4c85de1 100644
--- a/docker/main/rootfs/usr/local/nginx/get_tls_settings.py
+++ b/docker/main/rootfs/usr/local/nginx/get_tls_settings.py
@@ -3,7 +3,9 @@
import json
import os
-import yaml
+from ruamel.yaml import YAML
+
+yaml = YAML()
config_file = os.environ.get("CONFIG_FILE", "/config/config.yml")
@@ -17,7 +19,7 @@ try:
raw_config = f.read()
if config_file.endswith((".yaml", ".yml")):
- config: dict[str, any] = yaml.safe_load(raw_config)
+ config: dict[str, any] = yaml.load(raw_config)
elif config_file.endswith(".json"):
config: dict[str, any] = json.loads(raw_config)
except FileNotFoundError:
diff --git a/docker/main/rootfs/usr/local/semantic_search/get_search_settings.py b/docker/main/rootfs/usr/local/semantic_search/get_search_settings.py
index e4ec4ea1c7..ec3c9c1fa7 100644
--- a/docker/main/rootfs/usr/local/semantic_search/get_search_settings.py
+++ b/docker/main/rootfs/usr/local/semantic_search/get_search_settings.py
@@ -3,7 +3,9 @@
import json
import os
-import yaml
+from ruamel.yaml import YAML
+
+yaml = YAML()
config_file = os.environ.get("CONFIG_FILE", "/config/config.yml")
@@ -17,7 +19,7 @@ try:
raw_config = f.read()
if config_file.endswith((".yaml", ".yml")):
- config: dict[str, any] = yaml.safe_load(raw_config)
+ config: dict[str, any] = yaml.load(raw_config)
elif config_file.endswith(".json"):
config: dict[str, any] = json.loads(raw_config)
except FileNotFoundError:
diff --git a/frigate/config.py b/frigate/config.py
index aec5250763..e9ffde35a2 100644
--- a/frigate/config.py
+++ b/frigate/config.py
@@ -1762,7 +1762,7 @@ class FrigateConfig(FrigateBaseModel):
elif ext == ".json":
is_json = True
- # At this point, ry to sniff the config string, to guess if it is json or not.
+ # At this point, try to sniff the config string, to guess if it is json or not.
if is_json is None:
is_json = REGEX_JSON.match(config) is not None