-
Notifications
You must be signed in to change notification settings - Fork 27.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implementing script metadata and DAG sorting mechanism #13944
Conversation
I use this condition because afaik scripts will step on each other anyway if names collide (or this has been fixed already? I dunno). If this is not fixed I'd rather make the error explicit. Or I can add some scope here. |
Tl;DR is that duplicate name will prevent a later scripts from importing the correct script currently if there is a duplicate script file every one of those files will be executed (so far no problem) the problem comes when a script tries to "import" a file that has duplicate names from another file example: as I have 2 ext
execute:
but if later script does not import the script with duplicate name then all is fine
execute:
|
just realized that we already have a good candidate to be used as the unique identifier name for an extension |
But it is not possible to match a canonical name between an already installed extension and this file. |
the extension install directly cannot be used as a means of identification even though by default an extension is installed using the repo name I've mentioned in past I wish to make the install directory unique possibly by adding a Owner sufix, but the idea hasn't coming to fruition because some extension uses bad method of importing libraries form other extension currently I do not believe there is a definitive method of identifying an extension and it also doesn't really matter that pre-existing extension cannot be identified eventually extension will be updated with the metadata, so it shouldn't be an issue after a while
after the load order system is fully setup extension will start updateing and providing the metadata I still prefer json over ini you mentioned fearing that people might json file, the user should not edit this file this file should be only edited by the developer in my opinion json is more versatile as it supports different data types |
Do we have any users with 3.8 (probably some google colab-like services)? The syntax for requirements as it's written seems to make it impossible to use spaces in names. I would prefer a more simple name for the metadata file, like Is it possible to just move files that have dep requirement in the order of loaded scripts to their correct location, without putting them all at the end? Also I'd rather emit warnings and still attempt to load extensions with missing dependencies rather than forbid it outright. |
|
I would argue against using a common filename like
I also don't prefer ini, even it's support handles the data types we need, ini it's not really convenient to have structures
I agree on this point I'm not sure maybe this already works but just not specify |
|
nice |
(Some of the design actually comes from systemd.service and that's the main reason I choose ini.) |
I would argue against using a common filename like example of how it might look using json
{
"extension": {
"name": "adetailer",
"requires": ["sd-webui-controlnet", "sd-webui-animatediff"]
},
"scripts": {
"requires": ["sd-webui-controlnet", "sd-webui-animatediff"],
"before": ["sd-webui-controlnet"]
},
"scripts/!adetailer.py": {
"requires": ["sd-webui-controlnet", "sd-webui-animatediff"],
"before": ["sd-webui-controlnet"],
"after": ["sd-webui-animatediff/animatediff.py"]
},
"javascript": {
"after": ["ui.js"]
},
"javascript/canvas.js": {
"after": "localization.js"
}
}
{
"name": "adetailer",
"requires": ["sd-webui-controlnet", "sd-webui-animatediff"],
"scripts": {
"!adetailer.py" : {
"requires": ["sd-webui-controlnet", "sd-webui-animatediff"],
"before": ["sd-webui-controlnet"],
"after": ["sd-webui-animatediff/animatediff.py"]
}
},
"javascript": {
"canvas.js": {
"after": "localization.js" <---when there's only one then list [] is not required
}
}
} |
I changed a lot in implementation to use classes with named fields instead of dictionaries, use a custom sorter that doesn't change the order as much and ignores cyclic reference errors (which I see as a preferable solution: if one extension adds some messed up order, that shouldn't break nice ordering of all other extensions), and eliminated some duplicate code. |
Description
NOTE: This PR directly conflicts with #13943
BREAKING:
graphlib
is a Python 3.9 thing. It may breaks on Python 3.8.Requires
another extension or a file of the same type. The extension/script will be disabled if the requirement does not meet.After
another extension or a single file of the same type.Before
another extension or a single file of the same type.When specifying individual script's
Requires
,Before
andAfter
, use either:<extension_canonical_name>/<script_file_name>
(note the directory name is not included)I have not tested this yet. Will do it later.This system is built upon the implication that script files has unique name. Please let me know if this is not the case.Example
sd_webui_metadata.ini
metadata.ini
:Checklist: