Skip to content

Commit 243285b

Browse files
committed
[Core] Initial cookiecutter project
See https://github.com/Comfy-Org/cookiecutter-comfy-extension Signed-off-by: David Feltell <[email protected]>
1 parent 3d30afa commit 243285b

17 files changed

+566
-0
lines changed

.editorconfig

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# http://editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
indent_style = space
7+
indent_size = 4
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
charset = utf-8
11+
end_of_line = lf
12+
max_line_length = 140
13+
# For docstrings and comments.
14+
ij_visual_guides = 72
15+
16+
[*.bat]
17+
indent_style = tab
18+
end_of_line = crlf
19+
20+
[LICENSE]
21+
insert_final_newline = false
22+
23+
[Makefile]
24+
indent_style = tab

.github/ISSUE_TEMPLATE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
* openassetio-comfyui version:
2+
* Python version:
3+
* Operating System:
4+
5+
### Description
6+
7+
Describe what you were trying to get done.
8+
Tell us what happened, what went wrong, and what you expected to happen.
9+
10+
### What I Did
11+
12+
```
13+
Paste the command(s) you ran and the output.
14+
If there was a crash, please include the traceback here.
15+
```
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI build
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
- main
8+
jobs:
9+
build:
10+
runs-on: ${{ matrix.os }}
11+
env:
12+
PYTHONIOENCODING: "utf8"
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest]
16+
python-version: ["3.12"]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install .[dev]
28+
- name: Run Linting
29+
run: |
30+
ruff check .
31+
- name: Run Tests
32+
run: |
33+
pytest tests/

.github/workflows/publish_node.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: 📦 Publish to Comfy registry
2+
on:
3+
workflow_dispatch:
4+
push:
5+
tags:
6+
- '*'
7+
8+
permissions:
9+
issues: write
10+
11+
jobs:
12+
publish-node:
13+
name: Publish Custom Node to registry
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: ♻️ Check out code
17+
uses: actions/checkout@v4
18+
- name: 📦 Publish Custom Node
19+
uses: Comfy-Org/publish-node-action@main
20+
with:
21+
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}

.github/workflows/validate.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Validate backwards compatibility
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
- main
8+
9+
jobs:
10+
validate:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: comfy-org/node-diff@main

.gitignore

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# OSX useful to ignore
7+
*.DS_Store
8+
.AppleDouble
9+
.LSOverride
10+
11+
# Thumbnails
12+
._*
13+
14+
# Files that might appear in the root of a volume
15+
.DocumentRevisions-V100
16+
.fseventsd
17+
.Spotlight-V100
18+
.TemporaryItems
19+
.Trashes
20+
.VolumeIcon.icns
21+
.com.apple.timemachine.donotpresent
22+
23+
# Directories potentially created on remote AFP share
24+
.AppleDB
25+
.AppleDesktop
26+
Network Trash Folder
27+
Temporary Items
28+
.apdisk
29+
30+
# C extensions
31+
*.so
32+
33+
# Distribution / packaging
34+
.Python
35+
env/
36+
venv/
37+
build/
38+
develop-eggs/
39+
dist/
40+
downloads/
41+
eggs/
42+
.eggs/
43+
lib/
44+
lib64/
45+
parts/
46+
sdist/
47+
var/
48+
*.egg-info/
49+
.installed.cfg
50+
*.egg
51+
52+
# PyInstaller
53+
# Usually these files are written by a python script from a template
54+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
55+
*.manifest
56+
*.spec
57+
58+
# Installer logs
59+
pip-log.txt
60+
pip-delete-this-directory.txt
61+
62+
# Unit test / coverage reports
63+
htmlcov/
64+
.tox/
65+
.coverage
66+
.coverage.*
67+
.cache
68+
nosetests.xml
69+
coverage.xml
70+
*,cover
71+
.hypothesis/
72+
.pytest_cache/
73+
74+
# Translations
75+
*.mo
76+
*.pot
77+
78+
# Django stuff:
79+
*.log
80+
81+
# Sphinx documentation
82+
docs/_build/
83+
84+
# IntelliJ Idea
85+
.idea
86+
*.iml
87+
*.ipr
88+
*.iws
89+
90+
# PyBuilder
91+
target/
92+
93+
# Cookiecutter
94+
output/
95+
python_boilerplate/
96+
cookiecutter-pypackage-env/
97+
98+
# vscode settings
99+
.history/
100+
*.code-workspace
101+
102+
# Frontend extension
103+
node_modules/
104+
.env
105+
.env.local
106+
.env.development.local
107+
.env.test.local
108+
.env.production.local
109+
npm-debug.log*
110+
yarn-debug.log*
111+
yarn-error.log*
112+
node.zip
113+
.vscode/
114+
.claude/

.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
# Ruff version.
4+
rev: v0.4.9
5+
hooks:
6+
# Run the linter.
7+
- id: ruff
8+
args: [ --fix ]
9+
# Run the formatter.
10+
- id: ruff-format

MANIFEST.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
include LICENSE
2+
include README.md
3+
4+
recursive-exclude * __pycache__
5+
recursive-exclude * *.py[co]
6+
7+
recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
8+
9+

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# OpenAssetIO-ComfyUI
2+
3+
OpenAssetIO ingress and egress
4+
5+
> [!NOTE]
6+
> This projected was created with a [cookiecutter](https://github.com/Comfy-Org/cookiecutter-comfy-extension) template. It helps you start writing custom nodes without worrying about the Python setup.
7+
8+
## Quickstart
9+
10+
1. Install [ComfyUI](https://docs.comfy.org/get_started).
11+
1. Install [ComfyUI-Manager](https://github.com/ltdrdata/ComfyUI-Manager)
12+
1. Look up this extension in ComfyUI-Manager. If you are installing manually, clone this repository under `ComfyUI/custom_nodes`.
13+
1. Restart ComfyUI.
14+
15+
# Features
16+
17+
- A list of features
18+
19+
## Develop
20+
21+
To install the dev dependencies and pre-commit (will run the ruff hook), do:
22+
23+
```bash
24+
cd openassetio-comfyui
25+
pip install -e .[dev]
26+
pre-commit install
27+
```
28+
29+
The `-e` flag above will result in a "live" install, in the sense that any changes you make to your node extension will automatically be picked up the next time you run ComfyUI.
30+
31+
## Publish to Github
32+
33+
Install Github Desktop or follow these [instructions](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) for ssh.
34+
35+
1. Create a Github repository that matches the directory name.
36+
2. Push the files to Git
37+
```
38+
git add .
39+
git commit -m "project scaffolding"
40+
git push
41+
```
42+
43+
## Writing custom nodes
44+
45+
An example custom node is located in [node.py](src/openassetio-comfyui/nodes.py). To learn more, read the [docs](https://docs.comfy.org/essentials/custom_node_overview).
46+
47+
48+
## Tests
49+
50+
This repo contains unit tests written in Pytest in the `tests/` directory. It is recommended to unit test your custom node.
51+
52+
- [build-pipeline.yml](.github/workflows/build-pipeline.yml) will run pytest and linter on any open PRs
53+
- [validate.yml](.github/workflows/validate.yml) will run [node-diff](https://github.com/Comfy-Org/node-diff) to check for breaking changes
54+
55+
## Publishing to Registry
56+
57+
If you wish to share this custom node with others in the community, you can publish it to the registry. We've already auto-populated some fields in `pyproject.toml` under `tool.comfy`, but please double-check that they are correct.
58+
59+
You need to make an account on https://registry.comfy.org and create an API key token.
60+
61+
- [ ] Go to the [registry](https://registry.comfy.org). Login and create a publisher id (everything after the `@` sign on your registry profile).
62+
- [ ] Add the publisher id into the pyproject.toml file.
63+
- [ ] Create an api key on the Registry for publishing from Github. [Instructions](https://docs.comfy.org/registry/publishing#create-an-api-key-for-publishing).
64+
- [ ] Add it to your Github Repository Secrets as `REGISTRY_ACCESS_TOKEN`.
65+
66+
A Github action will run on every git push. You can also run the Github action manually. Full instructions [here](https://docs.comfy.org/registry/publishing). Join our [discord](https://discord.com/invite/comfyorg) if you have any questions!
67+

__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""Top-level package for openassetio-comfyui."""
2+
3+
__all__ = [
4+
"NODE_CLASS_MAPPINGS",
5+
"NODE_DISPLAY_NAME_MAPPINGS",
6+
]
7+
8+
__author__ = """Contributors to the OpenAssetIO project"""
9+
__email__ = "[email protected]"
10+
__version__ = "1.0.0"
11+
12+
from .src.openassetio_comfyui.nodes import NODE_CLASS_MAPPINGS
13+
from .src.openassetio_comfyui.nodes import NODE_DISPLAY_NAME_MAPPINGS

0 commit comments

Comments
 (0)