MeVisLab / pythonqt

Dynamic Python binding for Qt Applications
https://mevislab.github.io/pythonqt/
GNU Lesser General Public License v2.1
243 stars 88 forks source link

[wish] Recipe(s) or native integrations of "uv" (possibly via CXX-Qt) #231

Closed twardoch closed 3 weeks ago

twardoch commented 3 weeks ago

Recently, two new solutions have been developed around Rust:

Embedding Python into a Qt C++ app with PythonQt works very well, and a company I work for has been using it for several years. But dealing with external Python packages, and just packaging of CPython etc. into a Qt app, has not been fully trivial.

I wonder if it would be possible for the PythonQt devs / maintainers / power-users to at least try to create a recipe on how to integrate the above libraries (for Qt5 & Qt6) so that PythonQt would be even more seamless. Ideally, "uv" could be integrated as a Rust library (not CLI tool) and CXX-Qt could be used to create an easy way to "talk to" the uv lib. Then, a documented method could be created at least for the "uv pip" functionality, that would allow easy programmatic installation of PyPI packages into a "PythonQt environment".

twardoch commented 3 weeks ago

I’ve added an issue on the uv repo that asks about how this might be done: https://github.com/astral-sh/uv/issues/6080

Not sure if we’ll get responses, though.

twardoch commented 3 weeks ago

With "uv python" and "uv venv --python", the uv package even allows simple bootstrapping of an entire Python environment. It'd be great if PythonQt speced (documented) how to structure the Python environment within a Qt app that uses PythonQt.

twardoch commented 3 weeks ago

As a result from https://github.com/astral-sh/uv/issues/6080 it seems that at this point, it’s better to use uv via subprocess CLI call. So I don’t think there’s anything for PythonQt to do.