Skip to content

Feature request: Allow custom_nodes directory to be modified through a passed in cli arg. #10646

@Sasbom

Description

@Sasbom

Feature Idea

It would be greatly beneficial to have an option to set the custom_nodes directory to a custom location.

I propose to add both a flag and an environment variable for this, following the conventions set by other path override options.

These could look like COMFYUI_CUSTOM_NODES_DIR for an environment variable, and *We could use *--custom-nodes-directory as an argument provided at launch time.

This would benefit people seeking to integrate ComfyUI into larger workflows, where control over a "plugin" environment is a big benefit, as it allows ComfyUI to be launched in different contexts for different projects, for example.

The reason why I am asking for a client argument and environment both is for development reasons. This means that people working on plugins that are running in production, could switch to a staging directory.

I'll link a PR implementing the minimal amount of changes nessecary to this issue.

Thanks for your consideration!

EDIT: It's come to my attention that environment variable based settings are undesirable. It's not a disaster if it's not there. I will adjust the PR to not use the env.

Reference for this adjustment:
#10649

Existing Solutions

There are no existing solutions for exactly this, but the way ComfyUI is set up easily allows for this feature to be integrated in a non-disruptive way.

There is existing architecture in main.apply_custom_paths and the cli_args module to effectively be able to resolve different folders to a different location. The CustomNodeManager can then resolve everything else from there, so there should not be any problems implementing this.

Other

This small quality of life feature would mean that ComfyUI could see more adoption by people working in managed pipeline environments.

Often, project pipeline management solutions work through setting the environment of a managed process.
Allowing for an environment variable would mean that different launch profiles of arguments could be created, with the modified custom_nodes directory still being in the same place.

The entirety of ComfyUI would not have to be present in a shared space for people to use it, leading to less issues when network speed for a shared drive is a consideration. A deployment solution could deploy the bulk of ComfyUI to a local machine. With this update, different custom_nodes configurations would not nessecitate a completely new "copy" of ComfyUI.

EDIT: removing the environment variable is a bit inconvenient for use but this isn't a dealbreaker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureA new feature to add to ComfyUI.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions