Files
olivv-cs-ComfyUI-FunPack/modules/_core.py
T
digital-garbageandClaude Opus 5 37430137cb foundation: run it, and fix what running it found
First real generation through FunPack's nodes: SD1.5 on this Mac, real
weights, a real picture of an apple. Everything before this was static.

What it proved, on a real model rather than a fixture: the empty latent
takes its shape from SD1.5's own format with no family branch anywhere
(1, 4, 64, 64, an IMAGE latent from a pack built for video); the traits read
off the live model are predict_eps and spatial_latent; and ALG is correctly
absent, saying "needs temporal_latent", rather than running on a model with
no time axis.

What it found: the absolute-core-import bug again, this time INSIDE A
FUNCTION BODY. It imported fine, registered fine, passed 258 tests, and
raised at execute time -- during the generation. A suite that imports every
module cannot see an import that only happens when a node runs, so the check
for it is now static and walks the AST: no module may name `core` anywhere,
at any nesting, except through the shim.

The dev preview loaded one module in nine. It runs system python, which has
neither ComfyUI nor torch, so every module that imports either was absent
and the app looked almost empty while reporting nothing. It now re-execs
under ComfyUI's interpreter. Looking at the app is meant to be how the app
gets tested; it has to see what ComfyUI sees.

ALG asked for a mount point no region offered, so its panel vanished in
silence. The shell now offers one per stage, and a modules page lists what
loaded, what asked for a mount nothing offers, and what failed to import --
absence is correct behaviour and indistinguishable from "never installed",
so somewhere has to say which.

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

19 lines
993 B
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, registry, relations, schema, traits
except ImportError: # inside ComfyUI: a subpackage of the pack
from ..core import contract, log, registry, relations, schema, traits
__all__ = ["contract", "log", "registry", "relations", "schema", "traits"]