Skip to content

Commit 7e2aad5

Browse files
committed
Upgrade to pytauri 0.5.0, fix template names
1 parent 51fa0fd commit 7e2aad5

File tree

6 files changed

+20
-18
lines changed

6 files changed

+20
-18
lines changed

templates/{% if ui_template == 'Vue' %}.{% endif %}/{{ project_name }}/package.json.jinja

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"dependencies": {
1313
"vue": "^3.5.13",
1414
"@tauri-apps/api": "^2",
15-
"@tauri-apps/plugin-opener": "^2"
15+
"@tauri-apps/plugin-opener": "^2",
16+
"tauri-plugin-pytauri-api": "^0.5.0"
1617
},
1718
"devDependencies": {
1819
"@vitejs/plugin-vue": "^5.2.1",

templates/{% if ui_template == 'Vue' %}.{% endif %}/{{ project_name }}/src/App.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@ interface Greeting {
77
message: string;
88
}
99
10+
const name = ref("")
11+
const greetMsg = ref("")
12+
1013
async function greet() {
11-
if (greetMsgEl && greetInputEl) {
1214
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
1315
const rsGreeting = await invoke<string>("greet", {
14-
name: greetInputEl.value,
16+
name: name.value,
1517
});
1618
const pyGreeting = await pyInvoke<Greeting>("greet", {
17-
name: greetInputEl.value,
19+
name: name.value,
1820
});
19-
greetMsgEl.textContent = rsGreeting + "\n" + pyGreeting.message;
20-
}
21+
greetMsg.value = rsGreeting + "\n" + pyGreeting.message;
2122
}
2223
</script>
2324

templates/{{ '.' }}/{{ project_name }}/src-tauri/Cargo.toml.jinja

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "{{project_name}}"
2+
name = "{{ project_name }}"
33
version = "0.1.0"
44
description = "A Tauri App"
55
authors = ["you"]
@@ -11,12 +11,12 @@ edition = "2021"
1111
# The `_lib` suffix may seem redundant but it is necessary
1212
# to make the lib name unique and wouldn't conflict with the bin name.
1313
# This seems to be only an issue on Windows, see https://github.com/rust-lang/cargo/issues/8519
14-
name = "tauri_app_lib"
14+
name = "{{ package_name }}_lib"
1515
crate-type = ["staticlib", "cdylib", "rlib"]
1616

1717
[[bin]]
1818
# the same as the package name
19-
name = "{{project_name}}"
19+
name = "{{ project_name }}"
2020
path = "src/main.rs"
2121
required-features = ["pytauri/standalone"]
2222

@@ -28,6 +28,6 @@ tauri = { version = "2", features = [] }
2828
tauri-plugin-opener = "2"
2929
serde = { version = "1", features = ["derive"] }
3030
serde_json = "1"
31-
pyo3 = { version = "0.23" }
32-
pytauri = { version = "0.4" }
33-
tauri-plugin-pytauri = { version = "0.4" }
31+
pyo3 = { version = "0.24" }
32+
pytauri = { version = "0.5" }
33+
tauri-plugin-pytauri = { version = "0.5" }

templates/{{ '.' }}/{{ project_name }}/src-tauri/src-python/pyproject.toml.jinja

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[project]
2-
name = "{{project_name}}"
2+
name = "{{ project_name }}"
33
version = "0.1.0"
44
description = "Add your description here"
55
readme = "README.md"
@@ -8,13 +8,13 @@ authors = [
88
]
99
requires-python = ">=3.12"
1010
dependencies = [
11-
"pytauri == 0.4.*",
11+
"pytauri == 0.5.*",
1212
"pydantic == 2.*",
1313
"anyio == 4.*"
1414
]
1515

1616
[project.entry-points.pytauri]
17-
ext_mod = "{{project_name}}.ext_mod"
17+
ext_mod = "{{ package_name }}.ext_mod"
1818

1919
[build-system]
2020
requires = ["hatchling"]

templates/{{ '.' }}/{{ project_name }}/src-tauri/src-python/src/{{ package_name }}/__main__.py.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from multiprocessing import freeze_support
44

5-
from {{project_name}} import main
5+
from {{ package_name }} import main
66

77
# - If you don't use `multiprocessing`, you can remove this line.
88
# - If you do use `multiprocessing` but without this line,

templates/{{ '.' }}/{{ project_name }}/src-tauri/src/main.rs.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use pytauri::standalone::{
99
};
1010
use tauri::{Builder, Manager as _};
1111

12-
use {{project_name}}_lib::{ext_mod, tauri_generate_context};
12+
use {{ package_name }}_lib::{ext_mod, tauri_generate_context};
1313

1414
fn main() -> Result<Infallible, Box<dyn Error>> {
1515
let py_env = if cfg!(dev) {
@@ -45,7 +45,7 @@ fn main() -> Result<Infallible, Box<dyn Error>> {
4545

4646
// 👉 Equivalent to `python -m tauri_app`,
4747
// i.e, run the `src-tauri/python/tauri_app/__main__.py`
48-
let py_script = PythonScript::Module("{{project_name}}".into());
48+
let py_script = PythonScript::Module("{{ package_name }}".into());
4949

5050
// 👉 `ext_mod` is your extension module, we export it from memory,
5151
// so you don't need to compile it into a binary file (.pyd/.so).

0 commit comments

Comments
 (0)