2.9 KiB
Repository Guidelines
Project Structure & Module Organization
ComfyUI LoRA Manager pairs a Python backend with browser-side widgets. Backend modules live in py/ with HTTP entry points in py/routes/, feature logic in py/services/, shared helpers in py/utils/, and custom nodes in py/nodes/. UI scripts extend ComfyUI from web/comfyui/, while deploy-ready assets remain in static/ and templates/. Localization files live in locales/, example workflows in example_workflows/, and interim tests such as test_i18n.py sit beside their source until a dedicated tests/ tree lands.
Build, Test, and Development Commands
pip install -r requirements.txtinstalls backend dependencies.python standalone.py --port 8188launches the standalone server for iterative development.python -m pytest test_i18n.pyruns the current regression suite; target new files explicitly, e.g.python -m pytest tests/test_recipes.py.python scripts/sync_translation_keys.pysynchronizes locale keys after UI string updates.
Coding Style & Naming Conventions
Follow PEP 8 with four-space indentation and descriptive snake_case file and function names such as settings_manager.py. Classes stay PascalCase, constants in UPPER_SNAKE_CASE, and loggers retrieved via logging.getLogger(name). Prefer explicit type hints and docstrings on public APIs. JavaScript under web/comfyui/ uses ES modules with camelCase helpers and the _widget.js suffix for UI components.
Testing Guidelines
Pytest powers backend tests. Name modules test_.py and keep them near the code or in a future tests/ package. Mock ComfyUI dependencies through helpers in standalone.py, keep filesystem fixtures deterministic, and ensure translations are covered. Run python -m pytest before submitting changes.
Commit & Pull Request Guidelines
Commits follow the conventional format, e.g. feat(settings): add default model path, and should stay focused on a single concern. Pull requests must outline the problem, summarize the solution, list manual verification steps (server run, targeted pytest), and link related issues. Include screenshots or GIFs for UI or locale updates and call out migration steps such as settings.json adjustments.
Configuration & Localization Tips
Copy settings.json.example to settings.json and adapt model directories before running the standalone server. Store reference assets in civitai/ or docs/ to keep runtime directories deploy-ready. Whenever UI text changes, update every locales/<lang>.json file and rerun the translation sync script so ComfyUI surfaces localized strings.