How to embed Python for sidecar #2759
-
I have a command-line based Python app. It uses some PyPI packages. I'd like to make a Tauri app which will call this Python app to do some operations and calculations. I read the documentation on the Sidecar feature of Tauri. I am still not sure how to use this. I am thinking about embedding the whole Python interpreter and packages somehow. Which folder in the Tauri project should I place the Python interpreter? What would be the best practice to embed a Python app inside a Tauri app? Would it work if I create a conda environment and install packages and my Python app in the conda environment, and then copy the entire conda environment folder to a subfolder of my Tauri project? I'd appreciate any help. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 15 replies
-
The most straight forward way is probably the same as for nodejs apps (using pkg). So you'd sidecar a packaged python app created with pyinstaller or something. Or, if you're absolutely crazy and proficient in rust there's also this one: https://github.com/RustPython/RustPython. But i don't know how easy it would be to use it for a whole py project with dependencies (if it's even possible). |
Beta Was this translation helpful? Give feedback.
-
I created an Example Repo: https://github.com/cherob/tauri-rust-py |
Beta Was this translation helpful? Give feedback.
-
I did a little experiment that involved creating a client-side Flask server for various distributable WebView solutions (electron, tauri, FlaskWebGui). You can see an overview on the main branch and an example of the python sidecar on the tauri branch. |
Beta Was this translation helpful? Give feedback.
-
i find a example for java Java sidecar for a Tauri + Angular app |
Beta Was this translation helpful? Give feedback.
The most straight forward way is probably the same as for nodejs apps (using pkg). So you'd sidecar a packaged python app created with pyinstaller or something.
Or, if you're absolutely crazy and proficient in rust there's also this one: https://github.com/RustPython/RustPython. But i don't know how easy it would be to use it for a whole py project with dependencies (if it's even possible).