Open-Source Wikis

/

ComfyUI

/

Packages

comfyanonymous/ComfyUI

Packages

Top-level Python packages in the repo. Each lives at the repository root and is treated as an internal library by the rest of the codebase. There is no monorepo tooling — they share a single virtualenv and are imported by relative module path.

Package Lines Purpose
comfy/ 84,388 The diffusion engine. Models, samplers, text encoders, LoRA, VAE, model loading, memory, quantization
comfy_api_nodes/ 40,092 Built-in nodes that call paid third-party AI APIs (Kling, Veo, Stability, BFL, …)
comfy_extras/ 27,126 The standard library of "extra" built-in nodes — one file per feature/model family
app/ 9,054 App-level managers: users, models, custom nodes, frontend, assets DB
comfy_api/ 5,842 The versioned public API surface for custom nodes (latest, v0_0_1, v0_0_2)
comfy_execution/ 2,037 Graph execution: traversal, caching, jobs, progress
api_server/ 180 The aiohttp /internal/* routes used only by the frontend

The top-level files (main.py, server.py, execution.py, nodes.py, folder_paths.py, etc.) are not a package but are documented as if they were one — they hold the runtime entry points and the standard node library.

Import conventions

  • comfy/ is imported with the bare comfy name from anywhere in the tree.
  • comfy_extras/ modules are loaded by nodes.init_extra_nodes at startup; they expose NODE_CLASS_MAPPINGS (V1) or a comfy_entrypoint() (V3).
  • comfy_api/ is the surface custom nodes are encouraged to import from. Internal types live in comfy_api/internal/.
  • app/ is internal to the runtime and is not part of the custom-node API.

Reading order

If you're new to the codebase:

  1. comfy_execution/ — small, central, sets up the mental model for caching and graph traversal.
  2. comfy_api/ — the public node-authoring surface.
  3. Top-level filesmain.pyserver.pyexecution.pynodes.py.
  4. comfy/ — start with sd.py, then samplers.py, then model_management.py and model_patcher.py.
  5. app/ — the rest is mostly small, focused managers.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Packages – ComfyUI wiki | Factory