Files
kunail0804-ComfyUI-Scene-Co…/pyproject.toml
T
03dd578435 feat(schemas): add JSON Schemas and validation helper for inter-stage documents (#2) (#46)
Define the nine JSON Schemas (draft 2020-12) exchanged between compiler stages
per MASTER_SPEC §10–§11, plus a reusable validation helper.

Schemas (schemas/json/, cross-referenced by $id):
- scene, character, concept, interaction, metadata, knowledge_base_entry,
  resolved_tag, category_map, prompt_output
- Scene requires all seven sections (collections may be empty); Concept is a
  bare string or an object with required name; Character has an integer id plus
  seven concept arrays; Interaction has integer participants and a concept.
- Each schema carries a major.minor version; unknown fields rejected by default.

Helper (schemas/validation.py):
- validate_document(doc, schema_name, *, allow_unknown=False) -> list of
  structured ValidationIssue (empty = valid); collects all errors.
- Loads all schemas into a referencing registry so cross-schema $ref resolves.
- allow_unknown relaxes additionalProperties per config without duplicating
  schemas (schema-valued additionalProperties, e.g. Category Map, is preserved).

Tests: valid + several invalid documents per schema, unknown-field toggle,
unknown-schema error (34 assertions). Bumps jsonschema to >=4.18 for referencing.

Co-authored-by: kunail0804 <kunail0804@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 18:52:32 +02:00

60 lines
1.7 KiB
TOML

[build-system]
requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"
[project]
name = "comfyui-scene-compiler"
version = "0.1.0"
description = "Deterministic natural-language-to-prompt compiler for ComfyUI (Illustrious)."
readme = "README.md"
requires-python = ">=3.11"
license = { file = "LICENSE" }
authors = [{ name = "kunail0804" }]
# Runtime dependencies are kept minimal; prefer the standard library (MASTER_SPEC §25.9).
# jsonschema is the single validation dependency, used by the schema layer (issue #2 onward).
dependencies = [
"jsonschema>=4.18",
]
[project.optional-dependencies]
dev = [
"pytest>=8.0",
"ruff>=0.6",
]
[project.urls]
Homepage = "https://github.com/kunail0804/ComfyUI-Scene-Compiler"
Wiki = "https://github.com/kunail0804/ComfyUI-Scene-Compiler/wiki"
# The repository root is a ComfyUI custom node; its subdirectories are the importable
# packages. We enumerate them explicitly so packaging does not treat data directories
# (knowledge_base/, prompts/, ...) as Python packages.
[tool.setuptools]
packages = [
"nodes",
"compiler",
"compiler.analyzer",
"compiler.validator",
"compiler.resolver",
"compiler.splitter",
"compiler.builder",
"compiler.common",
"schemas",
]
[tool.ruff]
target-version = "py311"
line-length = 100
[tool.ruff.lint]
# E/W pycodestyle, F pyflakes, I import sorting, UP pyupgrade, B bugbear.
select = ["E", "W", "F", "I", "UP", "B"]
[tool.pytest.ini_options]
testpaths = ["tests"]
# Put the repository root on sys.path so `import compiler`, `import schemas`, etc.
# resolve as top-level packages during tests (the root itself is loaded by ComfyUI
# by path, not by name).
pythonpath = ["."]