stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

Safe user modification of webui-user* scripts

Open anoldguy opened this issue 2 years ago • 3 comments

Let folks modify webui-user* without getting overwritten by a git pull.

Currently, modifications to webui-user.sh or webui-user.bat will be overwritten during a later git pull.

This PR moves the current webui-user* scripts to webui-user*.example and directs the user via the README.md to copy the new file over to webui-user.*, which are now ignored by git.

This will let future git pulls to execute without overwriting the user's overrides.

anoldguy avatar Oct 16 '22 15:10 anoldguy

I put my user scripts out of the project folder to avoid this problem, it looks like:

@echo off

E:
cd E:\path\to\the\stable-diffusion-webui

wt.exe venv\Scripts\python.exe webui.py --listen --share
:: I called the `webui.py` directly since I'm sure all dependences were already installed.

But the same problem still exist for javascript/python scripts under javascript and scripts folder, and I make that PR for it.

zhengxiaoyao0716 avatar Oct 16 '22 16:10 zhengxiaoyao0716

It's not like these aren't important and the site of vital changes, not having them tracked, and having an extra step to get running seems counterproductive on multiple levels.

WHY are they being edited is the question, can we look at putting the places of change in as untracked dependencies, for example: creating an empty 'user_args.bat/user_args.sh' file on first run and instructing users to add their custom set COMMANDLINE_ARGS=xxxx in there so it's safe from git pull and running that as part of the standard init scripts if present?

dfaker avatar Oct 16 '22 18:10 dfaker

It's not like these aren't important and the site of vital changes, not having them tracked, and having an extra step to get running seems counterproductive on multiple levels.

Given how webui-user.sh is essentially a template that doesn't actively do anything other than setting an empty COMMANDLINE_ARGS variable, and is guarded against not existing in webui.sh, how are they the site of vital changes? If I remove the files, webui.sh executes as expected. It looks like webui-user.bat is similar, in that you can execute webui.bat without changes and everything still works.

WHY are they being edited is the question, can we look at putting the places of change in as untracked dependencies, for example: creating an empty 'user_args.bat/user_args.sh' file on first run and instructing users to add their custom set COMMANDLINE_ARGS=xxxx in there so it's safe from git pull and running that as part of the standard init scripts if present?

This PR essentially does that. Moves the webui-user.sh|bat scripts into that 'untracked dependency' role. From what I've seen in the code, there are already guards that handle if the customize files aren't present for webui.sh.

I will confess to being less current on my bat scripting, as it looks like there are guards in place for the PYTHON and VENV_DIR variables, but not for GIT or COMMANDLINE_ARGS, but digging deeper, there are guards in place in launch.py for both of them.

Thank you very much for taking the time to review this, and I look forward to continuing the discussion around this so we can get the idea of 'user modifications don't break on git pulls' into code.

I'm happy to rename any of the proposed filename changes to something that better fits what you all have in mind.

anoldguy avatar Oct 17 '22 13:10 anoldguy