Skip to content

Commit 4dd65c2

Browse files
committed
fix(build): update python package definition
1 parent a8ba356 commit 4dd65c2

File tree

23 files changed

+489
-101
lines changed

23 files changed

+489
-101
lines changed

.commitlintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ["@commitlint/config-conventional"],
3+
};

.flake8

Lines changed: 0 additions & 11 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
repos:
2-
- repo: https://github.com/psf/black
3-
rev: 24.3.0
4-
hooks:
5-
- id: black
6-
entry: black --check
7-
82
- repo: https://github.com/codespell-project/codespell
9-
rev: v2.1.0
3+
rev: v2.3.0
104
hooks:
115
- id: codespell
126

13-
- repo: https://github.com/PyCQA/flake8
14-
rev: 4.0.1
7+
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
8+
rev: v9.20.0
9+
hooks:
10+
- id: commitlint
11+
stages: [commit-msg]
12+
additional_dependencies: ["@commitlint/config-conventional"]
13+
14+
- repo: https://github.com/astral-sh/ruff-pre-commit
15+
rev: "v0.13.0"
1516
hooks:
16-
- id: flake8
17+
- id: ruff
18+
args: ["--fix", "--show-fixes"]
19+
- id: ruff-format

examples/03_tauri_ws_menu_dialogs/cone.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,14 @@ def _build_ui(self):
121121
)
122122
vuetify.VTextarea(
123123
v_model=("logs", ""),
124-
style="position: absolute; z-index: 1; bottom: 10px; left: 10px; width: 50vw; background: #fff;",
124+
style=(
125+
"position: absolute;"
126+
"z-index: 1;"
127+
"bottom: 10px;"
128+
"left: 10px;"
129+
"width: 50vw;"
130+
"background: #fff;"
131+
),
125132
)
126133

127134
with layout.toolbar:

examples/04_http_ws_multi_windows/server.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ def build_ui_main(self):
3333
appWindow.onMoved(async ({ payload }) => {
3434
const size = await appWindow.outerSize();
3535
hello_window = trame.utils.tauri.window.WebviewWindow.getByLabel('hello_world');
36-
await hello_window.setPosition(new LogicalPosition((payload.x + size.width) / scaleFactor, payload.y / scaleFactor));
36+
await hello_window.setPosition(
37+
new LogicalPosition(
38+
(payload.x + size.width) / scaleFactor, payload.y / scaleFactor
39+
)
40+
);
3741
});
3842
3943
const hello_world = new trame.utils.tauri.window.WebviewWindow('hello_world', {

examples/04_http_ws_multi_windows/server2.py

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -111,42 +111,46 @@ def build_ui_main(self):
111111
html.Div("p({{ position }}) - s({{ size }}) - d({{ scale }})")
112112
v3.VDivider(style="margin: 8px;")
113113
with html.Div(v_if=("window_hello_world", False)):
114-
with tauri.Window(
115-
url="http://localhost:4444/index.html?ui=hello_world",
116-
visible=("window_hello_world", False),
117-
title=("child_title", "Hello"),
118-
x=("pos_x", 100),
119-
y=("pos_y", 100),
120-
width=("size_w", 300),
121-
height=("size_h", 300),
122-
options=(
123-
"child_options",
124-
{
125-
# "alwaysOnTop": True,
126-
# "center": True,
127-
# "closable": False,
128-
# "decorations": False,
129-
"focus": False, # Does not work
130-
"minHeight": 200,
131-
"minWidth": 200,
132-
"maxHeight": 800,
133-
"maxWidth": 800,
134-
# "maximizable": False, # You need `"decoration": True` to see this (button will be disabled)
135-
# "minimizable": False, # You need `"decoration": True` to see this (button will be disabled)
136-
# "skipTaskbar": True, # Does not work
137-
"theme": "light",
138-
"fileDropEnabled": False,
139-
},
140-
),
141-
prevent_close=True, # Will not work using Tauri v1: https://github.com/tauri-apps/tauri/issues/8435
142-
moved="position = $event",
143-
resized="size = $event",
144-
scale_changed="scale = $event",
145-
created="{ position, size, scaleFactor: scale } = $event",
146-
closed="window_hello_world = false; window.console.log('evt closed')",
147-
file_drop="window.console.log('file:', $event)",
148-
theme_changed="window.console.log('theme:', $event)",
149-
) as w:
114+
with (
115+
tauri.Window(
116+
url="http://localhost:4444/index.html?ui=hello_world",
117+
visible=("window_hello_world", False),
118+
title=("child_title", "Hello"),
119+
x=("pos_x", 100),
120+
y=("pos_y", 100),
121+
width=("size_w", 300),
122+
height=("size_h", 300),
123+
options=(
124+
"child_options",
125+
{
126+
# "alwaysOnTop": True,
127+
# "center": True,
128+
# "closable": False,
129+
# "decorations": False,
130+
"focus": False, # Does not work
131+
"minHeight": 200,
132+
"minWidth": 200,
133+
"maxHeight": 800,
134+
"maxWidth": 800,
135+
# You need `"decoration": True` to see this (button will be disabled)
136+
# "maximizable": False,
137+
# "minimizable": False,
138+
# Does not work
139+
# "skipTaskbar": True,
140+
"theme": "light",
141+
"fileDropEnabled": False,
142+
},
143+
),
144+
prevent_close=True, # Will not work using Tauri v1: https://github.com/tauri-apps/tauri/issues/8435
145+
moved="position = $event",
146+
resized="size = $event",
147+
scale_changed="scale = $event",
148+
created="{ position, size, scaleFactor: scale } = $event",
149+
closed="window_hello_world = false; window.console.log('evt closed')",
150+
file_drop="window.console.log('file:', $event)",
151+
theme_changed="window.console.log('theme:', $event)",
152+
) as w
153+
):
150154
self.server.controller.trigger_name(w.request_user_attention)
151155
with v3.Template(raw_attrs=['v-slot="data"']):
152156
v3.VTextField(v_model="child_title")

pyproject.toml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
[project]
2+
name = "trame-tauri"
3+
version = "1.0.1"
4+
description = "Helper widget to provide simpler integration with Tauri"
5+
authors = [
6+
{name = "Kitware Inc."},
7+
]
8+
dependencies = [
9+
"trame-client",
10+
]
11+
requires-python = ">=3.9"
12+
readme = "README.rst"
13+
license = {text = "Apache Software License"}
14+
keywords = ["Python", "Interactive", "Web", "Application", "Framework"]
15+
classifiers = [
16+
"Development Status :: 5 - Production/Stable",
17+
"Environment :: Web Environment",
18+
"License :: OSI Approved :: Apache Software License",
19+
"Natural Language :: English",
20+
"Operating System :: OS Independent",
21+
"Programming Language :: Python :: 3 :: Only",
22+
"Topic :: Software Development :: Libraries :: Application Frameworks",
23+
"Topic :: Software Development :: Libraries :: Python Modules",
24+
]
25+
26+
[project.optional-dependencies]
27+
dev = [
28+
"pre-commit",
29+
"ruff",
30+
"pytest",
31+
]
32+
33+
[build-system]
34+
requires = ["hatchling"]
35+
build-backend = "hatchling.build"
36+
37+
[tool.hatch.build]
38+
include = [
39+
"src/trame_tauri/module/serve/**",
40+
"src/**/*.py",
41+
]
42+
43+
[tool.hatch.build.targets.wheel]
44+
packages = [
45+
"src/trame_tauri",
46+
"src/trame",
47+
]
48+
49+
[tool.semantic_release]
50+
version_toml = ["pyproject.toml:project.version"]
51+
version_variables = ["src/trame_tauri/__init__.py:__version__"]
52+
build_command = "pip install uv && uv build"
53+
54+
[tool.ruff]
55+
line-length = 88
56+
indent-width = 4
57+
target-version = "py39"
58+
59+
[tool.ruff.lint]
60+
select = ["E", "W", "F"]
61+
ignore = []
62+
fixable = ["ALL"]
63+
unfixable = []
64+
65+
66+
[tool.ruff.format]
67+
quote-style = "double"
68+
indent-style = "space"
69+
skip-magic-trailing-comma = false
70+
line-ending = "auto"
71+
docstring-code-format = true
72+
73+
# This only has an effect when the `docstring-code-format` setting is
74+
# enabled.
75+
docstring-code-line-length = "dynamic"
76+
77+
[tool.ruff.lint.pycodestyle]
78+
max-line-length = 120
79+
80+
[lint.pydocstyle]
81+
convention = "google"

setup.cfg

Lines changed: 0 additions & 33 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 3 deletions
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)