-
Notifications
You must be signed in to change notification settings - Fork 3
Description
I noticed that this project is adding pyproject.toml to a lot of custom nodes. I'd like to ask if you are also interested in making custom nodes installable via pip. I've done some research about this and found that by using some special options in pyproject.toml, most custom nodes can be packaged and uploaded to PyPI without changing the project structure. Adding this to Comfy-PR should be simple since it's just adding more text to pyproject.toml and it's compatible with ComfyUI Registry.
For example, adding the following content to a custom node:
[project]
# CHANGE: The project name
name = "ComfyUI_Ib_CustomNodes"
version = "0.1.0"
# description = '...'
readme = "README.md"
# requires-python = ">=3.8"
# license = "MIT"
keywords = ["comfyui"]
dynamic = ["dependencies"]
[project.urls]
# CHANGE: Homepage, mostly the GitHub repository
Homepage = "https://github.com/Chaoses-Ib/ComfyUI_Ib_CustomNodes"
comfyui-legacy = "https://github.com/Chaoses-Ib/comfyui-legacy"
[build-system]
requires = ["hatchling", "hatch-requirements-txt"]
build-backend = "hatchling.build"
[tool.hatch.metadata.hooks.requirements_txt]
# CHANGE: Remove this section if there is no requirements.txt
files = ["requirements.txt"]
[tool.hatch.build.targets.sdist]
packages = ["."]
[tool.hatch.build.targets.wheel]
packages = ["."]
exclude = [
"*.md",
"/images",
"/docs",
"/examples",
"/workflow_examples",
"/tests",
]
[tool.hatch.build.targets.sdist.sources]
# CHANGE: Package name. Must be an valid Python id (no dashes)
"." = "ComfyUI_Ib_CustomNodes"
[tool.hatch.build.targets.wheel.sources]
# CHANGE: Same as above
"." = "ComfyUI_Ib_CustomNodes"
[project.entry-points."comfyui_legacy.custom_nodes"]
# CHANGE: Same as above
ComfyUI_Ib_CustomNodes = "ComfyUI_Ib_CustomNodes"Then the custom node can be installed via pip:
pip install git+https://github.com/Chaoses-Ib/ComfyUI_Ib_CustomNodes.gitOne problem with this is ComfyUI won't look up nodes installed via pip. This can be solved by installing a special custom node to loading them. This is already done in ComfyScript, but if you're interested, I can split the related code to a separate repo.
I've already done this change to some custom nodes, including: