Skip to content

Commit

Permalink
feat: add pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaoses-Ib committed Jan 28, 2024
1 parent 8954d07 commit 4e19e4c
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ private/
*.private
*.private.*

# TODO: examples
/prompt.json

# Hatch will only respect the first .gitignore file
/src/comfy_script/runtime/**/*.pyi


# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
56 changes: 55 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,38 @@ It has the following use cases:
- Converting workflows from ComfyUI's web UI format to API format without the web UI.

## Installation
### Package and nodes
Install [ComfyUI](https://github.com/comfyanonymous/ComfyUI) first. And then:
```sh
cd ComfyUI/custom_nodes
git clone --recurse-submodules https://github.com/Chaoses-Ib/ComfyScript.git
cd ComfyScript
python -m pip install -e .
```
(If you see `ERROR: File "setup.py" or "setup.cfg" not found`, run `python -m pip install --upgrade pip` first.)

Update:
```sh
cd ComfyUI/custom_nodes/ComfyScript
git pull
python -m pip install -e .
```

Import example:
```python
import comfy_script
```

### Only nodes
<details>

Install [ComfyUI](https://github.com/comfyanonymous/ComfyUI) first. And then:
```sh
cd ComfyUI/custom_nodes
git clone --recurse-submodules https://github.com/Chaoses-Ib/ComfyScript.git
cd ComfyScript
python -m pip install -r requirements.txt
```
Minimum Python version: 3.9 (ComfyUI's minimum version is 3.8)

Update:
```sh
Expand All @@ -64,6 +88,36 @@ git pull
python -m pip install -r requirements.txt
```

If you want, you can still import the package with a hardcoded path:
```python
import sys
# Or just '../src' if used in the examples directory
sys.path.insert(0, r'D:\...\ComfyUI\custom_nodes\ComfyScript\src')

import comfy_script
```

</details>

### Only package
<details>

```sh
python -m pip install comfy_script
```

Update:
```sh
python -m pip install --upgrade comfy_script
```

Import example:
```python
import comfy_script
```

</details>

## Transpiler
The transpiler can translate ComfyUI's workflows to ComfyScript.

Expand Down
10 changes: 0 additions & 10 deletions examples/runtime.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@
"# ComfyScript Runtime"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"sys.path.insert(0, '../src')"
]
},
{
"cell_type": "code",
"execution_count": 1,
Expand Down
47 changes: 47 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[project]
name = "comfy-script"
version = "0.3.0"
description = "A Python front end and library for ComfyUI"
readme = "README.md"
# ComfyUI: >=3.8
requires-python = ">=3.9"
authors = [
{ name="Chaoses-Ib", email="Chaos-es@outlook.com" },
]
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
dependencies = [
# Client (used by transpiler and runtime)
# Already required by ComfyUI
"aiohttp",

# 1.5.9: https://github.com/erdewit/nest_asyncio/issues/87
"nest_asyncio ~= 1.0, >= 1.5.9",


# Transpiler
"networkx ~= 3.0",

# If you need the CLI:
# click ~= 8.1


# Runtime
# Already required by ComfyUI
"Pillow",

# Jupyter
"ipywidgets ~= 8.1",
]

[project.urls]
Homepage = "https://github.com/Chaoses-Ib/ComfyScript"
Issues = "https://github.com/Chaoses-Ib/ComfyScript/issues"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
# TODO: Exclude docs and examples in sdist?
Empty file added src/comfy_script/__init__.py
Empty file.
1 change: 0 additions & 1 deletion src/comfy_script/runtime/.gitignore

This file was deleted.

0 comments on commit 4e19e4c

Please sign in to comment.