From 9586c79ad9600d0f5fb149f509227bc47223aff1 Mon Sep 17 00:00:00 2001 From: Deep Mehta Date: Tue, 3 Mar 2026 20:38:31 -0800 Subject: [PATCH] fix: wrap register/unregister as explicit static methods Define register_provider and unregister_provider as wrapper functions in the Caching class instead of re-importing. This locks the public API signature in comfy_api/ so internal changes can't accidentally break it. Co-Authored-By: Claude Opus 4.6 --- comfy_api/latest/__init__.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/comfy_api/latest/__init__.py b/comfy_api/latest/__init__.py index 84d520eb2..a157b498a 100644 --- a/comfy_api/latest/__init__.py +++ b/comfy_api/latest/__init__.py @@ -137,11 +137,18 @@ class Caching: """ # Public types — defined in comfy_api.latest._caching (source of truth) from ._caching import CacheProvider, CacheContext, CacheValue - # Registry functions — implementation in comfy_execution - from comfy_execution.cache_provider import ( - register_cache_provider as register_provider, - unregister_cache_provider as unregister_provider, - ) + + @staticmethod + def register_provider(provider: "Caching.CacheProvider") -> None: + """Register an external cache provider.""" + from comfy_execution.cache_provider import register_cache_provider + register_cache_provider(provider) + + @staticmethod + def unregister_provider(provider: "Caching.CacheProvider") -> None: + """Unregister an external cache provider.""" + from comfy_execution.cache_provider import unregister_cache_provider + unregister_cache_provider(provider) ComfyAPI = ComfyAPI_latest