Files
olivv-cs-ComfyUI-FunPack/modules/_core.py
T
digital-garbageandClaude Opus 5 78c43acd67 contract: a colour type, and which run this is
Colour is a preference, so it is a setting: hex in, hex out, one spelling,
refused if it is not one. A module handed "red" in one place and "#f00" in
another guesses wrong somewhere.

Image and mask are NOT settings and deliberately have no type. They are
data -- tensors the app uploads and the graph wires -- and ComfyUI already
has socket types for both. Putting a drawn mask in a JSON settings payload
would be inventing a second way to move something that already moves.

Runs now have an id. Previews, progress, results and log lines all have to
be attributable to one generation, and ComfyUI gives a node no way to ask
which run it is in. So FunPack marks its own, every log record carries it,
and the history can be filtered to a single run. Readable rather than a
uuid, because it is going to be read: "run 7" is findable in a wall of
output and a hex string is not.

The colour element was caught by the registry-driven rule test before it was
finished -- an element with no catalogue demo is neither shown nor attacked,
so coverage keeps up with the registry instead of lagging behind it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-29 17:29:38 +03:00

19 lines
1.0 KiB
Python

"""How a module reaches core, in both contexts, decided once.
A module cannot simply `import core`. Inside ComfyUI the pack is imported by file
location, so `core` is only reachable beneath the pack's own package; under the
tests and the dev server the repo root IS on sys.path, so it is top-level. A
static relative import gets one of those right and breaks the other.
Every module therefore imports core THROUGH here -- `from ..._core import traits`
-- and this file holds the only place that has to know about the difference. The
leading underscore keeps it out of the module scan.
"""
try: # root on sys.path: tests, dev server
from core import contract, log, patching, registry, relations, run, schema, traits
except ImportError: # inside ComfyUI: a subpackage of the pack
from ..core import contract, log, patching, registry, relations, run, schema, traits
__all__ = ["contract", "log", "patching", "registry", "relations", "run", "schema", "traits"]