fix: wrap register/unregister as explicit static methods
Some checks failed
Python Linting / Run Ruff (push) Has been cancelled
Python Linting / Run Pylint (push) Has been cancelled

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 <noreply@anthropic.com>
This commit is contained in:
Deep Mehta 2026-03-03 20:38:31 -08:00
parent 7c3c427639
commit 9586c79ad9

View File

@ -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