Skip to content

Commit 781be2e

Browse files
committed
[Core] Add ResolveImage node
Copy-paste current implementation of core LoadImage, but use a string input providing an entity reference instead of a file upload, and retrieve input file path from the OpenAssetIO manager. Due to the mix-and-match by ComfyUI of class vs. instance methods, plus no way to inject context, use a singleton class to represent the OpenAssetIO host application. Signed-off-by: David Feltell <[email protected]>
1 parent 7b9843a commit 781be2e

File tree

10 files changed

+534
-144
lines changed

10 files changed

+534
-144
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ indent_style = tab
2929

3030
[{*.yml,*.yaml}]
3131
indent_size = 2
32+
33+
[*.json]
34+
indent_size = 2

__init__.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22
# Copyright (c) 2025 The Foundry Visionmongers Ltd
33
# SPDX-License-Identifier: Apache-2.0
44

5-
"""Top-level package for openassetio-comfyui."""
5+
"""
6+
Top-level package for openassetio-comfyui.
7+
8+
This __init__.py will not be packaged, but is useful if the repository
9+
is checked out under ComfyUI's custom_nodes directory, as it allows
10+
ComfyUI to discover the nodes contained within.
11+
"""
12+
13+
import sys
14+
import pathlib
615

716
__all__ = [
817
"NODE_CLASS_MAPPINGS",
@@ -13,5 +22,8 @@
1322
__email__ = "[email protected]"
1423
__version__ = "1.0.0"
1524

16-
from .src.openassetio_comfyui.nodes import NODE_CLASS_MAPPINGS
17-
from .src.openassetio_comfyui.nodes import NODE_DISPLAY_NAME_MAPPINGS
25+
# Ensure src/ is on the path so we can import from there.
26+
sys.path.append(str(pathlib.Path(__file__).parent / "src"))
27+
28+
from openassetio_comfyui.nodes import NODE_CLASS_MAPPINGS
29+
from openassetio_comfyui.nodes import NODE_DISPLAY_NAME_MAPPINGS

pyproject.toml

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ readme = "README.md"
1717
license = { text = "Apache Software License 2.0" }
1818
requires-python = ">=3.10,<3.12"
1919
classifiers = []
20-
dependencies = []
21-
20+
dependencies = [
21+
"openassetio>=1.0.0",
22+
"openassetio-mediacreation>=1.0.0a12"
23+
]
2224

2325
[project.optional-dependencies]
2426
dev = [
@@ -28,6 +30,7 @@ dev = [
2830
"pre-commit", # runs linting on commit
2931
"pytest", # testing
3032
"ruff", # linting
33+
"openassetio-manager-bal" # mock manager for testing
3134
]
3235

3336
[project.urls]
@@ -77,12 +80,37 @@ target-version = "py311"
7780
# Add rules to ban exec/eval
7881
[tool.ruff.lint]
7982
select = [
83+
# See all rules here: https://docs.astral.sh/ruff/rules
8084
"S102", # exec-builtin
8185
"S307", # eval-used
8286
"W293",
83-
"F", # The "F" series in Ruff stands for "Pyflakes" rules, which catch various Python syntax errors and undefined names.
84-
# See all rules here: https://docs.astral.sh/ruff/rules/#pyflakes-f
87+
# The "F" series in Ruff stands for "Pyflakes" rules, which catch
88+
# various Python syntax errors and undefined names.
89+
"F",
90+
# pydocstyle
91+
"D",
92+
# pycodestyle
93+
"E", "W",
94+
# pylint
95+
"PL"
96+
]
97+
98+
ignore = [
99+
# "One-line docstring should fit on one line" - i.e. expects
100+
# """summary""", not """\nsummary\n""", which is inconsistent with
101+
# other OpenAssetIO projects.
102+
"D200",
103+
# "1 blank line required between summary line and description" -
104+
# triggers if the summary spans more than one line.
105+
"D205"
85106
]
86107

87108
[tool.ruff.lint.flake8-quotes]
88109
inline-quotes = "double"
110+
111+
[tool.ruff.lint.pydocstyle]
112+
convention = "pep257"
113+
114+
[tool.ruff.lint.pycodestyle]
115+
max-doc-length = 72
116+
max-line-length = 99

0 commit comments

Comments
 (0)