Derived from latent_format where that is possible, which is every single-tensor model: SDXL, Wan21 and LTXV all come out matching the numbers core's own nodes compute, including models that ship after this. H3 cannot be derived and is the reason modules exist. Its latent is a NestedTensor of a video and an audio branch, its video channel count is not the latent_channels its format reports, and its length snaps to a frame grid. So modules/models/minimax_h3 claims it and builds it, importing the grid from ComfyUI rather than copying a second definition of it. Nothing outside that folder names a model, and nothing here assumes video: a 2-D latent format yields an image latent with no branch anywhere. Modules reach core through modules/_core.py. ComfyUI imports a pack by file location, so an absolute `import core` in a module resolves under pytest and not under ComfyUI -- the node then never registers, silently. That cost the same bug twice, so there is now a test that loads the pack the way ComfyUI does, in an isolated subprocess whose cwd is NOT the repo. The first version of that test passed with the bug reintroduced, because cwd was on sys.path. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
19 lines
926 B
Python
19 lines
926 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 log, registry, schema, traits
|
|
except ImportError: # inside ComfyUI: a subpackage of the pack
|
|
from ..core import log, registry, schema, traits
|
|
|
|
__all__ = ["log", "registry", "schema", "traits"]
|