top | item 45512962

Tauri binding for Python through Pyo3

168 points| 0x1997 | 5 months ago |github.com | reply

56 comments

order
[+] rthz|5 months ago|reply
Nice. It might be worth copying some of the introductory text from the Tauri package explaining what this does. Otherwise a person to lands on the readme gets a lot of technical detail about how it is built without any idea what it actually does.
[+] dlojudice|5 months ago|reply
Going further, what can I build using it? Basically, can I use Python on a Tauri project or can I use Tauri on a Python project?
[+] hamandcheese|5 months ago|reply
The first word in the README (other than the title) is a hyperlink to Tauri.
[+] zenlot|5 months ago|reply
Python, along with C++ enjoys the benefits of Qt. You can build great stuff with cross-platform Qt. And it won't be webview(Electron / Tauri) based.

What would be the benefits of this? I can't think of any yet.

[+] tracker1|5 months ago|reply
Web rendering has a rich ecosystem of tooling around a vast level of support for styling, layout, localization and accessibility support. By extension, it's one of the largest baselines in terms of knowledge, support and talent with at least some experience with.

This, of course, comes at a cost of performance as CSS alone is very complicated and has a lot there to support. On the flip side, there are many things that are easy to do with HTML+CSS that are much more difficult with native UI frameworks. Just the reflow support for multiple sizes/scaling in browsers is hard to match.

[+] WD-42|5 months ago|reply
I worked on a team the switched v2 of our product from Python + QT to Tauri specifically to get away from QT. If you have any kind of specific design requirements, QT is pain. The ability to use the frontend web stack is a huge win especially for a team that already has frontend developers.

Rust was a nice bonus.

[+] sabellito|5 months ago|reply
This benefits people and teams who prefer to build UIs with html/js/CSS.
[+] ErikBjare|5 months ago|reply
I've been building a Python+Qt+PyInstaller app for a decade (ActivityWatch) which we are migrating to Tauri for a wide range of reasons. Perhaps the largest one is easy cross-platform packaging/builds (which is a lot of work with PyInstaller)
[+] lunias|5 months ago|reply
The benefit is that you get to use a web-framework to write your UI... The trade-off is that the world gets another app that probably could have been a website.
[+] torginus|5 months ago|reply
Since Tauri is just a thin wrapper over the system webview, what's the point of having a wrapper over a wrapper?

I don't think the Python ecosystem was lacking in browser wrappers up till now.

[+] Ciantic|5 months ago|reply
"a thin wrapper over the system webview"

That is very complicated if you take into account also Linux, Windows, iOS, MacOS, Android support, and related utilities like tray icon, etc. There are other efforts, too, but they are also wrappers. Like this C/C++ implementation https://github.com/webview/webview that targets only desktop operating systems.

[+] rubenvanwyk|5 months ago|reply
I don't think the point is just about Python - this means you can use JS front-end with a Python backend for a local app.
[+] robertlagrant|5 months ago|reply
> Since Tauri is just a thin wrapper over the system webview

This isn't true. It's a thing wrapper over various things, including that.

Even if it were true - so what? There are probably 30 nested wrappers you could name even if you started at WebView as the outermost wrapper.

[+] yumraj|5 months ago|reply
Not to distract from Python or Tauri, but lately I’ve been using Wails[0] which is similar to Tauri but with Go instead of Rust.

There are pros/cons primarily being Tauri seems to allow creation of mobile apps which Wails doesn’t, but overall it’s been fantastic since I find Go to be an easier language for me.

[0] https://wails.io/

[+] 01HNNWZ0MV43FF|5 months ago|reply
Yep I've gotten basic Tauri stuff to run on Android.

It runs fine but, speaking as someone with no prior Android experience, once you need to leave the "Everything is in the view" model, it gets confusing. But that's more Android's fault than the framework's

[+] rubenvanwyk|5 months ago|reply
Interesting how much cross-pollination is happening in the Python ecosystem with Rust.

I think the NiceGUI example is good but quite advanced, might be beneficial to contact the teams from Reflex or FastHTML, because if you could use PyTauri to create potential local apps with those popular frameworks, it could be a big win for them and that can help with marketing around the project.

[+] wongarsu|5 months ago|reply
Rust and Python have very compatible ideas on a lot of topics. For example both think that a developer writing normal code should not have to worry about null pointers or be able to cause a use-after-free. It's just that Python achieves that with runtime costs and Rust with compile-time costs and a complex type system. So developers of one liking the other makes a lot of sense to me. And pyo3 is an extremely convinient way to call between the two languages
[+] est|5 months ago|reply
So why can't Python call system WebView directly? Is passing through layers of Rust really needed here?
[+] Retr0id|5 months ago|reply
Abstractions are rarely "necessary" in a strict sense but since Tauri already solves the problem of doing cross-platform webviews, why not reuse that work?
[+] GardenLetter27|5 months ago|reply
I don't understand why people like Tauri - the fact it uses the system web browser completely destroys the main advantage of Electron: that you can test it locally and be absolutely sure that it will render like that on any other system since the browser is shipped with it.
[+] Fraterkes|5 months ago|reply
For a lot of people the main advantage of electron was just being able to use the webdev stack for a desktop app. Tauri makes it less portable but is less bloated. Different tradeofs I guess.

Also: I think it’s kinda funny that Tauri is basically a very straightforward of example of trading developer comfort for benefit of the user, and you can’t imagine people using it.

[+] gkbrk|5 months ago|reply
> the main advantage of Electron: that you can test it locally and be absolutely sure that it will render like that on any other system

That's not the main advantage of Electron. The main advantage of Electron is being able to use web developers to build your desktop software cross-platform for much cheaper.

[+] mpalmer|5 months ago|reply
There's an entire separate copy of Chromium attached to every single goddam Electron app I install. It's completely insane. It's not at all worth the consistency you point out. Far too high a price.

The Tauri team is doing God's work. Electron was a fine enough idea, but I can't wait to see it improve or die. Imagine Electron supporting cross-compilation for mobile OSes. They won't close that particular gap with Tauri any time soon.

[+] iDon|5 months ago|reply
I have drafted a photo gallery app in Rust / Tauri, using a JavaScript framework in the frontend. The backend can read directories and files directly, and because the backend and frontend are in a single process, the backend simply passes a file handle (path string possibly) to the frontend. In contrast Electron has to send the image file between processes. I started with Electron and I think that was the point I shifted to Rust / Tauri; seeing the images display immediately was a revelation. Rust / Tauri has the advantages of a desktop app, and I have the option to use the frontend as a web app also.

This Python binding (pytauri) is interesting too - I have colleagues with Python functionality they want to surface on the web, and this would give the possibility of running as a desktop app also - good for large datasets.

[+] jonpalmisc|5 months ago|reply
The times of browsers having weirdly different rendering behavior are mostly gone, in my experience. I'm sure ~98% of Electron apps that expect Chromium would render just fine/same under WebKit as well.
[+] est|5 months ago|reply
because most Electron apps are not that complex. Just few forms with some buttons.
[+] pjmlp|5 months ago|reply
You mean the laziness of developers to write standard Web code and rather help Google in their plans to take over the Web?
[+] aitchnyu|5 months ago|reply
Do we have an open source Playwright for multiple mobile browsers?
[+] wolfgangbabad|5 months ago|reply
I agree. I don't mind VS Code or some app a person did eats 300 MB of RAM and is Electron if it does the job done. By the way good luck implement something like rtl, i18n, text select and right click context menus in you favorite C/Go/Rust/ImGui/ImmediateModeWhatever library.

Wanna switch between Arabic, Chinese, English in a textarea or input or the whole app? Trivial in Electron. Again, good luck with that in any other environment.

Electron is superior for any text/form apps. HTML/CSS/JS are truly magical if you dive deeper and for any form-like classical type of crud apps there is really no better option.

With our computers getting more RAM and disk space every few years - especially compared to AI needs, Electron is actually super lean compared to those AI llms models. Funny enough, LM Studio is an Electron app ;)

[+] alejoar|5 months ago|reply
What is Tauri?
[+] kdavis01|5 months ago|reply
A rust-based alternative to electron that leverages the system’s web view instead of a full copy of chromium.