<div align="center">
<h1>yors_comfyui_node_setup</h1>
<p>
<strong>🤖 A python library for setup comfyui custom nodes for developers in development.</strong>
</p>
![PyPI - Version](https://img.shields.io/pypi/v/yors_comfyui_node_setup)
![PyPI - License](https://img.shields.io/pypi/l/yors_comfyui_node_setup)
</div>
to setup comfyui custom nodes for developers in development:
- install requriements automatically for nodes
- entry - export comfyui node vars automatically
## Why
- setup your comfyui nodes easily
- install requirements automatically (easy and optional)
- set your comfyui nodes to right mouse menu as your likes (easy and optional)
## 1 - install python package
```bash
pip install yors_comfyui_node_setup
# yors_comfyui_node_util
```
## 2 - use it in your python code
- in some comfyui custom nodes project or module
- code in `__init__.py`
```py
# ucase 1.0:
# from yors_comfyui_node_setup import entry,node_install_requirements # global
# # install requirements
# node_install_requirements(__file__)
# # export comfyui node vars
# __all__,NODE_CLASS_MAPPINGS,NODE_DISPLAY_NAME_MAPPINGS,NODE_MENU_NAMES = entry(__name__,__file__)
# ucase 2.0:
from yors_comfyui_node_setup import node_install_requirements,entry_pre_import,entry_import,get_all_classs_in_sys,register_node_list_local
# install requirements automatically
# if requrements.txt in here and deps in it not installed
node_install_requirements(__file__)
# gen __all__ and import moudle with __all__
# with this you can wirte your nodes in any py file in the same diretory
__all__ = entry_pre_import(__name__,__file__)
entry_import(__name__,__all__)
# get class after importing moudle with __all__
this_module_all_classes = get_all_classs_in_sys(__name__)
# register node with default category
# it will not register the same node if you/he/she register the same nodes in other custom repo. (save disk space)
NODE_CLASS_MAPPINGS,NODE_DISPLAY_NAME_MAPPINGS,NODE_MENU_NAMES = register_node_list_local(this_module_all_classes,False)
# addtional register node with custom category (no test)
# NODE_CLASS_MAPPINGS,NODE_DISPLAY_NAME_MAPPINGS,NODE_MENU_NAMES = register_node_list_local(this_module_all_classes,True,"YMC/as_x_type")
print("\n".join(NODE_MENU_NAMES))
```
## 3 - code yours nodes
- dirs map of your node may be:
```
.
└─__init__.py
└─nodes.py
```
- in any py file (no test in `__init__.py`)
- code nodes.py
```py
# 1. define yors comfyui nodes here
# ...
# ucase 1.0:
# class AnyType(str):
# """A special class that is always equal in not equal comparisons. Credit to pythongosssss"""
# def __ne__(self, __value: object) -> bool:
# return False
# any_type = AnyType("*")
# CURRENT_CATEGORY="YMC/LINK" # set the right mouse button menu (custom for your comfyui nodes)
# CURRENT_FUNCTION="exec"
# class NodeSetItAsImage:
# @classmethod
# def INPUT_TYPES(s):
# return {
# "required": {
# },
# "optional":{
# "a": (any_type),
# },
# # "hidden": {
# # "unique_id": "UNIQUE_ID",
# # "extra_pnginfo": "EXTRA_PNGINFO",
# # },
# }
# # INPUT_IS_LIST = True
# RETURN_TYPES = ("IMAGE",)
# RETURN_NAMES = ("image",)
# FUNCTION = CURRENT_FUNCTION
# CATEGORY = CURRENT_CATEGORY
# # set NODE_NAME and NODE_DESC for yors_comfyui_node_setup
# NODE_NAME = "as image"
# NODE_DESC = "set it as image type"
# # OUTPUT_NODE = True
# # OUTPUT_IS_LIST = (True,)
# def exec(self, a=None):
# return (a,)
# ucase 1.1:
from yors_comfyui_node_as_x_type import * # import all yors comfyui nodes from it
# ucase 1.2:
# from yors_comfyui_node_as_x_type import NodeSetItAsImage # import some yors comfyui nodes from it
# 2. reset yors comfyui nodes category (it will be used set rmb in yors_comfyui_node_setup)
# from yors_comfyui_node_reset_rmb import reset_rmb
# reset_rmb(__name__,"YMC/as_x_type") // danger!
# 3. set nodes category alias
# to set the right mouse menu as your likes.
# set nodes defined in yors_comfyui_node_as_x_type under the category YMC/as_x_type
import yors_comfyui_node_as_x_type as base
from yors_comfyui_node_setup import get_sys_module,set_node_class_category_alias
this_py_module = get_sys_module(__name__)
set_node_class_category_alias(base,this_py_module,"YMC/as_x_type",True)
```
## the dirs of your comfyui nodes repo
```
.
│ .gitignore
│ LICENSE
│ nodes.py
│ requirements.txt
│ __init__.py
└─link # some nodes to link nodes
__init__.py
xx.py
...
└─utils # some nodes for util process
__init__.py
xx.py
...
└─image # some nodes for image process
__init__.py
xx.py
...
```
## Author
ymc-github <ymc.github@gmail.com>
## License
MIT
Raw data
{
"_id": null,
"home_page": "https://github.com/ymc-github/panz/blob/main/packages/yors_comfyui_node_setup/README.md",
"name": "yors_comfyui_node_setup",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "artist, panz, mono, yors_comfyui_node_setup",
"author": "yemiancheng",
"author_email": "ymc.github@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/fd/97/5d45bbb42a09e2bd3d5fa8d0d53d65154ad280cbdbedfc6c0f632424f726/yors_comfyui_node_setup-0.7.0.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n <h1>yors_comfyui_node_setup</h1>\n <p>\n <strong>\ud83e\udd16 A python library for setup comfyui custom nodes for developers in development.</strong>\n </p>\n \n ![PyPI - Version](https://img.shields.io/pypi/v/yors_comfyui_node_setup)\n ![PyPI - License](https://img.shields.io/pypi/l/yors_comfyui_node_setup)\n\n</div>\n\nto setup comfyui custom nodes for developers in development:\n\n- install requriements automatically for nodes\n- entry - export comfyui node vars automatically\n\n## Why\n\n- setup your comfyui nodes easily\n- install requirements automatically (easy and optional)\n- set your comfyui nodes to right mouse menu as your likes (easy and optional)\n\n## 1 - install python package\n\n```bash\npip install yors_comfyui_node_setup\n# yors_comfyui_node_util\n```\n\n## 2 - use it in your python code\n\n- in some comfyui custom nodes project or module\n\n- code in `__init__.py`\n\n```py\n# ucase 1.0:\n# from yors_comfyui_node_setup import entry,node_install_requirements # global\n\n# # install requirements\n# node_install_requirements(__file__)\n\n# # export comfyui node vars\n# __all__,NODE_CLASS_MAPPINGS,NODE_DISPLAY_NAME_MAPPINGS,NODE_MENU_NAMES = entry(__name__,__file__)\n\n# ucase 2.0:\nfrom yors_comfyui_node_setup import node_install_requirements,entry_pre_import,entry_import,get_all_classs_in_sys,register_node_list_local\n\n# install requirements automatically\n# if requrements.txt in here and deps in it not installed\nnode_install_requirements(__file__)\n\n# gen __all__ and import moudle with __all__\n# with this you can wirte your nodes in any py file in the same diretory\n__all__ = entry_pre_import(__name__,__file__)\nentry_import(__name__,__all__)\n\n# get class after importing moudle with __all__\nthis_module_all_classes = get_all_classs_in_sys(__name__)\n\n# register node with default category\n# it will not register the same node if you/he/she register the same nodes in other custom repo. (save disk space)\nNODE_CLASS_MAPPINGS,NODE_DISPLAY_NAME_MAPPINGS,NODE_MENU_NAMES = register_node_list_local(this_module_all_classes,False)\n\n# addtional register node with custom category (no test)\n# NODE_CLASS_MAPPINGS,NODE_DISPLAY_NAME_MAPPINGS,NODE_MENU_NAMES = register_node_list_local(this_module_all_classes,True,\"YMC/as_x_type\")\nprint(\"\\n\".join(NODE_MENU_NAMES))\n```\n\n## 3 - code yours nodes\n\n- dirs map of your node may be:\n\n```\n.\n\u2514\u2500__init__.py\n\u2514\u2500nodes.py\n```\n\n- in any py file (no test in `__init__.py`)\n- code nodes.py\n\n```py\n# 1. define yors comfyui nodes here\n# ...\n# ucase 1.0:\n# class AnyType(str):\n# \"\"\"A special class that is always equal in not equal comparisons. Credit to pythongosssss\"\"\"\n\n# def __ne__(self, __value: object) -> bool:\n# return False\n\n# any_type = AnyType(\"*\")\n\n\n# CURRENT_CATEGORY=\"YMC/LINK\" # set the right mouse button menu (custom for your comfyui nodes)\n# CURRENT_FUNCTION=\"exec\"\n\n# class NodeSetItAsImage:\n# @classmethod\n# def INPUT_TYPES(s):\n# return {\n# \"required\": {\n\n# },\n# \"optional\":{\n# \"a\": (any_type),\n# },\n# # \"hidden\": {\n# # \"unique_id\": \"UNIQUE_ID\",\n# # \"extra_pnginfo\": \"EXTRA_PNGINFO\",\n# # },\n# }\n\n# # INPUT_IS_LIST = True\n# RETURN_TYPES = (\"IMAGE\",)\n# RETURN_NAMES = (\"image\",)\n\n# FUNCTION = CURRENT_FUNCTION\n# CATEGORY = CURRENT_CATEGORY\n# # set NODE_NAME and NODE_DESC for yors_comfyui_node_setup\n# NODE_NAME = \"as image\"\n# NODE_DESC = \"set it as image type\"\n# # OUTPUT_NODE = True\n# # OUTPUT_IS_LIST = (True,)\n# def exec(self, a=None):\n# return (a,)\n\n\n# ucase 1.1:\nfrom yors_comfyui_node_as_x_type import * # import all yors comfyui nodes from it\n\n# ucase 1.2:\n# from yors_comfyui_node_as_x_type import NodeSetItAsImage # import some yors comfyui nodes from it\n\n\n# 2. reset yors comfyui nodes category (it will be used set rmb in yors_comfyui_node_setup)\n# from yors_comfyui_node_reset_rmb import reset_rmb\n# reset_rmb(__name__,\"YMC/as_x_type\") // danger!\n\n# 3. set nodes category alias\n# to set the right mouse menu as your likes.\n\n# set nodes defined in yors_comfyui_node_as_x_type under the category YMC/as_x_type\nimport yors_comfyui_node_as_x_type as base\nfrom yors_comfyui_node_setup import get_sys_module,set_node_class_category_alias\nthis_py_module = get_sys_module(__name__)\nset_node_class_category_alias(base,this_py_module,\"YMC/as_x_type\",True)\n\n```\n\n## the dirs of your comfyui nodes repo\n\n```\n.\n\u2502 .gitignore\n\u2502 LICENSE\n\u2502 nodes.py\n\u2502 requirements.txt\n\u2502 __init__.py\n\u2514\u2500link # some nodes to link nodes\n __init__.py\n xx.py\n ...\n\u2514\u2500utils # some nodes for util process\n __init__.py\n xx.py\n ...\n\u2514\u2500image # some nodes for image process\n __init__.py\n xx.py\n ...\n```\n\n## Author\n\nymc-github <ymc.github@gmail.com>\n\n## License\n\nMIT\n",
"bugtrack_url": null,
"license": "LICENSE",
"summary": "A python library for setup comfyui custom nodes for developers in development",
"version": "0.7.0",
"project_urls": {
"Documentation": "https://github.com/ymc-github/panz/blob/main/packages/yors_comfyui_node_setup/README.md",
"Homepage": "https://github.com/ymc-github/panz/blob/main/packages/yors_comfyui_node_setup/README.md",
"Repository": "https://github.com/ymc-github/panz.git",
"changelog": "https://github.com/ymc-github/panz/blob/main/packages/yors_comfyui_node_setup/CHANGELOG.md"
},
"split_keywords": [
"artist",
" panz",
" mono",
" yors_comfyui_node_setup"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "785d959b37a0274fa77b7ef91f0f9a5ad6e96c50cceb312824ea1551caec55b0",
"md5": "52148e21fd41320be12e956fac577f05",
"sha256": "656defa23f9864a80d705961ddc57a770c4a761b62e4eaaeff6b948067d6297c"
},
"downloads": -1,
"filename": "yors_comfyui_node_setup-0.7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "52148e21fd41320be12e956fac577f05",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 7993,
"upload_time": "2024-07-14T13:04:52",
"upload_time_iso_8601": "2024-07-14T13:04:52.639980Z",
"url": "https://files.pythonhosted.org/packages/78/5d/959b37a0274fa77b7ef91f0f9a5ad6e96c50cceb312824ea1551caec55b0/yors_comfyui_node_setup-0.7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fd975d45bbb42a09e2bd3d5fa8d0d53d65154ad280cbdbedfc6c0f632424f726",
"md5": "ed022ec547fe86cb3d6455e3b585d94e",
"sha256": "e29b68266960b289c1bdad915eccdc5ec713133eddb08891af0aa671aa590bec"
},
"downloads": -1,
"filename": "yors_comfyui_node_setup-0.7.0.tar.gz",
"has_sig": false,
"md5_digest": "ed022ec547fe86cb3d6455e3b585d94e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 7432,
"upload_time": "2024-07-14T13:04:54",
"upload_time_iso_8601": "2024-07-14T13:04:54.588040Z",
"url": "https://files.pythonhosted.org/packages/fd/97/5d45bbb42a09e2bd3d5fa8d0d53d65154ad280cbdbedfc6c0f632424f726/yors_comfyui_node_setup-0.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-14 13:04:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ymc-github",
"github_project": "panz",
"github_not_found": true,
"lcname": "yors_comfyui_node_setup"
}