Skip to content

Commit e154194

Browse files
committed
docs: add MkDocs documentation site with GitHub Pages support
- Setup MkDocs Material theme with i18n support - Add comprehensive documentation in English and Chinese - Configure GitHub Actions for automatic deployment - Include guides for installation, usage, DSL, API reference, and more
1 parent 6b39c78 commit e154194

38 files changed

Lines changed: 3424 additions & 0 deletions

.github/workflows/deploy-docs.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Deploy Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docs/**'
9+
- 'mkdocs.yml'
10+
- '.github/workflows/deploy-docs.yml'
11+
workflow_dispatch: # Allow manual trigger
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
deploy:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: '3.12'
27+
28+
- name: Install dependencies
29+
run: |
30+
pip install mkdocs-material mkdocs-static-i18n
31+
32+
- name: Configure Git
33+
run: |
34+
git config --global user.name "github-actions[bot]"
35+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
36+
37+
- name: Deploy to GitHub Pages
38+
run: mkdocs gh-deploy --force --clean --verbose
39+

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,6 @@ quick_test.py
5151
# Keep important files
5252
!LICENSE
5353
!README.md
54+
55+
# MkDocs build output
56+
site/

docs/en/api-reference.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# API Reference
2+
3+
Complete API reference for ComfyKit.
4+
5+
## ComfyKit Class
6+
7+
### Constructor
8+
9+
```python
10+
class ComfyKit:
11+
def __init__(
12+
self,
13+
# Local ComfyUI configuration
14+
comfyui_url: Optional[str] = None,
15+
executor_type: Literal["http", "websocket"] = "http",
16+
api_key: Optional[str] = None,
17+
cookies: Optional[str] = None,
18+
19+
# RunningHub cloud configuration
20+
runninghub_url: Optional[str] = None,
21+
runninghub_api_key: Optional[str] = None,
22+
runninghub_timeout: int = 300,
23+
runninghub_retry_count: int = 3,
24+
)
25+
```
26+
27+
### execute Method
28+
29+
```python
30+
async def execute(
31+
self,
32+
workflow: Union[str, Path],
33+
params: Optional[Dict[str, Any]] = None,
34+
) -> ExecuteResult
35+
```
36+
37+
**Parameters:**
38+
- `workflow`: Workflow source (file path, URL, or RunningHub ID)
39+
- `params`: Workflow parameters
40+
41+
**Returns:**
42+
- `ExecuteResult`: Structured execution result
43+
44+
### execute_json Method
45+
46+
```python
47+
async def execute_json(
48+
self,
49+
workflow_json: Dict[str, Any],
50+
params: Optional[Dict[str, Any]] = None,
51+
) -> ExecuteResult
52+
```
53+
54+
**Parameters:**
55+
- `workflow_json`: Workflow JSON dictionary
56+
- `params`: Workflow parameters
57+
58+
**Returns:**
59+
- `ExecuteResult`: Structured execution result
60+
61+
## ExecuteResult Class
62+
63+
```python
64+
class ExecuteResult:
65+
status: str # "completed" or "failed"
66+
prompt_id: Optional[str] # Prompt ID
67+
duration: Optional[float] # Duration in seconds
68+
69+
# Media outputs
70+
images: List[str] # All image URLs
71+
videos: List[str] # All video URLs
72+
audios: List[str] # All audio URLs
73+
texts: List[str] # All text outputs
74+
75+
# Grouped by variable name
76+
images_by_var: Dict[str, List[str]] # Images by variable
77+
videos_by_var: Dict[str, List[str]] # Videos by variable
78+
audios_by_var: Dict[str, List[str]] # Audios by variable
79+
texts_by_var: Dict[str, List[str]] # Texts by variable
80+
81+
# Raw outputs
82+
outputs: Optional[Dict[str, Any]] # Raw output data
83+
msg: Optional[str] # Error message (if failed)
84+
```
85+
86+
## Usage Example
87+
88+
```python
89+
import asyncio
90+
from comfykit import ComfyKit
91+
92+
async def main():
93+
# Initialize
94+
kit = ComfyKit()
95+
96+
# Execute workflow
97+
result = await kit.execute("workflow.json", {
98+
"prompt": "a cute cat"
99+
})
100+
101+
# Access results
102+
print(f"Status: {result.status}")
103+
print(f"Images: {result.images}")
104+
print(f"Duration: {result.duration}s")
105+
106+
asyncio.run(main())
107+
```
108+
109+
## Next Steps
110+
111+
- Check out complete [Examples](examples.md)
112+
- Learn about [Configuration](configuration.md)
113+

docs/en/configuration.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Configuration
2+
3+
ComfyKit configuration guide.
4+
5+
## Configuration Priority
6+
7+
ComfyKit uses the following priority for configuration:
8+
9+
1. **Constructor parameters** (highest priority)
10+
2. **Environment variables**
11+
3. **Default values**
12+
13+
## Local ComfyUI Configuration
14+
15+
```python
16+
kit = ComfyKit(
17+
# ComfyUI server URL
18+
comfyui_url="http://127.0.0.1:8188", # Default
19+
20+
# Execution mode: http (recommended) or websocket
21+
executor_type="http", # Default
22+
23+
# API Key (if ComfyUI requires authentication)
24+
api_key="your-api-key",
25+
26+
# Cookies (if needed)
27+
cookies="session=abc123"
28+
)
29+
```
30+
31+
## RunningHub Cloud Configuration
32+
33+
```python
34+
kit = ComfyKit(
35+
# RunningHub API URL
36+
runninghub_url="https://www.runninghub.ai", # Default
37+
38+
# RunningHub API Key (required)
39+
runninghub_api_key="rh-key-xxx",
40+
41+
# Timeout (seconds)
42+
runninghub_timeout=300, # Default: 5 minutes
43+
44+
# Retry count
45+
runninghub_retry_count=3 # Default: 3 retries
46+
)
47+
```
48+
49+
## Environment Variables
50+
51+
```bash
52+
# ComfyUI configuration
53+
export COMFYUI_BASE_URL="http://127.0.0.1:8188"
54+
export COMFYUI_EXECUTOR_TYPE="http"
55+
export COMFYUI_API_KEY="your-api-key"
56+
export COMFYUI_COOKIES="session=abc123"
57+
58+
# RunningHub configuration
59+
export RUNNINGHUB_BASE_URL="https://www.runninghub.ai"
60+
export RUNNINGHUB_API_KEY="rh-key-xxx"
61+
export RUNNINGHUB_TIMEOUT="300"
62+
export RUNNINGHUB_RETRY_COUNT="3"
63+
```
64+
65+
## Complete Example
66+
67+
```python
68+
from comfykit import ComfyKit
69+
70+
# All parameters
71+
kit = ComfyKit(
72+
# Local ComfyUI
73+
comfyui_url="http://127.0.0.1:8188",
74+
executor_type="http",
75+
api_key="your-api-key",
76+
cookies="session=abc123",
77+
78+
# RunningHub
79+
runninghub_url="https://www.runninghub.ai",
80+
runninghub_api_key="rh-key-xxx",
81+
runninghub_timeout=300,
82+
runninghub_retry_count=3,
83+
)
84+
```
85+
86+
## Next Steps
87+
88+
- Learn about [Usage](usage/basic.md)
89+
- Check [API Reference](api-reference.md)
90+

docs/en/contributing.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Contributing
2+
3+
Contributions are welcome! Please check [Issues](https://github.com/puke3615/ComfyKit/issues) for areas that need help.
4+
5+
## Contribution Process
6+
7+
1. Fork this repository
8+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
9+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
10+
4. Push to the branch (`git push origin feature/amazing-feature`)
11+
5. Open a Pull Request
12+
13+
## Development Setup
14+
15+
```bash
16+
# Clone the repository
17+
git clone https://github.com/puke3615/ComfyKit.git
18+
cd ComfyKit
19+
20+
# Install dependencies
21+
uv sync --extra dev
22+
23+
# Run tests
24+
pytest
25+
26+
# Format code
27+
ruff format
28+
ruff check --fix
29+
```
30+
31+
## Guidelines
32+
33+
- Write tests for new features
34+
- Follow existing code style
35+
- Update documentation
36+
- Add examples if needed
37+
38+
## Questions?
39+
40+
Feel free to open an issue for discussion!
41+

docs/en/development.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Development
2+
3+
Guide for ComfyKit development.
4+
5+
## Install Development Dependencies
6+
7+
```bash
8+
uv sync --extra dev
9+
```
10+
11+
## Run Tests
12+
13+
```bash
14+
pytest
15+
```
16+
17+
## Code Formatting
18+
19+
```bash
20+
ruff check --fix
21+
ruff format
22+
```
23+
24+
## Project Structure
25+
26+
```
27+
ComfyKit/
28+
├── comfykit/ # Main package
29+
│ ├── comfyui/ # ComfyUI integration
30+
│ └── utils/ # Utilities
31+
├── examples/ # Example scripts
32+
├── workflows/ # Example workflows
33+
└── tests/ # Test suite
34+
```
35+
36+
## Next Steps
37+
38+
- Check [Contributing](contributing.md) guide
39+
- Read [API Reference](api-reference.md)
40+

0 commit comments

Comments
 (0)