|
1 | 1 | # OpenAssetIO-ComfyUI
|
2 | 2 |
|
3 |
| -OpenAssetIO ingress and egress |
| 3 | +## What |
4 | 4 |
|
5 |
| -> [!NOTE] |
6 |
| -> This projected was created with |
7 |
| -> a [cookiecutter](https://github.com/Comfy-Org/cookiecutter-comfy-extension) template. It helps you |
8 |
| -> start |
9 |
| -> writing custom nodes without worrying about the Python setup. |
| 5 | +Custom [ComfyUI](https://comfy.org) nodes for resolving and publishing |
| 6 | +assets directly from a workflow via |
| 7 | +[OpenAssetIO](https://docs.openassetio.org/OpenAssetIO/). |
10 | 8 |
|
11 |
| -## Quickstart |
| 9 | +## Why |
12 | 10 |
|
13 |
| -1. Install [ComfyUI](https://docs.comfy.org/get_started). |
14 |
| -1. Install [ComfyUI-Manager](https://github.com/ltdrdata/ComfyUI-Manager) |
15 |
| -1. Look up this extension in ComfyUI-Manager. If you are installing manually, clone this repository |
16 |
| - under `ComfyUI/custom_nodes`. |
17 |
| -1. Restart ComfyUI. |
| 11 | +This project allows ComfyUI to leverage the abilities of |
| 12 | +OpenAssetIO-enabled asset management systems, such as versioning, |
| 13 | +dependency tracking, and collaboration. |
18 | 14 |
|
19 |
| -# Features |
| 15 | +For example, if the asset manager supports a meta-version of "latest", |
| 16 | +then the workflow inputs can be updated without having to edit the |
| 17 | +workflow or move files around. |
20 | 18 |
|
21 |
| -- A list of features |
| 19 | +Then, when the workflow completes, the output can be published back to |
| 20 | +the asset manager, which typically creates a new version/revision |
| 21 | +(rather than overwriting), and makes the output available for review and |
| 22 | +for use by downstream tools. |
22 | 23 |
|
23 |
| -## Develop |
| 24 | +## Features |
24 | 25 |
|
25 |
| -To install the dev dependencies and pre-commit (will run the ruff hook), do: |
| 26 | +- _OpenAssetIO Resolve Image_: An alternative to the built-in |
| 27 | + _Load Image_ node that resolves an OpenAssetIO entity reference to an |
| 28 | + image. |
26 | 29 |
|
27 |
| -```bash |
28 |
| -cd openassetio-comfyui |
29 |
| -pip install -e .[dev] |
30 |
| -pre-commit install |
31 |
| -``` |
| 30 | +- _OpenAssetIO Publish Image_: An alternative to the built-in _Save |
| 31 | + Image_ node that publishes the output of a workflow to an OpenAssetIO |
| 32 | + entity reference. |
| 33 | + |
| 34 | +## Requirements |
| 35 | + |
| 36 | +The plugin is known to work with |
32 | 37 |
|
33 |
| -The `-e` flag above will result in a "live" install, in the sense that any changes you make to your |
34 |
| -node extension will automatically be |
35 |
| -picked up the next time you run ComfyUI. |
| 38 | +- Python 3.11 |
| 39 | +- [ComfyUI](https://comfy.org) 0.3.57 |
| 40 | +- [OpenAssetIO](https://github.com/OpenAssetIO/OpenAssetIO) 1.0.0 |
| 41 | +- [OpenAssetIO-MediaCreation](https://github.com/OpenAssetIO/OpenAssetIO-MediaCreation) |
| 42 | + 1.0.0-alpha.12 |
36 | 43 |
|
37 |
| -## Publish to Github |
| 44 | +## Installation |
38 | 45 |
|
39 |
| -Install Github Desktop or follow |
40 |
| -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) |
41 |
| -for ssh. |
| 46 | +Install [ComfyUI](https://docs.comfy.org/get_started). |
42 | 47 |
|
43 |
| -1. Create a Github repository that matches the directory name. |
44 |
| -2. Push the files to Git |
| 48 | +Clone this repository under `ComfyUI/custom_nodes`. |
| 49 | + |
| 50 | +From the repository root, install dependencies |
45 | 51 |
|
46 | 52 | ```
|
47 |
| -git add . |
48 |
| -git commit -m "project scaffolding" |
49 |
| -git push |
| 53 | +pip install -r requirements.txt |
50 | 54 | ```
|
51 | 55 |
|
52 |
| -## Writing custom nodes |
| 56 | +Ensure the ComfyUI execution environment is configured correctly for an |
| 57 | +OpenAssetIO host application. See the |
| 58 | +[OpenAssetIO documentation](https://docs.openassetio.org/OpenAssetIO/runtime_configuration.html) |
| 59 | +for general instructions on host application configuration. |
53 | 60 |
|
54 |
| -An example custom node is located in [node.py](src/openassetio-comfyui/nodes.py). To learn more, |
55 |
| -read |
56 |
| -the [docs](https://docs.comfy.org/essentials/custom_node_overview). |
| 61 | +In particular, ensure the `OPENASSETIO_DEFAULT_CONFIG` environment |
| 62 | +variable contains a path to a valid OpenAssetIO configuration file. |
57 | 63 |
|
58 |
| -## Tests |
| 64 | +## Development |
59 | 65 |
|
60 |
| -This repo contains unit tests written in Pytest in the `tests/` directory. It is recommended to |
61 |
| -unit test your custom node. |
| 66 | +To install the dev dependencies and pre-commit (will run the |
| 67 | +[Ruff](https://docs.astral.sh/ruff/) hook), from the repository root run |
62 | 68 |
|
63 |
| -- [build-pipeline.yml](.github/workflows/build-pipeline.yml) will run pytest and linter on any open |
64 |
| - PRs |
65 |
| -- [validate.yml](.github/workflows/validate.yml) will |
66 |
| - run [node-diff](https://github.com/Comfy-Org/node-diff) to check for breaking changes |
| 69 | +```bash |
| 70 | +pip install -e .[dev] |
| 71 | +pre-commit install |
| 72 | +``` |
67 | 73 |
|
68 |
| -## Publishing to Registry |
| 74 | +> Note that installing this project to the Python environment has no |
| 75 | +> effect on ComfyUI, since it loads plugins from the `custom_nodes` |
| 76 | +> directory. However, installing the package helps with IDE code |
| 77 | +> completion and linting; and of course ensures test/lint dependencies |
| 78 | +> are installed. |
| 79 | +
|
| 80 | +### Running Tests |
| 81 | + |
| 82 | +This project contains unit tests written in |
| 83 | +[pytest](https://docs.pytest.org/en/stable/) in the `tests` directory. |
| 84 | +To run the tests, from the repository root run |
| 85 | + |
| 86 | +```bash |
| 87 | +pytest tests |
| 88 | +``` |
| 89 | + |
| 90 | +### Linting |
| 91 | + |
| 92 | +The project makes use of the [Ruff](https://docs.astral.sh/ruff/) |
| 93 | +linter, configured through the `pyproject.toml` file. To run Ruff, from |
| 94 | +the repository root run |
| 95 | + |
| 96 | +```bash |
| 97 | +ruff check . |
| 98 | +``` |
69 | 99 |
|
70 |
| -If you wish to share this custom node with others in the community, you can publish it to the |
71 |
| -registry. We've already auto-populated some |
72 |
| -fields in `pyproject.toml` under `tool.comfy`, but please double-check that they are correct. |
| 100 | +## License |
73 | 101 |
|
74 |
| -You need to make an account on https://registry.comfy.org and create an API key token. |
| 102 | +Apache-2.0 - See [LICENSE](./LICENSE) file for details. |
75 | 103 |
|
76 |
| -- [ ] Go to the [registry](https://registry.comfy.org). Login and create a publisher id (everything |
77 |
| - after the `@` sign on your registry |
78 |
| - profile). |
79 |
| -- [ ] Add the publisher id into the pyproject.toml file. |
80 |
| -- [ ] Create an api key on the Registry for publishing from |
81 |
| - Github. [Instructions](https://docs.comfy.org/registry/publishing#create-an-api-key-for-publishing). |
82 |
| -- [ ] Add it to your Github Repository Secrets as `REGISTRY_ACCESS_TOKEN`. |
| 104 | +## Contributing |
83 | 105 |
|
84 |
| -A Github action will run on every git push. You can also run the Github action manually. Full |
85 |
| -instructions [here](https://docs.comfy.org/registry/publishing). Join |
86 |
| -our [discord](https://discord.com/invite/comfyorg) if you have any |
87 |
| -questions! |
| 106 | +Please feel free to contribute pull requests or issues. Note that |
| 107 | +contributions will require signing a CLA. |
88 | 108 |
|
| 109 | +See the OpenAssetIO contribution docs for how to structure |
| 110 | +[commit messages](https://github.com/OpenAssetIO/OpenAssetIO/blob/main/doc/contributing/COMMITS.md), |
| 111 | +the [pull request process](https://github.com/OpenAssetIO/OpenAssetIO/blob/main/doc/contributing/PULL_REQUESTS.md), |
| 112 | +and [coding style guide](https://github.com/OpenAssetIO/OpenAssetIO/blob/main/doc/contributing/CODING_STYLE.md). |
0 commit comments