{"id":37084591,"url":"https://github.com/lonelyowl13/comfyui-workflow-generator","last_synced_at":"2026-01-14T10:22:48.159Z","repository":{"id":309112768,"uuid":"1034079203","full_name":"lonelyowl13/comfyui-workflow-generator","owner":"lonelyowl13","description":"A Python package for generating ComfyUI workflow APIs from object_info.json using AST code generator","archived":false,"fork":false,"pushed_at":"2025-08-14T14:13:46.000Z","size":278,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-30T09:20:08.298Z","etag":null,"topics":["comfyui","comfyui-workflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lonelyowl13.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-07T20:05:57.000Z","updated_at":"2025-08-14T14:13:49.000Z","dependencies_parsed_at":"2025-08-09T23:55:41.233Z","dependency_job_id":"cdd4cade-2b14-4b70-9aae-6bf08c9fc8a2","html_url":"https://github.com/lonelyowl13/comfyui-workflow-generator","commit_stats":null,"previous_names":["lonelyowl13/comfyui-workflow-generator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lonelyowl13/comfyui-workflow-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lonelyowl13%2Fcomfyui-workflow-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lonelyowl13%2Fcomfyui-workflow-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lonelyowl13%2Fcomfyui-workflow-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lonelyowl13%2Fcomfyui-workflow-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lonelyowl13","download_url":"https://codeload.github.com/lonelyowl13/comfyui-workflow-generator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lonelyowl13%2Fcomfyui-workflow-generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28417004,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:18:03.274Z","status":"ssl_error","status_checked_at":"2026-01-14T10:16:11.865Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["comfyui","comfyui-workflow"],"created_at":"2026-01-14T10:22:47.444Z","updated_at":"2026-01-14T10:22:48.153Z","avatar_url":"https://github.com/lonelyowl13.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ComfyUI Workflow Generator\n\nA Python package for generating ComfyUI workflow APIs from `object_info.json` using AST code generator.\nLike ComfyScript, but much more simple. \n\n## Installation\n\n```bash\npip install comfyui-workflow-generator\n```\n\n## Usage\n\n### 1. Generate Workflow API\n\n#### From Command Line\n\n```bash\n# Generate from local object_info.json (auto-detected)\ncomfyui-generate object_info.json -o my_workflow_api.py\n\n# Generate from ComfyUI server (auto-detected)\ncomfyui-generate http://127.0.0.1:8188/object_info -o workflow_api.py\n\n# Generate with default output name\ncomfyui-generate object_info.json\n```\n\n#### From Python\n\n```python\n# Import the generated API\nfrom workflow_api import Workflow\nfrom comfyui_workflow_generator import ComfyUIWorkflowExecutor\n\n# Step 1: Upload image with custom name\nexecutor = ComfyUIWorkflowExecutor(\"http://127.0.0.1:8188\")\nuploaded_filename = executor.upload_image(\n    \"my_very_own_image.png\", \n    image_name=\"my_very_own_image.png\"\n)\n\n# Step 2: Create workflow\nwf = Workflow()\n\n# Load checkpoint\nmodel, clip, _ = wf.CheckpointLoaderSimple(ckpt_name=\"Illustrious-XL-v1.0.safetensors\")\n\n# Load vae, i usually do it via separate node\nvae = wf.VAELoader(vae_name=\"sdxl_vae.safetensors\")\n\n# Load uploaded image (use the uploaded filename)\nimage, mask = wf.LoadImage(image=\"my_very_own_image.png\")\n\n# Encode prompts\npositive = wf.CLIPTextEncode(text=\"1girl, lisa_\\(genshin_impact\\)\", clip=clip)\nnegative = wf.CLIPTextEncode(text=\"blurry, low quality\", clip=clip)\n\n# Encode image for img2img\nlatent = wf.VAEEncode(pixels=image, vae=vae)\n\n# Sample\ndenoized_latent = wf.KSampler(\n    model=model,\n    seed=42,\n    steps=20,\n    cfg=8.0,\n    sampler_name=\"euler\",\n    scheduler=\"normal\",\n    positive=positive,\n    negative=negative,\n    latent_image=latent,\n    denoise=0.8\n)\n\n# Decode\nresult_image = wf.VAEDecode(samples=denoized_latent, vae=vae)\n\n# Save\nwf.SaveImage(images=result_image, filename_prefix=\"lisa_from_genshin\")\n\n# Step 3: Get workflow JSON (for debugging or manual inspection)\nworkflow_json = wf.get_workflow()\nprint(\"Generated workflow:\", workflow_json)\n\n# save it to file, it could be loaded in comfyui\nwith open(\"workflow_json.json\", \"w\") as f:\n    f.write(workflow_json)\n\n# Step 4: Execute it (do not feed it with json, it expects dict)\nresults = executor.execute_workflow(wf.workflow_dict, output_dir=\"./results\")\n```\n\n## Generated workflow look like this:\n\n![Example workflow in ComfyUI](assets/workflow.png)\n\n\n## Key Design Principles\n\n### 1. **No Input Manipulation**\nThe workflow executor executes workflows exactly as provided, without any modifications.\n\n### 1. **No Weird Features**\nNo nested event loops, no Real Mode, Unreal Mode, or other terms from the jargon of x86 assembler programmers of the 90s. It's just a workflow generator, thicc as brick. \n\n### 3. **Type Safety**\nGenerated APIs include proper return type hints:\n\n```python\ndef CheckpointLoaderSimple(self, ckpt_name: str) -\u003e(MODEL, CLIP, VAE):\n    ...\n\ndef LoadImage(self, image: str) -\u003e(IMAGE, MASK):\n    ...\n\ndef KSampler(self, model: MODEL, seed: int, steps: int, cfg: float,\n        sampler_name: str, scheduler: str, positive: CONDITIONING, negative:\n        CONDITIONING, latent_image: LATENT, denoise: float) -\u003eLATENT:\n    ...\n```\n\n\n## Package Structure\n\n```\ncomfyui_workflow_generator/\n├── __init__.py          # Package exports\n├── generator.py         # AST-based code generator\n├── executor.py          # Workflow execution (no input manipulation)\n└── cli.py              # Command-line interface\n```\n\n## Development\n\n```bash\n# Install in development mode\npip install -e .\n\n# Run tests\npytest\n\n# Format code\nblack comfyui_workflow_generator/\n\n# Lint code\nflake8 comfyui_workflow_generator/\n```\n\n## Testing\n\n### Running Tests\n\n```bash\n# Run all tests\npython -m pytest tests/ -v\n\n# Run specific test categories\npython run_tests.py --unit        # Unit tests only\npython run_tests.py --cli         # CLI tests only  \npython run_tests.py --executor    # Executor tests only\npython run_tests.py --integration # Integration tests only\n\n# Run with coverage\npython -m pytest tests/ --cov=comfyui_workflow_generator --cov-report=html\n```\n\n### Test Categories\n\n- **Unit Tests** (`tests/test_generator.py`): Test individual components like workflow generation, type normalization, and AST manipulation\n- **CLI Tests** (`tests/test_cli.py`): Test command-line interface functionality and error handling\n- **Executor Tests** (`tests/test_executor.py`): Test workflow execution, file uploads, and server communication\n- **Integration Tests** (`tests/test_integration.py`): Test complete workflows from generation to execution\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flonelyowl13%2Fcomfyui-workflow-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flonelyowl13%2Fcomfyui-workflow-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flonelyowl13%2Fcomfyui-workflow-generator/lists"}