Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

fix(deps): exclude protobuf-incompatible opentelemetry versions

jack_ricky62e24b69cb11
diff --git a/pyproject.toml b/pyproject.toml
index f806efad8e..2cc57c2e08 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -32,10 +32,10 @@ dependencies = [
"skillnet-ai==0.0.16",
"mutagen>=1.47.0",
"google-genai>=1.68.0",
- "opentelemetry-api>=1.25.0",
- "opentelemetry-sdk>=1.25.0",
- "opentelemetry-exporter-otlp-proto-grpc>=1.25.0",
- "opentelemetry-exporter-otlp-proto-http>=1.25.0",
+ "opentelemetry-api>=1.28.0",
+ "opentelemetry-sdk>=1.28.0",
+ "opentelemetry-exporter-otlp-proto-grpc>=1.28.0",
+ "opentelemetry-exporter-otlp-proto-http>=1.28.0",
"sqlite-vec==0.1.6",
"fastapi>=0.115",
"uvicorn[standard]>=0.30",
diff --git a/tests/unit_tests/test_dependency_constraints.py b/tests/unit_tests/test_dependency_constraints.py
new file mode 100644
index 0000000000..597d6668c6
--- /dev/null
+++ b/tests/unit_tests/test_dependency_constraints.py
@@ -0,0 +1,33 @@
+import tomllib
+from pathlib import Path
+
+from packaging.requirements import Requirement
+from packaging.version import Version
+
+
+PROJECT_ROOT = Path(__file__).resolve().parents[2]
+MIN_PROTOBUF5_COMPATIBLE_OTEL = Version("1.28.0")
+OTEL_REQUIREMENTS = {
+ "opentelemetry-api",
+ "opentelemetry-sdk",
+ "opentelemetry-exporter-otlp-proto-grpc",
+ "opentelemetry-exporter-otlp-proto-http",
+}
+
+
+def test_opentelemetry_dependencies_exclude_protobuf4_only_proto_versions():
+ pyproject = tomllib.loads((PROJECT_ROOT / "pyproject.toml").read_text())
+ requirements = {
+ Requirement(raw).name: Requirement(raw)
+ for raw in pyproject["project"]["dependencies"]
+ }
+
+ for name in OTEL_REQUIREMENTS:
+ specifier = requirements[name].specifier
+ assert specifier.contains(MIN_PROTOBUF5_COMPATIBLE_OTEL), (
+ f"{name} must allow OpenTelemetry {MIN_PROTOBUF5_COMPATIBLE_OTEL}"
+ )
+ assert not specifier.contains(Version("1.27.0")), (
+ f"{name} must exclude OpenTelemetry 1.27.0 and older because "
+ "opentelemetry-proto<1.28 requires protobuf<5"
+ )
diff --git a/uv.lock b/uv.lock
index fd9fd88e8e..0551ddf8da 100644
--- a/uv.lock
+++ b/uv.lock
@@ -1827,10 +1827,10 @@ requires-dist = [
{ name = "numpy", specifier = ">=1.24.0" },
{ name = "openjiuwen", specifier = "==0.1.15.post3" },
{ name = "openjiuwen", extras = ["postgres", "zmq"], marker = "extra == 'distribute'" },
- { name = "opentelemetry-api", specifier = ">=1.25.0" },
- { name = "opentelemetry-exporter-otlp-proto-grpc", specifier = ">=1.25.0" },
- { name = "opentelemetry-exporter-otlp-proto-http", specifier = ">=1.25.0" },
- { name = "opentelemetry-sdk", specifier = ">=1.25.0" },
+ { name = "opentelemetry-api", specifier = ">=1.28.0" },
+ { name = "opentelemetry-exporter-otlp-proto-grpc", specifier = ">=1.28.0" },
+ { name = "opentelemetry-exporter-otlp-proto-http", specifier = ">=1.28.0" },
+ { name = "opentelemetry-sdk", specifier = ">=1.28.0" },
{ name = "pgvector", specifier = ">=0.4.2" },
{ name = "psutil", specifier = ">=7.2.2" },
{ name = "pydantic", specifier = ">=2.0" },