Skip to content

Update INX to run the extension inside a uv venv if one is detected#4447

Open
george-steel wants to merge 3 commits into
mainfrom
george-steel/fix-uv-inx
Open

Update INX to run the extension inside a uv venv if one is detected#4447
george-steel wants to merge 3 commits into
mainfrom
george-steel/fix-uv-inx

Conversation

@george-steel

@george-steel george-steel commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

#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 inx now 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.

@capellancitizen

Copy link
Copy Markdown
Collaborator

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)

@george-steel

Copy link
Copy Markdown
Collaborator Author

Are UV venv's different from standard python venvs?

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.

Comment thread lib/inx/utils.py Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, other python environments don't need the code to change. You just handle which python they use and run the normal python command.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

3 participants