Skip to content

Commit 9468f72

Browse files
authored
Update README.md
1 parent a8e6730 commit 9468f72

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Tauri Plugin Python
22

33
This [tauri](https://v2.tauri.app/) plugin is supposed to make it easy to use Python as backend code.
4-
It uses [RustPython](https://github.com/RustPython/RustPython) as interpreter to call python from rust.
4+
It uses [RustPython](https://github.com/RustPython/RustPython) or alternatively [PyO3](https://pyo3.rs) as interpreter to call python from rust.
5+
56
RustPython doesn't require python to be installed on the target platform and makes it
67
therefore easy to deploy your production binary. Unfortunately, it has some
7-
compatibility issues and is slower than PyO3/CPython. [PyO3](https://pyo3.rs) is also supported as optional Cargo feature for desktop applications.
8-
PyO3 uses CPython as interpreter and therefore has a much better compatibility for python libraries.
8+
compatibility issues and is slower than PyO3/CPython. PyO3 is also supported as optional Cargo feature for desktop applications.
9+
PyO3 uses CPython as interpreter and therefore has a wide compatibility for available python libraries.
910
It isn't used as default as it requires to make libpython available for the target platform,
1011
which can be complicated, especially for mobile targets.
1112

@@ -41,6 +42,14 @@ is not available for rust yet.
4142
In case that you want to ship production software packages, you need
4243
to make sure to also ship all your python code. If you use PyO3, you also need to ship libpython too.
4344

45+
### Switch from RustPython to PyO3
46+
47+
```toml
48+
# src-tauri/Cargo.toml
49+
tauri-plugin-python = { version="0.3", , features = ["pyo3"] }
50+
51+
```
52+
4453
## Example app
4554

4655
There is a sample Desktop application for Windows/Linux/MacOS using this plugin and vanilla
@@ -109,9 +118,10 @@ The included resources can be configurable in the `tauri.conf.json` file.
109118
Check the tauri and PyO3 documentation for additional info.
110119

111120
## Security considerations
112-
Generally, this plugin has been created by "security by default" concept. Python functions can only be called if registered from rust during plugin initialization.
121+
By default, this plugin cannot call arbitrary python code. Python functions can only be called if registered from rust during plugin initialization.
122+
It may still be possible to read values from python. This can be prevented via additional tauri permissions.
113123

114-
Keep in mind that this plugin could make it possible to run arbitrary python code.
124+
Keep in mind that this plugin could make it possible to run arbitrary python code when using all allow permissions.
115125
It is therefore highly recommended to **make sure the user interface is not accessible by a network URL** in production.
116126

117127
The "runPython" command is disabled by default via permissions. If enabled, it is possible to

0 commit comments

Comments
 (0)