Skip to content

Use relative path for custom/extra node module name#3944

Merged
comfyanonymous merged 2 commits intoComfy-Org:masterfrom
huchenlei:module_name_rework
Jul 5, 2024
Merged

Use relative path for custom/extra node module name#3944
comfyanonymous merged 2 commits intoComfy-Org:masterfrom
huchenlei:module_name_rework

Conversation

@huchenlei
Copy link
Contributor

Related PR: #3943

Previously the module name of imported custom node is set as filename / directoryname, which can cause potential name conflict.

Imagine you have both comfy_extras/audio_nodes.py and custom_nodes/audio_nodes/. They both resolve to the same module name audio_nodes which can cause issue.

This PR makes module name relative path to the ComfyUI root folder so that this situation does not happen.

I can add some unit tests if the unit test infrastructure setup in #3897 is merged.

@huchenlei huchenlei requested a review from comfyanonymous as a code owner July 4, 2024 14:43
@huchenlei huchenlei changed the title Use relative path for module name Use relative path for custom/extra node module name Jul 4, 2024
@comfyanonymous comfyanonymous merged commit 0e3dfd9 into Comfy-Org:master Jul 5, 2024
@comfyanonymous
Copy link
Member

Had to revert this because it broke some imports like:

import comfy_extras.nodes_model_merging

@huchenlei
Copy link
Contributor Author

Had to revert this because it broke some imports like:

import comfy_extras.nodes_model_merging

Issue confirmed.

@huchenlei huchenlei deleted the module_name_rework branch July 5, 2024 13:46
@huchenlei
Copy link
Contributor Author

Tested #3943 is good. Can you merge that one instead?

csokun pushed a commit to csokun/ComfyUI that referenced this pull request Jul 10, 2024
* Fix module name for comfy extra nodes

* Use module name relative to root dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants