tkwry 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tkwry-0.0.1/.github/workflows/ci.yml +115 -0
- tkwry-0.0.1/.github/workflows/release.yml +132 -0
- tkwry-0.0.1/.gitignore +33 -0
- tkwry-0.0.1/CHANGELOG.md +31 -0
- tkwry-0.0.1/Cargo.lock +2442 -0
- tkwry-0.0.1/Cargo.toml +45 -0
- tkwry-0.0.1/LICENSE +21 -0
- tkwry-0.0.1/NOTICE +11 -0
- tkwry-0.0.1/PKG-INFO +329 -0
- tkwry-0.0.1/README.md +292 -0
- tkwry-0.0.1/examples/dnd_demo.py +135 -0
- tkwry-0.0.1/examples/ipc_demo.py +218 -0
- tkwry-0.0.1/examples/multi_demo.py +304 -0
- tkwry-0.0.1/examples/plotly_demo.py +217 -0
- tkwry-0.0.1/examples/url_demo.py +50 -0
- tkwry-0.0.1/pyproject.toml +70 -0
- tkwry-0.0.1/src/lib.rs +629 -0
- tkwry-0.0.1/src/macos_focus.rs +192 -0
- tkwry-0.0.1/tests/conftest.py +66 -0
- tkwry-0.0.1/tests/helpers.py +35 -0
- tkwry-0.0.1/tests/macos_input_helpers.py +191 -0
- tkwry-0.0.1/tests/test_enums.py +19 -0
- tkwry-0.0.1/tests/test_import.py +71 -0
- tkwry-0.0.1/tests/test_macos_input.py +234 -0
- tkwry-0.0.1/tests/test_parent.py +48 -0
- tkwry-0.0.1/tests/test_url.py +44 -0
- tkwry-0.0.1/tests/test_webview_smoke.py +112 -0
- tkwry-0.0.1/tkwry/__init__.py +25 -0
- tkwry-0.0.1/tkwry/_parent.py +121 -0
- tkwry-0.0.1/tkwry/_runtime.py +54 -0
- tkwry-0.0.1/tkwry/_url.py +31 -0
- tkwry-0.0.1/tkwry/_version.py +30 -0
- tkwry-0.0.1/tkwry/py.typed +0 -0
- tkwry-0.0.1/tkwry/webview.py +734 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
lint:
|
|
14
|
+
name: Lint
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Install Linux system dependencies
|
|
20
|
+
run: |
|
|
21
|
+
sudo apt-get update
|
|
22
|
+
sudo apt-get install -y \
|
|
23
|
+
libwebkit2gtk-4.1-dev \
|
|
24
|
+
libgtk-3-dev \
|
|
25
|
+
libglib2.0-dev
|
|
26
|
+
|
|
27
|
+
- uses: actions/setup-python@v5
|
|
28
|
+
with:
|
|
29
|
+
python-version: "3.12"
|
|
30
|
+
|
|
31
|
+
- name: Install ruff
|
|
32
|
+
run: pip install "ruff>=0.9"
|
|
33
|
+
|
|
34
|
+
- name: Ruff
|
|
35
|
+
run: ruff check tkwry tests examples
|
|
36
|
+
|
|
37
|
+
- name: Rust toolchain
|
|
38
|
+
uses: dtolnay/rust-toolchain@stable
|
|
39
|
+
with:
|
|
40
|
+
components: rustfmt, clippy
|
|
41
|
+
|
|
42
|
+
- run: cargo fmt --check
|
|
43
|
+
|
|
44
|
+
- name: Clippy
|
|
45
|
+
env:
|
|
46
|
+
# setup-python points PKG_CONFIG_PATH at Python only; use system GTK.
|
|
47
|
+
PKG_CONFIG_PATH: ""
|
|
48
|
+
run: cargo clippy -- -D warnings
|
|
49
|
+
|
|
50
|
+
test:
|
|
51
|
+
name: Test (${{ matrix.os }}, py${{ matrix.python-version }})
|
|
52
|
+
runs-on: ${{ matrix.os }}
|
|
53
|
+
strategy:
|
|
54
|
+
fail-fast: false
|
|
55
|
+
matrix:
|
|
56
|
+
include:
|
|
57
|
+
- os: ubuntu-latest
|
|
58
|
+
python-version: "3.12"
|
|
59
|
+
- os: windows-latest
|
|
60
|
+
python-version: "3.12"
|
|
61
|
+
- os: macos-latest
|
|
62
|
+
python-version: "3.12"
|
|
63
|
+
steps:
|
|
64
|
+
- uses: actions/checkout@v4
|
|
65
|
+
|
|
66
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
67
|
+
|
|
68
|
+
- uses: actions/setup-python@v5
|
|
69
|
+
with:
|
|
70
|
+
python-version: ${{ matrix.python-version }}
|
|
71
|
+
|
|
72
|
+
- name: Install Linux system dependencies
|
|
73
|
+
if: runner.os == 'Linux'
|
|
74
|
+
run: |
|
|
75
|
+
sudo apt-get update
|
|
76
|
+
sudo apt-get install -y \
|
|
77
|
+
libwebkit2gtk-4.1-dev \
|
|
78
|
+
libgtk-3-dev \
|
|
79
|
+
libglib2.0-dev \
|
|
80
|
+
xvfb
|
|
81
|
+
|
|
82
|
+
- name: Install Python dependencies
|
|
83
|
+
run: |
|
|
84
|
+
python -m pip install --upgrade pip
|
|
85
|
+
pip install maturin pytest
|
|
86
|
+
|
|
87
|
+
- name: Build and install
|
|
88
|
+
shell: bash
|
|
89
|
+
env:
|
|
90
|
+
PKG_CONFIG_PATH: ""
|
|
91
|
+
run: |
|
|
92
|
+
maturin build --release --out dist
|
|
93
|
+
pip install dist/*.whl
|
|
94
|
+
|
|
95
|
+
- name: Configure Tcl/Tk (Windows)
|
|
96
|
+
if: runner.os == 'Windows'
|
|
97
|
+
shell: bash
|
|
98
|
+
run: |
|
|
99
|
+
echo "TCL_LIBRARY=${pythonLocation}/tcl/tcl8.6" >> "$GITHUB_ENV"
|
|
100
|
+
echo "TK_LIBRARY=${pythonLocation}/tcl/tk8.6" >> "$GITHUB_ENV"
|
|
101
|
+
|
|
102
|
+
- name: Run tests (Linux)
|
|
103
|
+
if: runner.os == 'Linux'
|
|
104
|
+
shell: bash
|
|
105
|
+
env:
|
|
106
|
+
DISPLAY: :99
|
|
107
|
+
TK_SILENCE_DEPRECATION: "1"
|
|
108
|
+
run: xvfb-run -a pytest tests/ -v
|
|
109
|
+
|
|
110
|
+
- name: Run tests (Windows / macOS)
|
|
111
|
+
if: runner.os != 'Linux'
|
|
112
|
+
shell: bash
|
|
113
|
+
env:
|
|
114
|
+
TK_SILENCE_DEPRECATION: "1"
|
|
115
|
+
run: pytest tests/ -v
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
sdist:
|
|
13
|
+
name: Source distribution
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.12"
|
|
21
|
+
|
|
22
|
+
- name: Build sdist
|
|
23
|
+
uses: PyO3/maturin-action@v1
|
|
24
|
+
with:
|
|
25
|
+
command: sdist
|
|
26
|
+
args: --out dist
|
|
27
|
+
|
|
28
|
+
- uses: actions/upload-artifact@v4
|
|
29
|
+
with:
|
|
30
|
+
name: sdist
|
|
31
|
+
path: dist/*.tar.gz
|
|
32
|
+
|
|
33
|
+
wheels:
|
|
34
|
+
name: Wheel (${{ matrix.id }})
|
|
35
|
+
runs-on: ${{ matrix.os }}
|
|
36
|
+
strategy:
|
|
37
|
+
fail-fast: false
|
|
38
|
+
matrix:
|
|
39
|
+
include:
|
|
40
|
+
- id: windows
|
|
41
|
+
os: windows-latest
|
|
42
|
+
target: ""
|
|
43
|
+
- id: macos-arm64
|
|
44
|
+
os: macos-latest
|
|
45
|
+
target: aarch64-apple-darwin
|
|
46
|
+
- id: macos-x86_64
|
|
47
|
+
os: macos-latest
|
|
48
|
+
target: x86_64-apple-darwin
|
|
49
|
+
steps:
|
|
50
|
+
- uses: actions/checkout@v4
|
|
51
|
+
|
|
52
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
53
|
+
|
|
54
|
+
- name: Add Rust target
|
|
55
|
+
if: matrix.target != ''
|
|
56
|
+
run: rustup target add ${{ matrix.target }}
|
|
57
|
+
|
|
58
|
+
- uses: actions/setup-python@v5
|
|
59
|
+
with:
|
|
60
|
+
python-version: "3.12"
|
|
61
|
+
|
|
62
|
+
- name: Build abi3 wheel
|
|
63
|
+
uses: PyO3/maturin-action@v1
|
|
64
|
+
with:
|
|
65
|
+
target: ${{ matrix.target }}
|
|
66
|
+
args: --release --out dist
|
|
67
|
+
|
|
68
|
+
- uses: actions/upload-artifact@v4
|
|
69
|
+
with:
|
|
70
|
+
name: wheel-${{ matrix.id }}
|
|
71
|
+
path: dist/*.whl
|
|
72
|
+
|
|
73
|
+
github-release:
|
|
74
|
+
name: GitHub Release
|
|
75
|
+
runs-on: ubuntu-latest
|
|
76
|
+
needs: [sdist, wheels]
|
|
77
|
+
permissions:
|
|
78
|
+
contents: write
|
|
79
|
+
steps:
|
|
80
|
+
- uses: actions/checkout@v4
|
|
81
|
+
|
|
82
|
+
- uses: actions/download-artifact@v4
|
|
83
|
+
with:
|
|
84
|
+
pattern: wheel-*
|
|
85
|
+
merge-multiple: true
|
|
86
|
+
path: dist
|
|
87
|
+
|
|
88
|
+
- uses: actions/download-artifact@v4
|
|
89
|
+
with:
|
|
90
|
+
name: sdist
|
|
91
|
+
path: dist
|
|
92
|
+
|
|
93
|
+
- name: List dist
|
|
94
|
+
shell: bash
|
|
95
|
+
run: ls -la dist/
|
|
96
|
+
|
|
97
|
+
- name: Create GitHub Release
|
|
98
|
+
uses: softprops/action-gh-release@v2
|
|
99
|
+
with:
|
|
100
|
+
files: dist/*
|
|
101
|
+
generate_release_notes: true
|
|
102
|
+
|
|
103
|
+
publish:
|
|
104
|
+
name: Publish to PyPI
|
|
105
|
+
runs-on: ubuntu-latest
|
|
106
|
+
needs: [sdist, wheels]
|
|
107
|
+
environment:
|
|
108
|
+
name: pypi
|
|
109
|
+
url: https://pypi.org/p/tkwry
|
|
110
|
+
permissions:
|
|
111
|
+
id-token: write
|
|
112
|
+
steps:
|
|
113
|
+
- uses: actions/download-artifact@v4
|
|
114
|
+
with:
|
|
115
|
+
pattern: wheel-*
|
|
116
|
+
merge-multiple: true
|
|
117
|
+
path: dist
|
|
118
|
+
|
|
119
|
+
- uses: actions/download-artifact@v4
|
|
120
|
+
with:
|
|
121
|
+
name: sdist
|
|
122
|
+
path: dist
|
|
123
|
+
|
|
124
|
+
- name: List dist
|
|
125
|
+
shell: bash
|
|
126
|
+
run: ls -la dist/
|
|
127
|
+
|
|
128
|
+
- name: Publish
|
|
129
|
+
uses: PyO3/maturin-action@v1
|
|
130
|
+
with:
|
|
131
|
+
command: upload
|
|
132
|
+
args: --non-interactive --skip-existing dist/*
|
tkwry-0.0.1/.gitignore
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*$py.class
|
|
4
|
+
.Python
|
|
5
|
+
.venv/
|
|
6
|
+
venv/
|
|
7
|
+
dist/
|
|
8
|
+
dist-test/
|
|
9
|
+
build/
|
|
10
|
+
target/
|
|
11
|
+
*.egg-info/
|
|
12
|
+
.ruff_cache/
|
|
13
|
+
.mypy_cache/
|
|
14
|
+
.pytest_cache/
|
|
15
|
+
.coverage
|
|
16
|
+
htmlcov/
|
|
17
|
+
.DS_Store
|
|
18
|
+
|
|
19
|
+
# Local / private
|
|
20
|
+
NOTES.md
|
|
21
|
+
.env
|
|
22
|
+
.env.*
|
|
23
|
+
*.local
|
|
24
|
+
*競合*
|
|
25
|
+
*conflicted copy*
|
|
26
|
+
|
|
27
|
+
# Built extension modules
|
|
28
|
+
*.so
|
|
29
|
+
*.pyd
|
|
30
|
+
*.dylib
|
|
31
|
+
*.whl
|
|
32
|
+
tkwry/_core*.so
|
|
33
|
+
tkwry/_core*.pyd
|
tkwry-0.0.1/CHANGELOG.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
|
+
|
|
7
|
+
## [0.0.1] - 2026-06-23
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `WebView` widget — embed wry as a true child of a Tkinter `Frame` (HWND / NSView / X11)
|
|
12
|
+
- Layout sync for `pack`, `grid`, `place`, tabs, and `PanedWindow`
|
|
13
|
+
- IPC bridge (`window.ipc.postMessage`) with Tk-thread queueing
|
|
14
|
+
- Navigation hooks: `on_navigation`, `on_page_load`, `on_title_changed`, `on_new_window`
|
|
15
|
+
- Native OS drag-and-drop into the WebView (`drag_drop_handler`, `DragDropEvent`)
|
|
16
|
+
- `load_url`, `load_html`, `reload`, `eval_js`, `eval_js_with_callback`
|
|
17
|
+
- DevTools, `focus`, `background_color`, `user_agent`, `initialization_script`
|
|
18
|
+
- URL normalization and `http`/`https` validation
|
|
19
|
+
- Pre-built **abi3** wheels for Windows (x86_64) and macOS (arm64 + Intel)
|
|
20
|
+
- Examples: `url_demo`, `ipc_demo`, `multi_demo`, `plotly_demo`, `dnd_demo`
|
|
21
|
+
- CI on Linux (Xvfb + WebKitGTK), Windows, and macOS
|
|
22
|
+
|
|
23
|
+
### Known limitations
|
|
24
|
+
|
|
25
|
+
- **Alpha** — APIs may change without notice
|
|
26
|
+
- **macOS** — child `Frame`s share the toplevel content view; tkwry syncs bounds and visibility automatically (including `ttk.Notebook` tabs)
|
|
27
|
+
- **Linux** — no PyPI wheels; build from source with WebKitGTK 4.1
|
|
28
|
+
- **DevTools** — uses private APIs on macOS; avoid in App Store release builds
|
|
29
|
+
- Drag-and-drop targets the WebView region only (not arbitrary Tk widgets)
|
|
30
|
+
|
|
31
|
+
[0.0.1]: https://github.com/mashu3/tkwry/releases/tag/v0.0.1
|