Update INX to run the extension inside a uv venv if one is detected#4447
Update INX to run the extension inside a uv venv if one is detected#4447george-steel wants to merge 3 commits into
Conversation
|
Are UV venv's different from standard python venvs? This could be made more generic if that's the case (not that I would block merging it based on that) |
I don't know enough about python's venv to implement a generic version (each tool uses a different configuration and a different way to enter the venv), but uv venvs are the only type currently created by the Makefile. |
| env.globals["icon_path"] = '../icons/' | ||
| else: | ||
| # user is running inkstitch.py directly as a developer | ||
| # user is running inkstitch.py directly as a developer with dependencies installed systemwide |
There was a problem hiding this comment.
Haven't tested anything yet, but this comment isn't true.
At this point it only means, that no uv is used. There are other options than system wide.
There was a problem hiding this comment.
I was assuming that this script was being run through the Makefile, which only uses uv or systemwide at the moment when run from a normal shell. If other options are added there, they will have to be added here. I have attempted to clarify this here and added a corresponding comment in the Makefile.
There was a problem hiding this comment.
Nope, other python environments don't need the code to change. You just handle which python they use and run the normal python command.
There was a problem hiding this comment.
It is the script launched by the INX file that is responsible for locating (non-trivial as each python dependency manager stores venvs in a different place) and entering a venv. interpreter="python" assumes all dependencies are installed either system-wide or user-wide. If there are not found, the extension will crash instead of launching. If you have have previously installed system-wide dependencies, what would prevent the crash that otherwise happens on a fresh installation.
There was a problem hiding this comment.
Well, all I really asked was to make this comment a bit simpler, because at this point it actually doesn't mean that dependencies are installed system wide.
#4428 changed where dependencies get installed by creating a venv if uv is available
(allowing installation on distros with locked python packages),
which broke local development as launching from the INX still looks in the old location.
To fix this,
make inxnow detects if it is being run in a uv venv, and if so,launches the extension through
inkstitch_uv.sh|bat,which uses the venv instead of the systemwide python environment.
Operation without uv is unchanged.
Inspired by #3791.