[](https://github.com/theUpsider/ComfyUI-Styles_CSV_Loader/actions/workflows/publish.yml)
[](https://github.com/theUpsider/ComfyUI-Styles_CSV_Loader/actions/workflows/test.yml)
Extension for ComfyUI that loads styles from a CSV file.
This extension allows users to load styles from a CSV file (styles.csv), primarily for migration purposes from the automatic1111 Stable Diffusion web UI.
custom_nodes folder of ComfyUI. Restart ComfyUI and the extension should be loaded.Important: The styles.csv file must be located in the root of ComfyUI where main.py resides.
Each style is represented as a dictionary with the keys being style_name and the values being a list containing positive_prompt and negative_prompt. The prompts are outputs of this Node.
The extension now supports loading styles from custom CSV files in addition to the default styles.csv. You can specify a custom CSV file path using the optional csv_file_path parameter:
"my_styles/portrait_styles.csv")"/path/to/my/custom_styles.csv")styles.csv from the ComfyUI root directoryIf a selected style is not found in the custom CSV file, the node will fall back to the default styles loaded from styles.csv.
The CSV file should have the following format:
name,prompt,negative_prompt
"Style Name","positive prompt text","negative prompt text"
"Another Style","more positive text","more negative text"
You can organize your styles in multiple CSV files for different purposes:
portraits.csv:
name,prompt,negative_prompt
"Professional Portrait","portrait photography, professional lighting, sharp focus","ugly, deformed, extra limbs"
"Vintage Portrait","vintage portrait, sepia tone, classical","modern, digital, colorful"
landscapes.csv:
name,prompt,negative_prompt
"Golden Hour","landscape photography, golden hour, wide angle","people, buildings, urban"
"Mountain Vista","mountain landscape, dramatic clouds, epic view","flat, boring, low quality"
“`bash
pip install pytest pytest-cov
“`
Run all tests:
pytest tests/ -v
Run tests with coverage:
pytest tests/ -v --cov=. --cov-report=term-missing
tests/test_styles_csv_loader.py – Main test file for the StylesCSVLoader classtests/fixtures/ – Example CSV files for testing:valid_styles.csv – Properly formatted CSV with valid stylesinvalid_styles.csv – CSV with missing columns to test error handlingcomplex_styles.csv – CSV with complex content (quotes, special characters)The project uses GitHub Actions for CI/CD. Tests are automatically run on:
The project maintains 100% test coverage. Coverage reports are generated during CI runs.