diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ff7e030..67e2e10 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -137,3 +137,43 @@ jobs: else npm publish --access public fi + + # tauri-plugin-python-cli (cli/) is a separate npm package with its own + # Trusted Publisher entry on npmjs.com. + publish-npm-cli: + name: Publish CLI to npm + runs-on: ubuntu-22.04 + needs: release + environment: release + permissions: + contents: read + id-token: write + defaults: + run: + working-directory: cli + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: lts/* + registry-url: 'https://registry.npmjs.org' + + - name: Upgrade npm + run: npm install -g npm@latest + + - name: check + run: | + npm install + npm run typecheck + npm test + + - name: Publish to npm + run: | + NAME=$(node -p "require('./package.json').name") + VERSION=$(node -p "require('./package.json').version") + if [ -n "$(npm view "$NAME@$VERSION" version 2>/dev/null)" ]; then + echo "npm already has $NAME@$VERSION — skipping publish." + else + npm publish --access public + fi diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 08ecb77..f9f149c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,14 +18,6 @@ jobs: with: path: tauri-plugin-python - # TEMP: the plugin's Cargo.toml has `[patch.crates-io] async_py = { path = "../async_py" }` - # until async_py 0.3.2 is published to crates.io. Remove this step (and the patch) afterwards. - - name: checkout async_py (local patch source) - uses: actions/checkout@v4 - with: - repository: marcomq/async_py - path: async_py - - uses: dtolnay/rust-toolchain@stable with: components: rustfmt, clippy @@ -67,13 +59,6 @@ jobs: with: path: tauri-plugin-python - # TEMP: see note in the `lint` job. Remove once async_py 0.3.2 is on crates.io. - - name: checkout async_py (local patch source) - uses: actions/checkout@v4 - with: - repository: marcomq/async_py - path: async_py - - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 with: @@ -171,3 +156,136 @@ jobs: echo "FAIL: app exited during startup (Python init likely panicked)." exit 1 fi + + cli: + runs-on: ubuntu-22.04 + defaults: + run: + working-directory: cli + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts/* + - run: npm install + - run: npm run typecheck + - run: npm test + + # End-to-end deployment check: bundle a standalone Python with the CLI, build + # an installable app and start it from the install location with a minimal + # environment. The probe main.py reports which Python ran and what imports. + bundled-python: + strategy: + fail-fast: false + matrix: + include: + - os: macos-latest + bundle: app + - os: ubuntu-22.04 + bundle: deb + - os: windows-latest + bundle: nsis + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + working-directory: examples/plain-javascript + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: lts/* + + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + with: + workspaces: examples/plain-javascript/src-tauri + key: bundled-python + + - name: install dependencies (ubuntu) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf xvfb + + - name: use probe main.py + run: | + cp ci/probe_main.py src-tauri/src-python/main.py + echo markupsafe > src-tauri/src-python/requirements.txt + + - name: bundle standalone Python + run: node ../../cli/bin/cli.js setup + + - name: doctor (before build) + run: node ../../cli/bin/cli.js doctor + + - name: build + run: | + npm install + npm run tauri build -- --bundles ${{ matrix.bundle }} + + - name: doctor (after build) + run: node ../../cli/bin/cli.js doctor + + - name: install app + id: install + run: | + DEST="$RUNNER_TEMP/installed" + BUNDLE=src-tauri/target/release/bundle + case "${{ runner.os }}" in + macOS) + mkdir -p "$DEST" && cp -R $BUNDLE/macos/*.app "$DEST/" + EXE=$(ls "$DEST"/*.app/Contents/MacOS/*) ;; + Linux) + dpkg -x $BUNDLE/deb/*.deb "$DEST" + EXE=$(ls "$DEST"/usr/bin/* | head -n1) ;; + Windows) + # The tauri NSIS installer ignores /D and installs per user to %LOCALAPPDATA%\. + PRODUCT=$(node -p "require('./src-tauri/tauri.conf.json').productName") + DEST="$(cygpath -u "$LOCALAPPDATA")/$PRODUCT" + $BUNDLE/nsis/*-setup.exe //S + for _ in $(seq 30); do + EXE=$(ls "$DEST"/*.exe 2>/dev/null | grep -vi uninstall | head -n1 || true) + [ -n "$EXE" ] && break + sleep 2 + done + if [ -z "$EXE" ]; then + echo "No exe in $DEST"; ls -la "$DEST" "$(cygpath -u "$LOCALAPPDATA")"/plain* || true + exit 1 + fi + EXE=$(cygpath -w "$EXE") ;; + esac + # The source copy must not be reachable as fallback. + rm -rf src-tauri/pyembed + echo "exe=$EXE" >> "$GITHUB_OUTPUT" + + - name: start installed app + run: | + REPORT="$RUNNER_TEMP/report.txt" + if [ "${{ runner.os }}" = Linux ]; then + xvfb-run -a node ci/launch_bundled.mjs "${{ steps.install.outputs.exe }}" "$REPORT" + else + node ci/launch_bundled.mjs "${{ steps.install.outputs.exe }}" "$REPORT" + fi + + # Like a user: apt-installs the .deb on a fresh Ubuntu without any Python. + - name: install and start in a clean container (no Python) + if: runner.os == 'Linux' + run: | + DEB=$(ls src-tauri/target/release/bundle/deb/*.deb) + docker run --rm \ + -v "$PWD:/work:ro" -v "$(dirname "$(command -v node)"):/opt/node:ro" \ + -e DEB="/work/$DEB" ubuntu:22.04 bash -euo pipefail -c ' + export DEBIAN_FRONTEND=noninteractive PATH="/opt/node:$PATH" + apt-get update -qq + apt-get install -y -qq --no-install-recommends "$DEB" xvfb xauth > /dev/null + if compgen -G "/usr/lib/*/libpython3*" > /dev/null || command -v python3; then + echo "FAIL: the container has a system Python"; exit 1 + fi + EXE=$(dpkg -L "$(dpkg-deb -f "$DEB" Package)" | grep "^/usr/bin/" | head -n1) + mkdir -p /tmp/run + xvfb-run -a node /work/ci/launch_bundled.mjs "$EXE" /tmp/run/report.txt + ' diff --git a/Cargo.lock b/Cargo.lock index 22b77d9..6c91616 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,48 +29,48 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" dependencies = [ "memchr", ] [[package]] name = "alloc-no-stdlib" -version = "2.0.4" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" +checksum = "c2fb6cfd47bf496ff64095c20eaba0c201404ee38714d4142fcfa1dc334fcc7a" [[package]] name = "alloc-stdlib" -version = "0.2.4" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e76a019e91224d279006ff972f1e984179a6e9feb050adba6ce8274aef23195" +checksum = "0b5c1865780388bfa186411ab5f247819487fc4864c6e9c3106611fa347586e1" dependencies = [ "alloc-no-stdlib", ] [[package]] name = "android_system_properties" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" dependencies = [ "libc", ] [[package]] name = "anyhow" -version = "1.0.102" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" [[package]] name = "ar_archive_writer" -version = "0.5.2" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4087686b4b0a3427190bae57a1d9a478dbb2d40c5dc1bd6e2b6d797913bdd348" +checksum = "523e5e187fff36fcb8d1d19ccf0ca4ca43ec3d158316057f66dc6f72716bc5ec" dependencies = [ "object", ] @@ -83,28 +83,29 @@ checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" [[package]] name = "async-trait" -version = "0.1.89" +version = "0.1.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 3.0.10", ] [[package]] name = "async_py" -version = "0.3.2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f074898c46ee54f4549418e4fadc3fd1320c13460374e5237153a5f38da25659" +checksum = "ed830613c3ffcc75dfa8eb5fa6612920caca9b5e1b1a841d6b6843dd5757f404" dependencies = [ "dunce", "mt19937", "pyo3", + "rustpython-pylib", "rustpython-stdlib", "rustpython-vm", "serde_json", - "thiserror 2.0.18", + "thiserror 2.0.21", "tokio", ] @@ -157,7 +158,7 @@ dependencies = [ "manyhow", "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -173,7 +174,7 @@ dependencies = [ "proc-macro2", "quote", "quote-use", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -194,13 +195,28 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + [[package]] name = "bit-set" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ - "bit-vec", + "bit-vec 0.8.0", +] + +[[package]] +name = "bit-set" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56d87354e4229f54a44f7bf2435906a4656dba36026ab6eaca629a2c436a691c" +dependencies = [ + "bit-vec 0.10.2", ] [[package]] @@ -209,6 +225,12 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" +[[package]] +name = "bit-vec" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72503af1e72be411d74ca45cd6b309878fcb35354e252fc2a3a8bda3a97082a0" + [[package]] name = "bitflags" version = "1.3.2" @@ -217,9 +239,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.13.0" +version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" dependencies = [ "serde_core", ] @@ -265,9 +287,9 @@ dependencies = [ [[package]] name = "brotli" -version = "8.0.4" +version = "9.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc91aac060a7a1e25823bdccbfb6af1875b88f17c6daac97894eed8207166b3" +checksum = "627b7cfb0578f0eafce087a90fcd40add1231900b69e4d4de2d456260a4f5d81" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -276,9 +298,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "5.0.3" +version = "6.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a32acac15fe1967bc3986b2a6347dffc965602354ea6f450ad07e8bfd253583" +checksum = "75c74c9c51b9140663e196b5fb88bc94c334d7a497c8311cb759d8557874747f" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -295,13 +317,13 @@ dependencies = [ [[package]] name = "bstr" -version = "1.12.1" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab" +checksum = "6bb31b46c14244e20ee9984b11bf5c992b91fb6939fea616e3512c8baecdbe5f" dependencies = [ "memchr", "regex-automata", - "serde", + "serde_core", ] [[package]] @@ -312,9 +334,9 @@ checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" [[package]] name = "bytemuck" -version = "1.25.0" +version = "1.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" [[package]] name = "byteorder" @@ -324,9 +346,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae3f5d315924270530207e2a68396c3cc547f6dca3fbdca317cfb1a51edb593" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" dependencies = [ "serde", ] @@ -346,7 +368,7 @@ version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ca26ef0159422fb77631dc9d17b102f253b876fe1586b03b803e63a309b4ee2" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "cairo-sys-rs", "glib", "libc", @@ -367,9 +389,9 @@ dependencies = [ [[package]] name = "camino" -version = "1.2.3" +version = "1.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ce8d3bd5823c7504d3f579f13e7b2f3da252fcb938c594d5680ee508bf846f" +checksum = "bbbad30e4b4c14a39e3cc8aed085a12a327257c316619c93581e017bc52be591" dependencies = [ "serde_core", ] @@ -394,17 +416,18 @@ dependencies = [ "semver", "serde", "serde_json", - "thiserror 2.0.18", + "thiserror 2.0.21", ] [[package]] name = "cargo_toml" -version = "0.22.3" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374b7c592d9c00c1f4972ea58390ac6b18cbb6ab79011f3bdc90a0b82ca06b77" +checksum = "82f4b26e751e711a5302649417f2da046dce6391b2ea30a4820f37462314f0b9" dependencies = [ + "semver", "serde", - "toml 0.9.12+spec-1.1.0", + "toml 1.2.1+spec-1.1.0", ] [[package]] @@ -427,9 +450,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.64" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dad887fd958be91b5098c0248def011f4523ab786cd411be668777e55063501f" +checksum = "4ff2a8126fff0f8c839080d619675a585e61720bb12d2baceae45769fd66f155" dependencies = [ "find-msvc-tools", "jobserver", @@ -445,13 +468,13 @@ checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" [[package]] name = "cfb" -version = "0.7.3" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f" +checksum = "a347dcabdae9c31b0825fd6a8bed285ec9c2acb89c47827126d52fa4f59cece3" dependencies = [ - "byteorder", "fnv", "uuid", + "web-time", ] [[package]] @@ -466,15 +489,15 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" [[package]] name = "cfg_aliases" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" [[package]] name = "chrono" @@ -487,14 +510,14 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-link 0.2.1", + "windows-link", ] [[package]] name = "clipboard-win" -version = "5.4.1" +version = "5.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4" +checksum = "052af7878466feccda12ba7a6a67d019d712f296809559b47c12c8cc196d3a9a" dependencies = [ "error-code", ] @@ -507,9 +530,9 @@ checksum = "2550f75b8cfac212855f6b1885455df8eaee8fe8e246b647d69146142e016084" [[package]] name = "combine" -version = "4.6.7" +version = "4.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92" dependencies = [ "bytes", "memchr", @@ -537,9 +560,9 @@ checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" [[package]] name = "cookie" -version = "0.18.1" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" +checksum = "1a373e3602691c3cdea496d2f0ee5935151e6168fe87739483c463db1b2f2f87" dependencies = [ "time", "version_check", @@ -577,7 +600,7 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "064badf302c3194842cf2c5d61f56cc88e54a759313879cdf03abdd27d0c3b97" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "core-foundation 0.10.1", "core-graphics-types", "foreign-types", @@ -590,7 +613,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "core-foundation 0.10.1", "libc", ] @@ -606,27 +629,27 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.5.0" +version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +checksum = "2b929dd2a135771f40afabd1073f85eed59c800b7c61901e5c254270497dad64" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-channel" -version = "0.5.15" +version = "0.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" +checksum = "98b0cc327b5bc766e7fda9c9260cc0fa81b43a8e240440422dff70788e3f9ef1" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.21" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" [[package]] name = "crunchy" @@ -646,9 +669,9 @@ dependencies = [ [[package]] name = "cssparser" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dae61cf9c0abb83bd659dab65b7e4e38d8236824c85f0f804f173567bda257d2" +checksum = "8c9cdaae01d5ed7882b04d795e7f752f46ff52d2fa3b50a20d28c464510bba98" dependencies = [ "cssparser-macros", "dtoa-short", @@ -657,14 +680,27 @@ dependencies = [ "smallvec", ] +[[package]] +name = "cssparser" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11119743ad110e8c1bdccd930d7f5c30c99e5fc76a7b63ec9807e84eef0c5f59" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "phf 0.14.0", + "smallvec", +] + [[package]] name = "cssparser-macros" -version = "0.6.1" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" +checksum = "d045de693cb712d0b22c6a64be5b953f67b3ce00ab5ad3dd5d8b441886ab8e1a" dependencies = [ "quote", - "syn 2.0.118", + "syn 3.0.10", ] [[package]] @@ -678,25 +714,15 @@ dependencies = [ [[package]] name = "ctor" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "352d39c2f7bef1d6ad73db6f5160efcaed66d94ef8c6c573a8410c00bf909a98" -dependencies = [ - "ctor-proc-macro", - "dtor", -] - -[[package]] -name = "ctor-proc-macro" -version = "0.0.7" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52560adf09603e58c9a7ee1fe1dcb95a16927b17c127f0ac02d6e768a0e25bc1" +checksum = "914a755b7c2d4af2bdcff7ce1739e2db9a1b81a9b07123d8015786ae03c0980d" [[package]] name = "darling" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" +checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec" dependencies = [ "darling_core", "darling_macro", @@ -704,33 +730,33 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" +checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff" dependencies = [ "ident_case", "proc-macro2", "quote", "strsim", - "syn 2.0.118", + "syn 3.0.10", ] [[package]] name = "darling_macro" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" +checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785" dependencies = [ "darling_core", "quote", - "syn 2.0.118", + "syn 3.0.10", ] [[package]] name = "dbus" -version = "0.9.11" +version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b942602992bb7acfd1f51c49811c58a610ef9181b6e66f3e519d79b540a3bf73" +checksum = "3ab69f03cc8c4340c9c8e315114e1658e6775a9b16a04357973aa21cec22b32e" dependencies = [ "libc", "libdbus-sys", @@ -739,22 +765,22 @@ dependencies = [ [[package]] name = "deranged" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" +checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e" dependencies = [ "serde_core", ] [[package]] name = "derive-where" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d08b3a0bcc0d079199cd476b2cae8435016ec11d1c0986c6901c5ac223041534" +checksum = "2e2b94854e8576378ccda7c8de8a66ed8b4e8acbd2c50ec3418ea6c8aaf4b567" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 3.0.10", ] [[package]] @@ -775,7 +801,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -791,9 +817,9 @@ dependencies = [ [[package]] name = "dirs" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +checksum = "8d57d423b3c82e89b9a24ca3091fee61f456a26edbd28d26c65906f4bc1dcd8f" dependencies = [ "dirs-sys", ] @@ -816,7 +842,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "block2", "libc", "objc2", @@ -824,13 +850,13 @@ dependencies = [ [[package]] name = "displaydoc" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 3.0.10", ] [[package]] @@ -853,7 +879,7 @@ checksum = "0fbbb781877580993a8707ec48672673ec7b81eeba04cfd2310bd28c08e47c8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -870,16 +896,31 @@ dependencies = [ [[package]] name = "dom_query" -version = "0.27.0" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fac5fca71e65e94cc718a6e2af65d6e0f9c6027751c2aa562fbb5087fda639bc" +dependencies = [ + "bit-set 0.8.0", + "cssparser 0.37.0", + "foldhash", + "html5ever 0.39.0", + "precomputed-hash", + "selectors 0.38.0", + "tendril", +] + +[[package]] +name = "dom_query" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "521e380c0c8afb8d9a1e83a1822ee03556fc3e3e7dbc1fd30be14e37f9cb3f89" +checksum = "498c698ac51127148a3984450e51fca7f01805a91d7a1f7a24af0a5f761e3385" dependencies = [ - "bit-set", - "cssparser", + "bit-set 0.11.1", + "cssparser 0.38.0", "foldhash", - "html5ever", + "html5ever 0.40.1", "precomputed-hash", - "selectors", + "selectors 0.41.0", "tendril", ] @@ -907,21 +948,6 @@ dependencies = [ "dtoa", ] -[[package]] -name = "dtor" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1057d6c64987086ff8ed0fd3fbf377a6b7d205cc7715868cd401705f715cbe4" -dependencies = [ - "dtor-proc-macro", -] - -[[package]] -name = "dtor-proc-macro" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f678cf4a922c215c63e0de95eb1ff08a958a81d47e485cf9da1e27bf6305cfa5" - [[package]] name = "dunce" version = "1.0.5" @@ -936,20 +962,20 @@ checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" [[package]] name = "either" -version = "1.16.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" [[package]] name = "embed-resource" -version = "3.0.9" +version = "3.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31a88c8d26de40ed18fe748c547845aa39de1db3afd958f8cb91579f3644bcb" +checksum = "6168487b5e7eb2673e6efe1200b1848016e436a6ca0b8031bf04bd9d493a249f" dependencies = [ "cc", "memchr", "rustc_version", - "toml 1.1.2+spec-1.1.0", + "toml 1.2.1+spec-1.1.0", "vswhom", "winreg", ] @@ -968,15 +994,15 @@ checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" [[package]] name = "equivalent" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" [[package]] name = "erased-serde" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2add8a07dd6a8d93ff627029c51de145e12686fbc36ecb298ac22e74cf02dec" +checksum = "1e59b668157f32d3459d4bd634861a06ffa2503a461ca5f0916b9f0252605e66" dependencies = [ "serde", "serde_core", @@ -985,9 +1011,9 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776" dependencies = [ "libc", "windows-sys 0.61.2", @@ -995,9 +1021,9 @@ dependencies = [ [[package]] name = "error-code" -version = "3.3.2" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dea2df4cf52843e0452895c455a1a2cfbb842a1e7329671acf418fdc53ed4c59" +checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" [[package]] name = "exitcode" @@ -1007,9 +1033,9 @@ checksum = "de853764b47027c2e862a995c34978ffa63c1501f2e15f987ba11bd4f9bba193" [[package]] name = "fastrand" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" [[package]] name = "fd-lock" @@ -1043,19 +1069,19 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.9" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" +checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" [[package]] name = "flate2" -version = "1.1.9" +version = "1.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" +checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4" dependencies = [ "crc32fast", - "miniz_oxide", - "zlib-rs 0.6.3", + "miniz_oxide 0.9.1", + "zlib-rs 0.6.8", ] [[package]] @@ -1082,13 +1108,13 @@ dependencies = [ [[package]] name = "foreign-types-macros" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 3.0.10", ] [[package]] @@ -1108,24 +1134,24 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" [[package]] name = "futures-executor" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" dependencies = [ "futures-core", "futures-task", @@ -1134,38 +1160,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" [[package]] name = "futures-macro" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 3.0.10", ] [[package]] name = "futures-sink" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" [[package]] name = "futures-task" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" [[package]] name = "futures-util" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" dependencies = [ "futures-core", "futures-io", @@ -1294,7 +1320,7 @@ checksum = "f2b6d1e2f75c16bfbcd0f95d84f99858a6e2f885c2287d1f5c3a96e8444a34b4" dependencies = [ "attribute-derive", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -1317,7 +1343,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" dependencies = [ "rustix", - "windows-link 0.2.1", + "windows-link", ] [[package]] @@ -1403,7 +1429,7 @@ version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "233daaf6e83ae6a12a52055f568f9d7cf4671dabb78ff9560ab6da230ce00ee5" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "futures-channel", "futures-core", "futures-executor", @@ -1431,7 +1457,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -1446,9 +1472,9 @@ dependencies = [ [[package]] name = "glob" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" +checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" [[package]] name = "gobject-sys" @@ -1510,7 +1536,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -1559,9 +1585,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" +checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" [[package]] name = "hex" @@ -1595,19 +1621,30 @@ dependencies = [ [[package]] name = "html5ever" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1054432bae2f14e0061e33d23402fbaa67a921d319d56adc6bcf887ddad1cbc2" +checksum = "46a1761807faccc9a19e86944bbf40610014066306f96edcdedc2fb714bcb7b8" dependencies = [ "log", - "markup5ever", + "markup5ever 0.39.0", +] + +[[package]] +name = "html5ever" +version = "0.40.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456a1a377e608e555d22ddab27ac0114bc7a7b4199078108e34c2aeae6c9b130" +dependencies = [ + "log", + "markup5ever 0.40.0", + "memchr", ] [[package]] name = "http" -version = "1.4.2" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6970f50e31d6fc17d3fa27329444bfa74e196cf62e95052a3f6fee181dba6425" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" dependencies = [ "bytes", "itoa", @@ -1615,9 +1652,9 @@ dependencies = [ [[package]] name = "http-body" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" dependencies = [ "bytes", "http", @@ -1625,9 +1662,9 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" dependencies = [ "bytes", "futures-core", @@ -1644,13 +1681,12 @@ checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] name = "hyper" -version = "1.10.1" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55281c53a1894c864990125767da440a4e630446785086f52523b20033b74498" +checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" dependencies = [ "atomic-waker", "bytes", - "futures-channel", "futures-core", "http", "http-body", @@ -1664,16 +1700,17 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.20" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" dependencies = [ - "base64 0.22.1", + "base64 0.23.1", "bytes", "futures-channel", "futures-util", "http", "http-body", + "httparse", "hyper", "ipnet", "libc", @@ -1711,19 +1748,19 @@ dependencies = [ [[package]] name = "ico" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e795dff5605e0f04bff85ca41b51a96b83e80b281e96231bcaaf1ac35103371" +checksum = "d75e94d66081e4d8dcd098bd8dc5254800fea14a26389b298410158d834de167" dependencies = [ "byteorder", - "png 0.17.16", + "png", ] [[package]] name = "icu_collections" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" dependencies = [ "displaydoc", "potential_utf", @@ -1735,9 +1772,9 @@ dependencies = [ [[package]] name = "icu_locale_core" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" dependencies = [ "displaydoc", "litemap", @@ -1748,9 +1785,9 @@ dependencies = [ [[package]] name = "icu_normalizer" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" dependencies = [ "icu_collections", "icu_normalizer_data", @@ -1762,16 +1799,17 @@ dependencies = [ [[package]] name = "icu_normalizer_data" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" [[package]] name = "icu_properties" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" dependencies = [ + "displaydoc", "icu_collections", "icu_locale_core", "icu_properties_data", @@ -1782,15 +1820,15 @@ dependencies = [ [[package]] name = "icu_properties_data" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" [[package]] name = "icu_provider" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" dependencies = [ "displaydoc", "icu_locale_core", @@ -1841,9 +1879,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.14.0" +version = "2.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" dependencies = [ "equivalent", "hashbrown 0.17.1", @@ -1853,9 +1891,9 @@ dependencies = [ [[package]] name = "infer" -version = "0.19.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a588916bfdfd92e71cacef98a63d9b1f0d74d6599980d11894290e7ddefffcf7" +checksum = "f4200d433cbd5178df7797c9c2e75b348b728e39631cf14520d1e2fc424201f4" dependencies = [ "cfb", ] @@ -1868,20 +1906,20 @@ checksum = "71dd52191aae121e8611f1e8dc3e324dd0dd1dee1e6dd91d10ee07a3cfb4d9d8" [[package]] name = "ipnet" -version = "2.12.0" +version = "2.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" [[package]] name = "is-macro" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d57a3e447e24c22647738e4607f1df1e0ec6f72e16182c4cd199f647cdfb0e4" +checksum = "8267aa6001e25494f3015f9663bbd88a18240c74483afa5f0934a1b3e4c388e9" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -1895,9 +1933,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" [[package]] name = "javascriptcore-rs" @@ -1922,6 +1960,58 @@ dependencies = [ "system-deps", ] +[[package]] +name = "jiff" +version = "0.2.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26699905cc795a23e3949585cc7ba3ee8ade090872a27e4316304a777297894a" +dependencies = [ + "jiff-core", + "jiff-static", + "jiff-tzdb-platform", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", + "windows-link", +] + +[[package]] +name = "jiff-core" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe6854081f5ac0a3046a9b223729ccd7a20b1e0e8277e44dc0660eedf67dfe2" +dependencies = [ + "log", +] + +[[package]] +name = "jiff-static" +version = "0.2.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b4ff49b2887190c760b86207b55cdcaabbdecaf7a0660d68aa2ed6f652abf0a" +dependencies = [ + "jiff-core", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jiff-tzdb" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa8377070c6bae868759445e5a77f66d84f0b72f3a054bfb00e6d038b8282da7" + +[[package]] +name = "jiff-tzdb-platform" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8" +dependencies = [ + "jiff-tzdb", +] + [[package]] name = "jni" version = "0.21.1" @@ -1963,24 +2053,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" dependencies = [ "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] name = "jobserver" -version = "0.1.34" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" dependencies = [ - "getrandom 0.3.4", + "getrandom 0.4.3", "libc", ] [[package]] name = "js-sys" -version = "0.3.102" +version = "0.3.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d04c30968dffe80775bd4d7fb676131cd04a1fb46d2686dbffbaec2d9dfd31" +checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a" dependencies = [ "cfg-if", "futures-util", @@ -1989,21 +2079,21 @@ dependencies = [ [[package]] name = "json-patch" -version = "3.0.1" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "863726d7afb6bc2590eeff7135d923545e5e964f004c2ccf8716c25e70a86f08" +checksum = "7421438de105a0827e44fadd05377727847d717c80ce29a229f85fd04c427b72" dependencies = [ "jsonptr", "serde", "serde_json", - "thiserror 1.0.69", + "thiserror 2.0.21", ] [[package]] name = "jsonptr" -version = "0.6.3" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dea2b27dd239b2556ed7a25ba842fe47fd602e7fc7433c2a8d6106d4d9edd70" +checksum = "a5a3cc660ba5d72bce0b3bb295bf20847ccbb40fd423f3f05b61273672e561fe" dependencies = [ "serde", "serde_json", @@ -2030,13 +2120,12 @@ dependencies = [ [[package]] name = "keyboard-types" -version = "0.7.0" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b750dcadc39a09dbadd74e118f6dd6598df77fa01df0cfcdc52c28dece74528a" +checksum = "0fbe853b403ae61a04233030ae8a79d94975281ed9770a1f9e246732b534b28d" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "serde", - "unicode-segmentation", ] [[package]] @@ -2090,9 +2179,9 @@ dependencies = [ [[package]] name = "libbz2-rs-sys" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34b357333733e8260735ba5894eb928c02ecc69c78715f01a8019e7fa7f2db4c" +checksum = "32f454fd6831a29c0e827ed075bca2a15be201bd57f4168f0fd1041124eab17e" [[package]] name = "libc" @@ -2111,9 +2200,9 @@ dependencies = [ [[package]] name = "libffi" -version = "5.1.0" +version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0498fe5655f857803e156523e644dcdcdc3b3c7edda42ea2afdae2e09b2db87b" +checksum = "7a8d526bc07aa02e6826944ec446ecd8d228bd97b1cbd21e5bc5e3407a09a585" dependencies = [ "libc", "libffi-sys", @@ -2121,9 +2210,9 @@ dependencies = [ [[package]] name = "libffi-sys" -version = "4.1.0" +version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d4f1d4ce15091955144350b75db16a96d4a63728500122706fb4d29a26afbb" +checksum = "eab801a4ae9065bfea87f37204a7940523e752056e4a090eaaaab9b47fc826b5" dependencies = [ "cc", ] @@ -2145,23 +2234,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "754ca22de805bb5744484a5b151a9e1a8e837d5dc232c2d7d8c2e3492edc8b60" dependencies = [ "cfg-if", - "windows-link 0.2.1", + "windows-link", ] [[package]] name = "liblzma" -version = "0.4.6" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6033b77c21d1f56deeae8014eb9fbe7bdf1765185a6c508b5ca82eeaed7f899" +checksum = "aa980ea6744074a5b5e0ac6b164aca94fc970121869b3e78ae12a2b0097dbea7" dependencies = [ "liblzma-sys", ] [[package]] name = "liblzma-sys" -version = "0.4.6" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a60851d15cd8c5346eca4ab8babff585be2ae4bc8097c067291d3ffe2add3b6" +checksum = "7c7e3581f367a78d7b7e7ae948d023310556f0cfc13156c2e4e00e25616492b9" dependencies = [ "cc", "libc", @@ -2176,9 +2265,9 @@ checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "libredox" -version = "0.1.17" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f02ab6bace2054fb888a3c16f990117b579d14a3088e472d63c6011fa185c9d3" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" dependencies = [ "libc", ] @@ -2200,9 +2289,9 @@ checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "litemap" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" [[package]] name = "lock_api" @@ -2215,9 +2304,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.32" +version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a" +checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" [[package]] name = "lz4_flex" @@ -2230,12 +2319,12 @@ dependencies = [ [[package]] name = "mac_address" -version = "1.1.8" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0aeb26bf5e836cc1c341c8106051b573f1766dfa05aa87f0b98be5e51b02303" +checksum = "f3d0581a75c45969c63afd2bb87b1d8b25cfcc556c7a918cf9bb13b0fe8d2381" dependencies = [ - "nix 0.29.0", - "winapi", + "nix 0.31.3", + "windows-sys 0.61.2", ] [[package]] @@ -2296,7 +2385,7 @@ dependencies = [ "manyhow-macros", "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -2318,13 +2407,24 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" [[package]] name = "markup5ever" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8983d30f2915feeaaab2d6babdd6bc7e9ed1a00b66b5e6d74df19aa9c0e91862" +checksum = "7122d987ec5f704ee56f6e5b41a7d93722e9aae27ae07cafa4036c4d3f9757de" dependencies = [ "log", "tendril", - "web_atoms", + "web_atoms 0.2.6", +] + +[[package]] +name = "markup5ever" +version = "0.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab3dc68ac4a0f5719e560136778c1ee716e296030d75dbd4484e37e39e3a842" +dependencies = [ + "log", + "tendril", + "web_atoms 0.3.0", ] [[package]] @@ -2345,15 +2445,15 @@ dependencies = [ [[package]] name = "memchr" -version = "2.8.2" +version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" [[package]] name = "memmap2" -version = "0.9.10" +version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "714098028fe011992e1c3962653c96b2d578c4b4bce9036e15ff220319b1e0e3" +checksum = "6b0ca1155a9ecc25aa12e8313a119f32edf0255fea2f44839c4ac0a12b2ac157" dependencies = [ "libc", ] @@ -2369,9 +2469,9 @@ dependencies = [ [[package]] name = "mime" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +checksum = "d5848f5a9e8117cf94f2f90faac24a87ff81600ff8628c1e3deaab572e76bfa1" [[package]] name = "miniz_oxide" @@ -2383,11 +2483,21 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + [[package]] name = "mio" -version = "1.2.1" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda" +checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" dependencies = [ "libc", "wasi", @@ -2405,9 +2515,9 @@ dependencies = [ [[package]] name = "muda" -version = "0.19.3" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd04e60bc0b07438a6771710ee1698f98f6ebbc7f89b61264af1563b8aeb878" +checksum = "cca139e57da4383727f189e43e66e84fa372347027fc996f9f1a007ec0a37996" dependencies = [ "crossbeam-channel", "dpi", @@ -2418,9 +2528,9 @@ dependencies = [ "objc2-core-foundation", "objc2-foundation", "once_cell", - "png 0.18.1", + "png", "serde", - "thiserror 2.0.18", + "thiserror 2.0.21", "windows-sys 0.61.2", ] @@ -2430,7 +2540,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "jni-sys 0.3.1", "log", "ndk-sys", @@ -2439,6 +2549,12 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + [[package]] name = "ndk-sys" version = "0.6.0+11769913" @@ -2465,11 +2581,11 @@ dependencies = [ [[package]] name = "nix" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "cfg-if", "cfg_aliases", "libc", @@ -2478,11 +2594,11 @@ dependencies = [ [[package]] name = "nix" -version = "0.30.1" +version = "0.31.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" +checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "cfg-if", "cfg_aliases", "libc", @@ -2506,9 +2622,9 @@ checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" [[package]] name = "num-integer" -version = "0.1.46" +version = "0.1.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" dependencies = [ "num-traits", ] @@ -2548,17 +2664,17 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" dependencies = [ - "proc-macro-crate 2.0.2", + "proc-macro-crate 3.5.0", "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] name = "objc2" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f" +checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" dependencies = [ "objc2-encode", "objc2-exception-helper", @@ -2570,11 +2686,12 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "block2", "objc2", "objc2-core-foundation", "objc2-foundation", + "objc2-quartz-core", ] [[package]] @@ -2583,7 +2700,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73ad74d880bb43877038da939b7427bba67e9dd42004a18b809ba7d87cee241c" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "objc2", "objc2-foundation", ] @@ -2604,7 +2721,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "dispatch2", "objc2", ] @@ -2615,7 +2732,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "dispatch2", "objc2", "objc2-core-foundation", @@ -2648,7 +2765,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "objc2", "objc2-core-foundation", "objc2-core-graphics", @@ -2675,7 +2792,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "block2", "objc2", "objc2-core-foundation", @@ -2687,7 +2804,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "objc2", "objc2-core-foundation", ] @@ -2698,7 +2815,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "objc2", "objc2-core-foundation", "objc2-foundation", @@ -2710,7 +2827,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "block2", "objc2", "objc2-cloud-kit", @@ -2741,7 +2858,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2e5aaab980c433cf470df9d7af96a7b46a9d892d521a2cbbb2f8a4c16751e7f" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "block2", "objc2", "objc2-app-kit", @@ -2751,9 +2868,9 @@ dependencies = [ [[package]] name = "object" -version = "0.37.3" +version = "0.39.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +checksum = "2e5a6c098c7a3b6547378093f5cc30bc54fd361ce711e05293a5cc589562739b" dependencies = [ "memchr", ] @@ -2778,11 +2895,11 @@ checksum = "978aa494585d3ca4ad74929863093e87cac9790d81fe7aba2b3dc2890643a0fc" [[package]] name = "ordermap" -version = "1.2.0" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7476a5b122ff1fce7208e7ee9dccd0a516e835f5b8b19b8f3c98a34cf757c1" +checksum = "16a756ddcdeb6c0efc8927bdf0ed112885815a35ba350472a467be5104f01ca1" dependencies = [ - "indexmap 2.14.0", + "indexmap 2.14.2", ] [[package]] @@ -2840,7 +2957,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-link 0.2.1", + "windows-link", ] [[package]] @@ -2880,11 +2997,22 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" dependencies = [ - "phf_macros", + "phf_macros 0.13.1", "phf_shared 0.13.1", "serde", ] +[[package]] +name = "phf" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "010378780309880b08997fae13be7834dba947d36393bd372f2b1556deb2a2f6" +dependencies = [ + "phf_macros 0.14.0", + "phf_shared 0.14.0", + "serde", +] + [[package]] name = "phf_codegen" version = "0.11.3" @@ -2905,6 +3033,16 @@ dependencies = [ "phf_shared 0.13.1", ] +[[package]] +name = "phf_codegen" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41b585a510fb76fdebead6897982ef2a03a21d8e6cbcca904999742a4afc6ffe" +dependencies = [ + "phf_generator 0.14.0", + "phf_shared 0.14.0", +] + [[package]] name = "phf_generator" version = "0.11.3" @@ -2925,6 +3063,16 @@ dependencies = [ "phf_shared 0.13.1", ] +[[package]] +name = "phf_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeb62e0959d5a1bebc965f4d15d9e2b7cea002b6b0f5ba8cde6cc26738467100" +dependencies = [ + "fastrand", + "phf_shared 0.14.0", +] + [[package]] name = "phf_macros" version = "0.13.1" @@ -2935,7 +3083,20 @@ dependencies = [ "phf_shared 0.13.1", "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", +] + +[[package]] +name = "phf_macros" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fa8d0ca26d424d27630da600c6624696e7dec8bf7b3b492b383c5dc49e5e085" +dependencies = [ + "phf_generator 0.14.0", + "phf_shared 0.14.0", + "proc-macro2", + "quote", + "syn 2.0.119", ] [[package]] @@ -2956,6 +3117,15 @@ dependencies = [ "siphasher", ] +[[package]] +name = "phf_shared" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fd9027e2d9319be6349febd1db4e8d02aa544921200c9b777720ac34a3aa89" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project-lite" version = "0.2.17" @@ -2964,18 +3134,18 @@ checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "pkg-config" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" [[package]] name = "plist" -version = "1.9.0" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "092791278e026273c1b65bbdcfbba3a300f2994c896bd01ab01da613c29c46f1" +checksum = "327a4cb2ad49dc48adfdc9da89e22c64d488b508c67a044d71ba729e4521a285" dependencies = [ - "base64 0.22.1", - "indexmap 2.14.0", + "base64 0.23.1", + "indexmap 2.14.2", "quick-xml", "serde", "time", @@ -2989,20 +3159,7 @@ checksum = "52a40bc70c2c58040d2d8b167ba9a5ff59fc9dab7ad44771cfde3dcfde7a09c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", -] - -[[package]] -name = "png" -version = "0.17.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526" -dependencies = [ - "bitflags 1.3.2", - "crc32fast", - "fdeflate", - "flate2", - "miniz_oxide", + "syn 2.0.119", ] [[package]] @@ -3011,33 +3168,42 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "crc32fast", "fdeflate", "flate2", - "miniz_oxide", + "miniz_oxide 0.8.9", ] [[package]] name = "portable-atomic" -version = "1.13.1" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] [[package]] name = "potential_utf" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" dependencies = [ "zerovec", ] [[package]] name = "powerfmt" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" +checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" [[package]] name = "ppv-lite86" @@ -3074,6 +3240,15 @@ dependencies = [ "toml_edit 0.20.2", ] +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit 0.25.19+spec-1.1.0", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -3111,18 +3286,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.106" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" dependencies = [ "unicode-ident", ] [[package]] name = "psm" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645dbe486e346d9b5de3ef16ede18c26e6c70ad97418f4874b8b1889d6e761ea" +checksum = "4dcd034599e63b970727f70d79e02d62390a4a84f7c6b827c27c46d5ac3fa622" dependencies = [ "ar_archive_writer", "cc", @@ -3144,9 +3319,9 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd274650b21d4bfc26a0a47587962c1edb425f69287324355cd040c3ea66071c" +checksum = "229ca13b8a15bb0d1487b81ab975bfcd97513416499a8312011b6036e42e0de4" dependencies = [ "libc", "once_cell", @@ -3158,18 +3333,18 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e2a7d2f0d013342f295c048ad19237add5154a55b1c5a254c0ec93d4109078" +checksum = "70130e2b6dd1ee589a8788026a429561ca5c40fa7a2fa7914c2282eddae24700" dependencies = [ "target-lexicon 0.13.5", ] [[package]] name = "pyo3-ffi" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca85c467da1bbc8d866eea5deff9cf29ea5f7785054a17da36e65bda9c05845b" +checksum = "5e7ff73c555c286d212d4ce7e5fbda845a973c4f61bd5f160f5f2c3c2a04d1c4" dependencies = [ "libc", "pyo3-build-config", @@ -3177,42 +3352,42 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac53762fd065daa3194dd09337a38bd793a188100fd1a9304c4ab312d901771" +checksum = "c46d2e5862c7bb8207e3b639f713dda3c499933444784154c11d013c5a691b60" dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn 2.0.118", + "syn 3.0.10", ] [[package]] name = "pyo3-macros-backend" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca3a1557399783172dc5bf39cfca835157732532cba56b71d2292161e53b362" +checksum = "38b89f066f2ae72a2aef52d1537ca2fcd104440ebfadee06e97aa90738a25b9b" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.118", + "syn 3.0.10", ] [[package]] name = "quick-xml" -version = "0.39.4" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdcc8dd4e2f670d309a5f0e83fe36dfdc05af317008fea29144da1a2ac858e5e" +checksum = "41b1177fdf999d2321d3fb46ff47159d9c1fb9ad66a4879f8c50a0b504615e9b" dependencies = [ "memchr", ] [[package]] name = "quote" -version = "1.0.45" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" dependencies = [ "proc-macro2", ] @@ -3236,7 +3411,7 @@ dependencies = [ "proc-macro-utils", "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -3272,9 +3447,9 @@ dependencies = [ [[package]] name = "rand" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" dependencies = [ "libc", "rand_chacha", @@ -3321,45 +3496,44 @@ version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", ] [[package]] name = "redox_users" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" +checksum = "60dc65c0ff1a7ae1294b0c67b9f14baf70b644404010370171787bfac1038fc0" dependencies = [ - "getrandom 0.2.17", "libredox", - "thiserror 2.0.18", + "thiserror 2.0.21", ] [[package]] name = "ref-cast" -version = "1.0.25" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" +checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.25" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" +checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 3.0.10", ] [[package]] name = "regex" -version = "1.12.4" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" dependencies = [ "aho-corasick", "memchr", @@ -3369,9 +3543,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.14" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" dependencies = [ "aho-corasick", "memchr", @@ -3386,11 +3560,11 @@ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" [[package]] name = "reqwest" -version = "0.13.4" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "219c5811de6525e5416c7d5d53bb656d3afdbc6c5af816e0802bcfa42dbdc1c3" +checksum = "16a1cfa75cc186dd73d5818e510e042e40927bccc9c236b061cea97e1eb08029" dependencies = [ - "base64 0.22.1", + "base64 0.23.1", "bytes", "futures-core", "futures-util", @@ -3436,14 +3610,14 @@ dependencies = [ "pmutil", "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] name = "rustc-hash" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" [[package]] name = "rustc_version" @@ -3456,11 +3630,11 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.4" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "errno", "libc", "linux-raw-sys", @@ -3474,8 +3648,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12e4fc1331357a7afc6d52d637796a946b1efaaca07c914132f8fd4fd69d595f" dependencies = [ "ahash", - "bitflags 2.13.0", - "indexmap 2.14.0", + "bitflags 2.13.2", + "indexmap 2.14.2", "itertools", "log", "malachite-bigint", @@ -3487,7 +3661,7 @@ dependencies = [ "rustpython-ruff_python_ast", "rustpython-ruff_text_size", "rustpython-wtf8", - "thiserror 2.0.18", + "thiserror 2.0.21", "unicode_names2 2.0.0", ] @@ -3498,7 +3672,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f3c0808a170ea900e0489a06d6aa04ce5d27d62b347836c2f98df958f47f243" dependencies = [ "ascii", - "bitflags 2.13.0", + "bitflags 2.13.2", "cfg-if", "getrandom 0.3.4", "itertools", @@ -3532,7 +3706,7 @@ dependencies = [ "rustpython-ruff_python_parser", "rustpython-ruff_source_file", "rustpython-ruff_text_size", - "thiserror 2.0.18", + "thiserror 2.0.21", ] [[package]] @@ -3541,7 +3715,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9f18ba67b55aec49c3e2d223bbdcacff0d7e0f5d304fb0e64b044b8dca13c7c" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "bitflagset", "itertools", "lz4_flex", @@ -3559,7 +3733,7 @@ checksum = "6ba6c04350bee9e54b241b93675a0558c2b33fe982213e47a6da0924898af0f2" dependencies = [ "rustpython-compiler", "rustpython-derive-impl", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -3574,7 +3748,7 @@ dependencies = [ "quote", "rustpython-compiler-core", "rustpython-doc", - "syn 2.0.118", + "syn 2.0.119", "syn-ext", "textwrap", ] @@ -3602,6 +3776,17 @@ dependencies = [ "unic-ucd-category", ] +[[package]] +name = "rustpython-pylib" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f1878a8c2fb45dfcbcee1d4bba8d4a3d9b65c4f20dc70d08179c3efa223bbab" +dependencies = [ + "glob", + "rustpython-compiler-core", + "rustpython-derive", +] + [[package]] name = "rustpython-ruff_python_ast" version = "0.15.8" @@ -3609,7 +3794,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f021ff72cabf5e2cd6d8ec8813d376a8445a228dc610ab56c27bd9054cda70d4" dependencies = [ "aho-corasick", - "bitflags 2.13.0", + "bitflags 2.13.2", "compact_str", "get-size2", "is-macro", @@ -3618,7 +3803,7 @@ dependencies = [ "rustpython-ruff_python_trivia", "rustpython-ruff_source_file", "rustpython-ruff_text_size", - "thiserror 2.0.18", + "thiserror 2.0.21", ] [[package]] @@ -3627,7 +3812,7 @@ version = "0.15.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01e6ee78bd9671fb5766664b2695fe1f2a92a961f4d9101646c570d8acdb1e0b" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "bstr", "compact_str", "get-size2", @@ -3679,7 +3864,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad4b7bd82b2a531f7c2ad96864ce11285959fc7d8524f1ba54db8ce3a23a3d2c" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "num_enum", "optional", "rustpython-wtf8", @@ -3710,7 +3895,7 @@ dependencies = [ "gethostname", "hex", "hmac", - "indexmap 2.14.0", + "indexmap 2.14.2", "itertools", "libc", "liblzma", @@ -3770,7 +3955,7 @@ checksum = "1880770161cef896bf9c7e065dae574e3b4c3cf6172e485f1ce86f0483816ab2" dependencies = [ "ahash", "ascii", - "bitflags 2.13.0", + "bitflags 2.13.2", "bstr", "caseless", "cfg-if", @@ -3783,7 +3968,7 @@ dependencies = [ "glob", "half", "hex", - "indexmap 2.14.0", + "indexmap 2.14.2", "is-macro", "itertools", "junction", @@ -3822,7 +4007,7 @@ dependencies = [ "static_assertions", "strum", "strum_macros", - "thiserror 2.0.18", + "thiserror 2.0.21", "timsort", "uname", "unic-ucd-bidi", @@ -3849,9 +4034,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" [[package]] name = "rustyline" @@ -3859,7 +4044,7 @@ version = "17.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e902948a25149d50edc1a8e0141aad50f54e22ba83ff988cf8f7c9ef07f50564" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "cfg-if", "clipboard-win", "fd-lock", @@ -3883,9 +4068,9 @@ checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" [[package]] name = "safe_arch" -version = "1.0.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f7caad094bd561859bcd467734a720c3c1f5d1f338995351fefe2190c45efed" +checksum = "42c6efa15875e6ecb39ca61fb0b0c1a40b84fac5a5ffe71eef7d1000c8eb3f5f" dependencies = [ "bytemuck", ] @@ -3901,9 +4086,9 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.29" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" +checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5" dependencies = [ "windows-sys 0.61.2", ] @@ -3937,9 +4122,9 @@ dependencies = [ [[package]] name = "schemars" -version = "1.2.1" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc" +checksum = "ab508826f74a77ca9d5aba6ff19b522583ee3eaf28a19384ff3d0e5835fadf6e" dependencies = [ "dyn-clone", "ref-cast", @@ -3956,7 +4141,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -3973,12 +4158,12 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "selectors" -version = "0.36.1" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5d9c0c92a92d33f08817311cf3f2c29a3538a8240e94a6a3c622ce652d7e00c" +checksum = "8adfa1c298912827b8a28b223b3b874357397ae706e6190acd9bf28cee99114d" dependencies = [ - "bitflags 2.13.0", - "cssparser", + "bitflags 2.13.2", + "cssparser 0.37.0", "derive_more", "log", "new_debug_unreachable", @@ -3986,7 +4171,24 @@ dependencies = [ "phf_codegen 0.13.1", "precomputed-hash", "rustc-hash", - "servo_arc", + "servo_arc 0.4.3", + "smallvec", +] + +[[package]] +name = "selectors" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8322aebea94a6cc288ff884e8a49bdbceef60206c400c6c46d22e62fc4fd91a6" +dependencies = [ + "bitflags 2.13.2", + "cssparser 0.38.0", + "derive_more", + "log", + "new_debug_unreachable", + "precomputed-hash", + "rustc-hash", + "servo_arc 0.5.0", "smallvec", ] @@ -4002,9 +4204,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.228" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" dependencies = [ "serde_core", "serde_derive", @@ -4024,22 +4226,22 @@ dependencies = [ [[package]] name = "serde_core" -version = "1.0.228" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.228" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 3.0.10", ] [[package]] @@ -4050,14 +4252,14 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] name = "serde_json" -version = "1.0.150" +version = "1.0.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" dependencies = [ "itoa", "memchr", @@ -4068,13 +4270,13 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.20" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" +checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 3.0.10", ] [[package]] @@ -4088,27 +4290,28 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "1.1.1" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" +checksum = "9c187e0a369471c550af028cba56d4f4fa2a489ad28151ae95a4d340a2a8b782" dependencies = [ "serde_core", ] [[package]] name = "serde_with" -version = "3.21.0" +version = "3.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a5c54c7310e7b8b9577c286d7e399ddd876c3e12b3ed917a8aabc4b96e9e8c" +checksum = "df9adc193c780ef8f159aee8b61e2d5801aaa555e6eb0947fe45530ec506296f" dependencies = [ - "base64 0.22.1", + "base64 0.23.1", "bs58", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.14.0", + "indexmap 2.14.2", + "jiff", "schemars 0.9.0", - "schemars 1.2.1", + "schemars 1.2.3", "serde_core", "serde_json", "serde_with_macros", @@ -4117,14 +4320,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.21.0" +version = "3.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84d57bc0c8b9a17920c178daa6bb924850d54a9c97ab45194bb8c17ad66bb660" +checksum = "3e17bbc68e28663bbbb90df47e058aa7eda4fb445b89fe70457bb94fbccf6e49" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.118", + "syn 3.0.10", ] [[package]] @@ -4146,7 +4349,7 @@ checksum = "772ee033c0916d670af7860b6e1ef7d658a4629a6d0b4c8c3e67f09b3765b75d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -4158,6 +4361,15 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "servo_arc" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4eceb519ec34d8290aaf6e46f435102f2bfa63f22b05a144fb16ab266d3b198" +dependencies = [ + "stable_deref_trait", +] + [[package]] name = "sha-1" version = "0.10.1" @@ -4208,15 +4420,15 @@ dependencies = [ [[package]] name = "simd-adler32" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" [[package]] name = "siphasher" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649" +checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" [[package]] name = "slab" @@ -4226,15 +4438,15 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smallvec" -version = "1.15.2" +version = "1.16.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90" +checksum = "149309498a5f7334b12ddae0cad8aba81ce785fe91755068867e017cf98fee46" [[package]] name = "socket2" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" dependencies = [ "libc", "windows-sys 0.61.2", @@ -4300,6 +4512,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "static_vcruntime" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff7589a1859b09232522bb9edf076ca7fcf14ded96685d3fa629db73023ffbb7" + [[package]] name = "string_cache" version = "0.9.0" @@ -4312,6 +4530,18 @@ dependencies = [ "precomputed-hash", ] +[[package]] +name = "string_cache" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffa8a5dbe8b3f0bbe29d4c3225daafaeead63afdc1b65fc4c01a1384166038e6" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared 0.14.0", + "precomputed-hash", +] + [[package]] name = "string_cache_codegen" version = "0.6.1" @@ -4324,6 +4554,18 @@ dependencies = [ "quote", ] +[[package]] +name = "string_cache_codegen" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928dcdf75e47626b3617a976ec205d9f057584c371c1f23b782129268d0e6edc" +dependencies = [ + "phf_generator 0.14.0", + "phf_shared 0.14.0", + "proc-macro2", + "quote", +] + [[package]] name = "strsim" version = "0.11.1" @@ -4345,7 +4587,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -4356,9 +4598,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "swift-rs" -version = "1.0.7" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4057c98e2e852d51fdcfca832aac7b571f6b351ad159f9eda5db1655f8d0c4d7" +checksum = "cefd87076fd385308ee4aff597256c902f1fbb4d031de1558efc12f8ffefadd9" dependencies = [ "base64 0.21.7", "serde", @@ -4377,9 +4619,20 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.118" +version = "2.0.119" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" dependencies = [ "proc-macro2", "quote", @@ -4388,13 +4641,13 @@ dependencies = [ [[package]] name = "syn-ext" -version = "0.5.0" +version = "0.5.1+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b126de4ef6c2a628a68609dd00733766c3b015894698a438ebdf374933fc31d1" +checksum = "a0d85a9541ea8696f63d423c4f13cc186980770d35a0a8a4e1939011b09c780f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -4408,13 +4661,13 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.13.2" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 3.0.10", ] [[package]] @@ -4423,7 +4676,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "core-foundation 0.9.4", "system-configuration-sys", ] @@ -4453,11 +4706,11 @@ dependencies = [ [[package]] name = "tao" -version = "0.35.3" +version = "0.37.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1c93047acf68669466a34690ac58cca7010bd1b201e1ec86f1fd0a75d3dd4a9" +checksum = "d5777b06fe6435126ae8d816eba269e050e1e10d302cf5461e9c49eccabc3548" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "block2", "core-foundation 0.10.1", "core-graphics", @@ -4473,12 +4726,12 @@ dependencies = [ "libc", "log", "ndk", + "ndk-context", "ndk-sys", "objc2", "objc2-app-kit", "objc2-foundation", "objc2-ui-kit", - "once_cell", "parking_lot", "percent-encoding", "raw-window-handle", @@ -4493,13 +4746,13 @@ dependencies = [ [[package]] name = "tao-macros" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4e16beb8b2ac17db28eab8bca40e62dbfbb34c0fcdc6d9826b11b7b5d047dfd" +checksum = "5f7eeb6d99155545da6150a1795945f16ac9c178deb2a5f2e74d776107bd5849" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -4516,9 +4769,9 @@ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca" [[package]] name = "tauri" -version = "2.11.3" +version = "2.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2616f96cb644bf2c5c456d9de4d5d5100e592d7424c74d8b55c5cb96e359e93" +checksum = "5fb0244332cfb9cee7e2a568bf5da29a36ed8fdbd717f6f47a66b6b7b358c072" dependencies = [ "anyhow", "bytes", @@ -4555,7 +4808,7 @@ dependencies = [ "tauri-runtime", "tauri-runtime-wry", "tauri-utils", - "thiserror 2.0.18", + "thiserror 2.0.21", "tokio", "tray-icon", "url", @@ -4567,9 +4820,9 @@ dependencies = [ [[package]] name = "tauri-build" -version = "2.6.3" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc9ce40b16101cb6ea63d3e221567affd1c3a9205f95d7bc574941a10636b632" +checksum = "adddb0e648752aaac5da9c3c3c6a68e1e87cab55e3b757b18a9441ef8c3ac614" dependencies = [ "anyhow", "cargo_toml", @@ -4581,6 +4834,8 @@ dependencies = [ "semver", "serde", "serde_json", + "static_vcruntime", + "strsim", "tauri-utils", "tauri-winres", "walkdir", @@ -4588,25 +4843,25 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "2.6.3" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08279169ff42f8fc45a1dbc9dcae888893ba95288142e5880c59b93a26d2cfc5" +checksum = "fb37631cf71dab5e8ab55e1bdd701e18a52653d90b78e71d0e5598b1e0a61316" dependencies = [ - "base64 0.22.1", + "base64 0.23.1", "brotli", "ico", "json-patch", "plist", - "png 0.17.16", + "png", "proc-macro2", "quote", "semver", "serde", "serde_json", "sha2", - "syn 2.0.118", + "syn 2.0.119", "tauri-utils", - "thiserror 2.0.18", + "thiserror 2.0.21", "time", "url", "uuid", @@ -4615,23 +4870,23 @@ dependencies = [ [[package]] name = "tauri-macros" -version = "2.6.3" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8b394794f399a421811d06966343e7933fcae92d59f5180b9388d1174497a45" +checksum = "0cc38db58854c10fb5f91a887ed8bf82d3239bb92b5d8db86eda09e96d9963d1" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", "tauri-codegen", "tauri-utils", ] [[package]] name = "tauri-plugin" -version = "2.6.3" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74be5dd4bed9afbd145e5716b5fa2ec28cbc29c34ffa61c258c9273d896c8020" +checksum = "67fb21a77e8f94e8beb3325e583102488659365af0a3948b7ea244c5b779c291" dependencies = [ "anyhow", "glob", @@ -4645,7 +4900,7 @@ dependencies = [ [[package]] name = "tauri-plugin-python" -version = "0.3.9" +version = "0.4.0" dependencies = [ "async-trait", "async_py", @@ -4654,15 +4909,16 @@ dependencies = [ "serde_json", "tauri", "tauri-plugin", - "thiserror 2.0.18", + "tempfile", + "thiserror 2.0.21", "tokio", ] [[package]] name = "tauri-runtime" -version = "2.11.3" +version = "2.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0b4bc95aed361b0019067d189a1174a603d460d0f6c72606512d59fc9c12ec8" +checksum = "7c55766d99cea69055904d1735b93c2049302b2e09effd462120deb5581d78e9" dependencies = [ "cookie", "dpi", @@ -4676,7 +4932,7 @@ dependencies = [ "serde", "serde_json", "tauri-utils", - "thiserror 2.0.18", + "thiserror 2.0.21", "url", "webkit2gtk", "webview2-com", @@ -4685,9 +4941,9 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" -version = "2.11.3" +version = "2.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe41e015bf8fc4d6477ff4926a0ef769dc64ff34c7b0038b6f7cacae892acb5c" +checksum = "e1aa9d8b7a120f879f44fdc1053f7b7dbf416bf0bbc6a72b714dec46b782b52f" dependencies = [ "gtk", "http", @@ -4695,7 +4951,6 @@ dependencies = [ "log", "objc2", "objc2-app-kit", - "once_cell", "percent-encoding", "raw-window-handle", "softbuffer", @@ -4711,15 +4966,15 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "2.9.3" +version = "2.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e176a18e67764923c4f1ce66f25ae4abe5f688384d5eb1a0fa6c77f3d90f887" +checksum = "362ab21cd4cc713f2a02b1a9b5688198b1541cfb6907c4281e9190e0f0ef4aa3" dependencies = [ "anyhow", "brotli", "cargo_metadata", "ctor", - "dom_query", + "dom_query 0.28.0", "dunce", "glob", "http", @@ -4739,8 +4994,8 @@ dependencies = [ "serde_json", "serde_with", "swift-rs", - "thiserror 2.0.18", - "toml 1.1.2+spec-1.1.0", + "thiserror 2.0.21", + "toml 1.2.1+spec-1.1.0", "url", "urlpattern", "uuid", @@ -4749,23 +5004,35 @@ dependencies = [ [[package]] name = "tauri-winres" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc65d45c68858bfe420dd29e834b5d15dbecf8a07a8a16cf4d532c7b1f69d4b6" +checksum = "c52bb6904475a6ca662f15ef787f18ade61d5740a1ee12c45d3b748efdb6f796" dependencies = [ "dunce", "embed-resource", - "toml 1.1.2+spec-1.1.0", + "toml 1.2.1+spec-1.1.0", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.3", + "once_cell", + "rustix", + "windows-sys 0.61.2", ] [[package]] name = "tendril" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4790fc369d5a530f4b544b094e31388b9b3a37c0f4652ade4505945f5660d24" +checksum = "5fed54709c5b3a53d09bb1c113ea4f5ceafd1e772ddcb0030a82e1d56c087b08" dependencies = [ "new_debug_unreachable", - "utf-8", ] [[package]] @@ -4779,9 +5046,9 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.16.2" +version = "0.16.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057" +checksum = "6ecfad6c3abc80a577f2b91c1e412ee57e7a060d430b553c1b0c940974ebcd49" [[package]] name = "thiserror" @@ -4794,11 +5061,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.18" +version = "2.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" dependencies = [ - "thiserror-impl 2.0.18", + "thiserror-impl 2.0.21", ] [[package]] @@ -4809,25 +5076,25 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] name = "thiserror-impl" -version = "2.0.18" +version = "2.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 3.0.10", ] [[package]] name = "time" -version = "0.3.49" +version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711a53c2d47bbd818258c498c8dbfe186a2526c631495cfe7e078567f86b8469" +checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" dependencies = [ "deranged", "num-conv", @@ -4845,9 +5112,9 @@ checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" [[package]] name = "time-macros" -version = "0.2.29" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71c652a3727a9cbb9a02f707f530b618ce00d0ccd762009c8c23bd191df3c17d" +checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" dependencies = [ "num-conv", "time-core", @@ -4861,9 +5128,9 @@ checksum = "639ce8ef6d2ba56be0383a94dd13b92138d58de44c62618303bb798fa92bdc00" [[package]] name = "tinystr" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" dependencies = [ "displaydoc", "zerovec", @@ -4871,24 +5138,15 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" +version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" [[package]] name = "tokio" -version = "1.52.3" +version = "1.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" dependencies = [ "bytes", "libc", @@ -4903,20 +5161,20 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.7.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 3.0.10", ] [[package]] name = "tokio-util" -version = "0.7.18" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b" dependencies = [ "bytes", "futures-core", @@ -4939,32 +5197,17 @@ dependencies = [ [[package]] name = "toml" -version = "0.9.12+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" -dependencies = [ - "indexmap 2.14.0", - "serde_core", - "serde_spanned 1.1.1", - "toml_datetime 0.7.5+spec-1.1.0", - "toml_parser", - "toml_writer", - "winnow 0.7.15", -] - -[[package]] -name = "toml" -version = "1.1.2+spec-1.1.0" +version = "1.2.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee" +checksum = "d5755c51863cdac711f1956baf8eb9588e060755f7d3c4c979e70ea1e1f32cd7" dependencies = [ - "indexmap 2.14.0", + "indexmap 2.14.2", "serde_core", - "serde_spanned 1.1.1", - "toml_datetime 1.1.1+spec-1.1.0", + "serde_spanned 1.1.3", + "toml_datetime 1.1.3+spec-1.1.0", "toml_parser", "toml_writer", - "winnow 1.0.3", + "winnow 1.0.5", ] [[package]] @@ -4978,18 +5221,9 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.7.5+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" -dependencies = [ - "serde_core", -] - -[[package]] -name = "toml_datetime" -version = "1.1.1+spec-1.1.0" +version = "1.1.3+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +checksum = "173f25c883cd2176a2d8212155638c0a60d484a9d84546d270866f40f56b6e49" dependencies = [ "serde_core", ] @@ -5000,7 +5234,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.14.0", + "indexmap 2.14.2", "toml_datetime 0.6.3", "winnow 0.5.40", ] @@ -5011,27 +5245,39 @@ version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ - "indexmap 2.14.0", + "indexmap 2.14.2", "serde", "serde_spanned 0.6.9", "toml_datetime 0.6.3", "winnow 0.5.40", ] +[[package]] +name = "toml_edit" +version = "0.25.19+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd43688c4858d7264ae1cf9a9f874a67c3feb74a883b1cd7bebd6a4ea8307218" +dependencies = [ + "indexmap 2.14.2", + "toml_datetime 1.1.3+spec-1.1.0", + "toml_parser", + "winnow 1.0.5", +] + [[package]] name = "toml_parser" -version = "1.1.2+spec-1.1.0" +version = "1.1.5+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" +checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" dependencies = [ - "winnow 1.0.3", + "winnow 1.0.5", ] [[package]] name = "toml_writer" -version = "1.1.1+spec-1.1.0" +version = "1.2.0+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" +checksum = "009dbb7700f11c55ef83aebbe4c0e9cf1f1ac0844bd8d6f00dc38f302026e13a" [[package]] name = "tower" @@ -5054,7 +5300,7 @@ version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.2", "bytes", "futures-util", "http", @@ -5099,9 +5345,9 @@ dependencies = [ [[package]] name = "tray-icon" -version = "0.24.1" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65ba1e5f6b9ef9fd87e21b9c6f351554dbd717960089168fcfdef854686961dc" +checksum = "b2b9c52859a94554803ccd4a24b98f74148ebc73b90676d783f3490b1bff9d72" dependencies = [ "crossbeam-channel", "dirs", @@ -5113,9 +5359,9 @@ dependencies = [ "objc2-core-graphics", "objc2-foundation", "once_cell", - "png 0.18.1", + "png", "serde", - "thiserror 2.0.18", + "thiserror 2.0.21", "windows-sys 0.61.2", ] @@ -5127,9 +5373,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "twox-hash" -version = "2.1.2" +version = "2.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea3136b675547379c4bd395ca6b938e5ad3c3d20fad76e7fe85f9e0d011419c" +checksum = "86a801b3cea342a06d468c8710662aa29e5e05e4f5c0d62f00bbb7f2ad7941c2" [[package]] name = "typeid" @@ -5277,15 +5523,15 @@ checksum = "061dbb8cc7f108532b6087a0065eff575e892a4bcb503dc57323a197457cc202" [[package]] name = "unicode-ident" -version = "1.0.24" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" [[package]] name = "unicode-normalization" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" +checksum = "75cd3fb03d5288b3ba9a1ee103ac7e9cbb59f0b03d64f8ddfcc04dd42758a85d" dependencies = [ "tinyvec", ] @@ -5298,9 +5544,9 @@ checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" [[package]] name = "unicode-width" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" +checksum = "ca718471876992059f251e33aafc334346ada08042b7661dd1fe313a9bced557" [[package]] name = "unicode_names2" @@ -5359,27 +5605,24 @@ dependencies = [ [[package]] name = "urlpattern" -version = "0.3.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70acd30e3aa1450bc2eece896ce2ad0d178e9c079493819301573dae3c37ba6d" +checksum = "df16f50ef4cc145211879a3867ba757076b25dfee812040dcb0658bd9ae7904b" dependencies = [ + "icu_properties", "regex", "serde", - "unic-ucd-ident", "url", ] -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - [[package]] name = "utf8_iter" -version = "1.0.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" +checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0" +dependencies = [ + "utf_types", +] [[package]] name = "utf8parse" @@ -5387,11 +5630,17 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "utf_types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6" + [[package]] name = "uuid" -version = "1.23.3" +version = "1.29.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "144d6b123cef80b301b8f72a9e2ca4370ddec21950d0a103dd22c437006d2db7" +checksum = "bed99139f7dac9b5cfe5f17be4d66dc7079a34dee1d74bcc77217119240e267c" dependencies = [ "atomic", "getrandom 0.4.3", @@ -5444,9 +5693,9 @@ dependencies = [ [[package]] name = "want" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" dependencies = [ "try-lock", ] @@ -5468,12 +5717,11 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.125" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ddb3f79143bced6de84270411622a2699cee572fc0875aeaf1e7867cf9fca1a" +checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c" dependencies = [ "cfg-if", - "once_cell", "rustversion", "wasm-bindgen-macro", "wasm-bindgen-shared", @@ -5481,19 +5729,20 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.75" +version = "0.4.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "503b14d284f2c8dac03b819967e155ea753f573586193b2b2c95990cb5d69280" +checksum = "5e14e0327cb5368ad60ccb22d04a9827a693c95a926d8d125e9fa39e0baec501" dependencies = [ "js-sys", + "tokio", "wasm-bindgen", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.125" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e21a184b13fb19e157296e2c46056aec9092264fab83e4ba59e68c61b323c3d" +checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5501,22 +5750,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.125" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fecefd9c35bd935a20fc3fc344b5f29138961e4f47fb03297d88f2587afb5ebd" +checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a" dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.118", + "syn 3.0.10", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.125" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23939e44bb9a5d7576fa2b563dc2e136628f1224e88a8deed09e04858b77871f" +checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e" dependencies = [ "unicode-ident", ] @@ -5536,9 +5785,19 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.102" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7d179596ff5ec0f6de4db64d54011bde6289cc49603d3a6e4ce3f329207ab88" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6430a72df5eb332242960fe84b3002a241163998241eb596d4f739b9757061d" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ "js-sys", "wasm-bindgen", @@ -5546,14 +5805,26 @@ dependencies = [ [[package]] name = "web_atoms" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "075474b12bcb3d2e3d4546580e9de478eeeead668a1761e2a8860c836b7ef297" +checksum = "ba8b815c1b593dc0baf78dd0f4fc8fdb2de53198fb1163738093e9a311c33fb3" dependencies = [ "phf 0.13.1", "phf_codegen 0.13.1", - "string_cache", - "string_cache_codegen", + "string_cache 0.9.0", + "string_cache_codegen 0.6.1", +] + +[[package]] +name = "web_atoms" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7572660c8890448ba236b7376f27e389c6a7e1c70195622faced601f855c0ada" +dependencies = [ + "phf 0.14.0", + "phf_codegen 0.14.0", + "string_cache 0.11.0", + "string_cache_codegen 0.11.2", ] [[package]] @@ -5602,16 +5873,14 @@ dependencies = [ [[package]] name = "webview2-com" -version = "0.38.2" +version = "0.39.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7130243a7a5b33c54a444e54842e6a9e133de08b5ad7b5861cd8ed9a6a5bc96a" +checksum = "3f89fca7a704cee10dcb3654c1dbb8941d1783132f1917358af75bec37a7d7e6" dependencies = [ "webview2-com-macros", "webview2-com-sys", "windows", "windows-core", - "windows-implement", - "windows-interface", ] [[package]] @@ -5622,34 +5891,34 @@ checksum = "67a921c1b6914c367b2b823cd4cde6f96beec77d30a939c8199bb377cf9b9b54" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] name = "webview2-com-sys" -version = "0.38.2" +version = "0.39.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "381336cfffd772377d291702245447a5251a2ffa5bad679c99e61bc48bacbf9c" +checksum = "b3a07132775117d6065853d9d1178157b8c90e228de47129d6bce2c7edebedfb" dependencies = [ - "thiserror 2.0.18", + "thiserror 2.0.21", "windows", "windows-core", ] [[package]] name = "which" -version = "8.0.4" +version = "8.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d7cd18d4acb58fb3cdfe9ea54e6cd96a4e7d4cc45c56338b236e82dad47248" +checksum = "bae2f2b2b816647a1cab1acc91f5bd20812d53cb344382635ec2181940c8034f" dependencies = [ "libc", ] [[package]] name = "wide" -version = "1.5.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfdfe6a32973f2d1b268b8895845a8a96cac2f0191e72c27cc929036060dbf89" +checksum = "d920ac99c3c8edce110cb8d07dbb324d6d026011dce85b1e9355b70f0adacc4f" dependencies = [ "bytemuck", "safe_arch", @@ -5694,62 +5963,62 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "window-vibrancy" -version = "0.6.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9bec5a31f3f9362f2258fd0e9c9dd61a9ca432e7306cc78c444258f0dce9a9c" +checksum = "111e51caca442cafd9bab396628ac4d814880eaea4e63dfd76a12e9f342b5580" dependencies = [ "objc2", "objc2-app-kit", "objc2-core-foundation", "objc2-foundation", + "objc2-quartz-core", "raw-window-handle", - "windows-sys 0.59.0", + "windows-sys 0.61.2", "windows-version", ] [[package]] name = "windows" -version = "0.61.3" +version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link 0.1.3", "windows-numerics", ] [[package]] name = "windows-collections" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" dependencies = [ "windows-core", ] [[package]] name = "windows-core" -version = "0.61.2" +version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ "windows-implement", "windows-interface", - "windows-link 0.1.3", + "windows-link", "windows-result", "windows-strings", ] [[package]] name = "windows-future" -version = "0.2.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" dependencies = [ "windows-core", - "windows-link 0.1.3", + "windows-link", "windows-threading", ] @@ -5761,7 +6030,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -5772,15 +6041,9 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] -[[package]] -name = "windows-link" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" - [[package]] name = "windows-link" version = "0.2.1" @@ -5789,30 +6052,30 @@ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] name = "windows-numerics" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" dependencies = [ "windows-core", - "windows-link 0.1.3", + "windows-link", ] [[package]] name = "windows-result" -version = "0.3.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ - "windows-link 0.1.3", + "windows-link", ] [[package]] name = "windows-strings" -version = "0.4.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ - "windows-link 0.1.3", + "windows-link", ] [[package]] @@ -5848,7 +6111,7 @@ version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ - "windows-link 0.2.1", + "windows-link", ] [[package]] @@ -5888,7 +6151,7 @@ version = "0.53.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" dependencies = [ - "windows-link 0.2.1", + "windows-link", "windows_aarch64_gnullvm 0.53.1", "windows_aarch64_msvc 0.53.1", "windows_i686_gnu 0.53.1", @@ -5901,11 +6164,11 @@ dependencies = [ [[package]] name = "windows-threading" -version = "0.1.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" dependencies = [ - "windows-link 0.1.3", + "windows-link", ] [[package]] @@ -5914,7 +6177,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4060a1da109b9d0326b7262c8e12c84df67cc0dbc9e33cf49e01ccc2eb63631" dependencies = [ - "windows-link 0.2.1", + "windows-link", ] [[package]] @@ -6066,24 +6329,21 @@ dependencies = [ [[package]] name = "winnow" -version = "0.7.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" - -[[package]] -name = "winnow" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1" +checksum = "8c3b93199df0ab874cdf0c6a94f0a0dc3423fe41f1cafb62b8bd7b1deb277aef" +dependencies = [ + "memchr", +] [[package]] name = "winreg" -version = "0.55.0" +version = "0.56.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb5a765337c50e9ec252c2069be9bf91c7df47afb103b642ba3a53bf8101be97" +checksum = "7d6f32a0ff4a9f6f01231eb2059cc85479330739333e0e58cadf03b6af2cca10" dependencies = [ "cfg-if", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -6094,22 +6354,22 @@ checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" [[package]] name = "writeable" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" [[package]] name = "wry" -version = "0.55.1" +version = "0.57.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "186f9871daa55fd9c016578b810d149de58367113db7fb72b462d2323ce19514" +checksum = "a490119196d02a51d0871df7b9119a1f3e46d75b7e90053a801454d5c6b3491c" dependencies = [ - "base64 0.22.1", + "base64 0.23.1", "block2", "cookie", "crossbeam-channel", "dirs", - "dom_query", + "dom_query 0.29.0", "dpi", "dunce", "gdkx11", @@ -6125,13 +6385,12 @@ dependencies = [ "objc2-foundation", "objc2-ui-kit", "objc2-web-kit", - "once_cell", "percent-encoding", "raw-window-handle", "sha2", "soup3", "tao-macros", - "thiserror 2.0.18", + "thiserror 2.0.21", "url", "webkit2gtk", "webkit2gtk-sys", @@ -6165,15 +6424,15 @@ dependencies = [ [[package]] name = "xml" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "636f85e5ca6488e96401b61eb7de54f4e44755c988af0f52cf90230c312a1a89" +checksum = "2f45bb2c13fec6a6cb4c0f76a7e94839e110a14ec803ec2940777a94c347bc52" [[package]] name = "yoke" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" dependencies = [ "stable_deref_trait", "yoke-derive", @@ -6182,34 +6441,34 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 3.0.10", "synstructure", ] [[package]] name = "zerocopy" -version = "0.8.52" +version = "0.8.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce1022995ff5ff5d841ad7d994facc23098cd40152f2c1d11cd607c6f530653f" +checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.52" +version = "0.8.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ae7f38b72ec2a254e2b87ef277cf2cd4fb97cbebf944faa6f33354da0867930" +checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 2.0.119", ] [[package]] @@ -6223,21 +6482,21 @@ dependencies = [ [[package]] name = "zerofrom-derive" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 3.0.10", "synstructure", ] [[package]] name = "zerotrie" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" dependencies = [ "displaydoc", "yoke", @@ -6246,9 +6505,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.11.6" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" dependencies = [ "yoke", "zerofrom", @@ -6257,13 +6516,13 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.11.3" +version = "0.11.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.118", + "syn 3.0.10", ] [[package]] @@ -6274,12 +6533,12 @@ checksum = "40990edd51aae2c2b6907af74ffb635029d5788228222c4bb811e9351c0caad3" [[package]] name = "zlib-rs" -version = "0.6.3" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be3d40e40a133f9c916ee3f9f4fa2d9d63435b5fbe1bfc6d9dae0aa0ada1513" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" [[package]] name = "zmij" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/Cargo.toml b/Cargo.toml index edaf445..bc2d7c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,11 @@ [package] name = "tauri-plugin-python" -version = "0.3.9" +version = "0.4.0" authors = [ "Marco Mengelkoch" ] description = "A tauri 2 plugin to use python code in the backend." keywords = ["rust", "python", "tauri", "gui"] -edition = "2021" +edition = "2024" +rust-version = "1.88" exclude = ["/examples", "/webview-dist", "/webview-src", "/node_modules"] links = "tauri-plugin-python" license = "MIT" @@ -17,7 +18,7 @@ serde = { version = "1", features = ["derive"] } thiserror = "2" async-trait = "0.1" -async_py = { version = "0.3.2", default-features = false } +async_py = { version = "0.4.1", default-features = false } tokio = { version = "1", features = ["full"] } serde_json = "1.0.136" dunce = "1.0.5" @@ -31,6 +32,7 @@ tauri-plugin = { version = "2", features = ["build"] } [dev-dependencies] tauri = { version = "2", features = ["test"] } +tempfile = "3" [features] venv = [] diff --git a/README.md b/README.md index 3e6c626..a423323 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,12 @@ # Tauri Plugin Python This [tauri](https://v2.tauri.app/) v2 plugin is supposed to make it easy to use Python as backend code. -It can use either [PyO3](https://pyo3.rs) (the default) or [RustPython](https://github.com/RustPython/RustPython) as the interpreter to call python from rust. +It can use either [PyO3](https://pyo3.rs) (the default) or [RustPython](https://github.com/RustPython/RustPython) as the interpreter to call python from rust. +The companion [`tauri-plugin-python-cli`](#deployment-tool-tauri-plugin-python-cli) bundles a standalone Python into your app, so releases run on machines without Python. -> **Requirements:** Tauri **v2**, a recent stable Rust toolchain, and (for the default PyO3 backend) a CPython -> interpreter available when you build and run. The [example apps](#example-app) are the canonical, always-current -> reference if anything below drifts out of date. +> **Requirements:** Tauri **v2**, a recent stable Rust toolchain and, for the default PyO3 backend, a CPython +> interpreter on the development machine. Released apps ship their own Python, see [Deployment](#deployment). +> The [example apps](#example-app) are the canonical, always-current reference if anything below drifts out of date. ## Quick start @@ -36,9 +37,27 @@ import { callFunction } from 'tauri-plugin-python-api' console.log(await callFunction("greet_python", ["world"])) // "Hello world from Python" ``` -That's it for development. Before you ship a release, read [Deployment](#deployment) — especially the -[resource-bundling](#deployment) rules and (for PyO3) how to provide `libpython` on the target machine. If you want a -single self-contained binary with no Python on the target, see [RustPython](#switch-from-pyo3-to-rustpython). +That's it for development. Before you ship a release, bundle a standalone Python with the +[CLI](#pyo3--cpython) and read [Deployment](#deployment): +```sh +npx tauri-plugin-python-cli setup +``` +If you want a single self-contained binary without any Python files, see [RustPython](#switch-from-pyo3-to-rustpython). + +## Deployment tool: tauri-plugin-python-cli + +[`tauri-plugin-python-cli`](https://github.com/marcomq/tauri-plugin-python/tree/main/cli) is an npm package that takes care of the hard part of shipping a +PyO3 app: a Python that runs on the user's machine. It needs Node.js 18+ and nothing else; run it in your project +root or in `src-tauri`: + +| Command | What it does | +| --- | --- | +| `npx tauri-plugin-python-cli setup` | downloads a relocatable Python into `src-tauri/pyembed/`, installs `src-python/requirements.txt` into it and configures cargo and tauri to bundle and link it | +| `npx tauri-plugin-python-cli doctor` | checks entry point, resources, bundled Python and, after a build, which `libpython` the binary loads; `--fix` repairs the RustPython lockfile issue | +| `npx tauri-plugin-python-cli sign` | macOS: signs the bundled Python for notarization | + +Details in [Deployment → PyO3 / CPython](#pyo3--cpython) and in the step-by-step guides for +[macOS](https://github.com/marcomq/tauri-plugin-python/blob/main/docs/deploy-macos.md), [Linux](https://github.com/marcomq/tauri-plugin-python/blob/main/docs/deploy-linux.md) and [Windows](https://github.com/marcomq/tauri-plugin-python/blob/main/docs/deploy-windows.md). ## Choosing an interpreter: PyO3 vs. RustPython @@ -48,23 +67,24 @@ This is the most important decision when using the plugin, so please read this b | --- | --- | --- | | Cargo feature | `pyo3` (enabled by default) | `rustpython` | | Interpreter | the real CPython | a Python interpreter written in Rust | -| Library compatibility | full – anything that runs on CPython, incl. C extensions (numpy, pandas, …) | **limited** – pure-Python only, and a meaningful part of the **standard library is missing or incomplete** | -| Needs Python on the target machine | yes (libpython must be available, see below) | **no** – linked statically into your binary | +| Library compatibility | full – anything that runs on CPython, incl. C extensions (numpy, pandas, …) | **limited** – pure-Python code and the pure-Python stdlib; no C extensions, no `sqlite3`, no `ssl` | +| `async def` functions | ✓ | ✗ | +| Compiled `main` (Nuitka, `.pyc`) | ✓ | ✗ | +| Needs Python on the target machine | no, if you bundle one with the [CLI](#pyo3--cpython) | **no** – interpreter and stdlib are compiled into your binary | | Speed | fast (CPython) | slower | -| Deployment | more involved (ship/embed libpython) | trivial (single binary) | +| Deployment | `tauri-plugin-python-cli setup` before `tauri build` | trivial (single binary) | > [!IMPORTANT] -> **RustPython is convenient for deployment but it is not a complete Python.** It is *not* a drop-in CPython. -> Several standard-library modules are missing, incomplete or behave differently, and some text codecs -> (e.g. `latin-1`) and modules such as `inspect` may not be importable. Code – including the plugin's own -> optional `registerFunction` argument-count check – that relies on these will silently degrade or fail on -> RustPython but work fine on PyO3. **If a library or stdlib feature doesn't work under RustPython, switch -> to the PyO3 backend before assuming it's a bug.** - -The plugin uses **PyO3 by default** because of its full compatibility. The trade-off is that PyO3 needs -`libpython` to be available for the target platform, which can be more complicated to deploy (see -[Deployment](#deployment)), especially on mobile. Pick RustPython when you want a single self-contained -binary and your Python code stays within what RustPython supports. +> **RustPython is convenient for deployment but it is not a complete Python.** The pure-Python part of the +> standard library (`json`, `typing`, `inspect`, `dataclasses`, `pathlib`, `logging`, …) is compiled into the +> binary, but everything that needs CPython C extensions is missing: `sqlite3`, `ssl`, and third-party packages +> such as numpy or pydantic-core. `async def` functions can't be called yet. **If a library doesn't work under +> RustPython, switch to the PyO3 backend before assuming it's a bug.** + +The plugin uses **PyO3 by default** because of its full compatibility. The trade-off is that the app needs a +`libpython` at runtime; [`tauri-plugin-python-cli`](#pyo3--cpython) bundles one for desktop targets. Mobile +currently needs RustPython. Pick RustPython when you want a single self-contained binary and your Python code +stays within what RustPython supports. The plugin reads by default the file `src-tauri/src-python/main.py` during startup and runs it immediately. Make sure to add all your python source as tauri resource, @@ -93,7 +113,7 @@ You can use this plugin for fast prototypes or for (early) production code. It might be possible that you want to use some python library or code that is not available for rust yet. In case that you want to ship production software packages, you need -to make sure to also ship all your python code. If you use PyO3, you also need to ship libpython too. +to make sure to also ship all your python code. If you use PyO3, you also need to ship a Python, see [Deployment](#deployment). ### Switch from PyO3 to RustPython PyO3 is the default. To get a self-contained binary that does **not** require Python on the target @@ -101,32 +121,46 @@ machine, switch to the RustPython backend by disabling the default features and (keep `venv` if you rely on automatic `.venv` loading). Remember the [limitations above](#choosing-an-interpreter-pyo3-vs-rustpython). ```toml # src-tauri/Cargo.toml -tauri-plugin-python = { version = "0.3", default-features = false, features = ["venv", "rustpython"] } +tauri-plugin-python = { version = "0.4", default-features = false, features = ["venv", "rustpython"] } ``` -### PyO3 / libpython deployment -Using [PyO3](https://github.com/PyO3/pyo3) supports many more python libraries than RustPython as it is using CPython. -The trade-off is that PyO3 uses a shared libpython by default, which makes -local development easy but makes -deployment of releases more complicated. -Therefore, it may be recommended to either use [pyoxidizer](https://github.com/indygreg/PyOxidizer) to embed libpython statically -or try to ship the dynamic libpython together with your application, for example as part -of the .venv. Check out the [PyO3 documentation](https://pyo3.rs/main/building-and-distribution) for additional support. +`rustpython-stdlib` 0.5 pulls in `malachite-bigint` twice (0.9 directly and 0.14 +via `pymath`) on a fresh lockfile, which fails to compile with type mismatches. +Pin the second copy to 0.9.2 once after adding the dependency: -Example of how to embed libpython statically using PyOxidizer: +```sh +cargo update -p malachite-bigint@0.14.0 --precise 0.9.2 +``` + +`npx tauri-plugin-python-cli doctor --fix` detects and applies this pin. See also the +[async_py README](https://github.com/marcomq/async_py#rustpython). -This has just been tested locally on MacOS. It may be possible that this is more complicated and requires additional steps on your environment. +## Async functions + +`async def` functions can be registered and called like normal ones; the plugin awaits them and returns the +result (PyO3 backend only): +```python +import asyncio +_tauri_plugin_functions = ["fetch_answer"] -Install pyoxidizer `pip install pyoxidizer` in a venv and run it on bash: -```bash -pyoxidizer generate-python-embedding-artifacts src-tauri/target/pyembed +async def fetch_answer(question): + await asyncio.sleep(0.1) + return f"42 is the answer to {question}" ``` -Then, add it to your cargo config: -```toml -# src-tauri/.cargo/config.toml -PYO3_CONFIG_FILE = { value = "target/pyembed/pyo3-build-config-file.txt", relative = true } + +The check happens at registration with `inspect.iscoroutinefunction`. A plain function that only *returns* a +coroutine (e.g. wrapped by a sync decorator) isn't awaited; write such wrappers as `async def`. + +## Compiled entry point (Nuitka, `.pyc`) + +If `src-python/main.py` doesn't exist, the plugin imports a compiled module named `main` from `src-python/` +instead: `main.cpython-313-darwin.so`, `main.pyd`, `main.pyc`, …. This lets you ship your code compiled, e.g. +with [Nuitka](https://nuitka.net/): +```sh +python -m nuitka --module src-tauri/src-python/main.py --output-dir=src-tauri/src-python ``` -You can check if the release binary has some shared libpython references by running `otool -L tauri_app` on MacOs or `ldd tauri_app` on linux. +Compiled modules only load into the exact Python version they were built for, so build them with the same +Python version you bundle (see `src-python/.python-version` below). PyO3 backend only. ## Example app @@ -181,9 +215,16 @@ console.log(await call.greet_python("input value")); ``` ## Using a venv -Using a python venv is highly recommended when using pip dependencies (PyO3 backend). +> [!NOTE] +> For releases, prefer `src-python/requirements.txt`: `tauri-plugin-python-cli setup` installs it into the +> bundled Python, which works on any machine. A `src-python/.venv` is bundled along with `src-python/` and +> loaded in addition, but only if it was created with the same Python version; otherwise the plugin prints a +> warning and ignores it. -**Put the venv at `src-python/.venv`.** The plugin auto-loads `/.venv/lib` at startup, and +Using a python venv is highly recommended when using pip dependencies during development (PyO3 backend). + +**Put the venv at `src-python/.venv`.** At startup the plugin adds its `site-packages` to `sys.path` if it +matches the running Python version (otherwise it prints a warning), and keeping the venv *inside* `src-python` is the configuration that reliably works both in `tauri dev` and in production builds (a venv that lives outside `src-python` works in dev but commonly breaks in the bundled app – this was the root cause for several "works in dev, not in prod" reports): @@ -242,11 +283,13 @@ Common causes: - **`Cannot register '': not found in Python`** – `main.py` didn't define/import that name, or `main.py` itself failed to load. Make sure `src-python/main.py` exists, is bundled as a resource (see [Deployment](#deployment)), and runs without errors on its own. -- **A `ModuleNotFoundError`, missing-stdlib, codec (`unknown encoding`) or `inspect` error only on RustPython** – +- **A `ModuleNotFoundError` (e.g. `sqlite3`, `ssl` or a C extension package) only on RustPython** – this is almost always a [RustPython limitation](#choosing-an-interpreter-pyo3-vs-rustpython), not a bug. Try the same code under the PyO3 backend to confirm, and prefer PyO3 if you need that library. -- **Missing pip dependency** – ensure you are [using a venv](#using-a-venv) and that its `lib` folder is shipped - as a resource next to `src-python`. +- **Missing pip dependency** – add it to `src-python/requirements.txt` and run `tauri-plugin-python-cli setup` + again, or, in development, install it into your [venv](#using-a-venv). +- **Something else is off** – run `npx tauri-plugin-python-cli doctor`; it checks entry point, resources and the + bundled Python, and after a build also which `libpython` the binary loads. To sanity-check your Python independently of Tauri, run `python3 src-tauri/src-python/main.py` directly (this validates it against CPython; RustPython may still differ – see the limitations above). @@ -281,34 +324,54 @@ installed**. Just bundle your `src-python/` resources. (Remember the [stdlib limitations](#choosing-an-interpreter-pyo3-vs-rustpython).) ### PyO3 / CPython -PyO3 needs a `libpython` at runtime, which is what makes PyO3 deployment harder. +PyO3 links `libpython` at build time, and the OS loader looks for exactly that library at runtime. Without +further steps the app therefore only starts on machines that have the same Python at the same location as the +build machine. [`tauri-plugin-python-cli`](https://github.com/marcomq/tauri-plugin-python/tree/main/cli) bundles a relocatable +[python-build-standalone](https://github.com/astral-sh/python-build-standalone) interpreter instead: -> [!IMPORTANT] -> **The plugin has no runtime setting to "point" at a Python install.** Which `libpython` is used is fixed when -> PyO3 is *linked at build time*; at runtime the OS dynamic loader finds it via the normal library search path -> (rpath, `DYLD_LIBRARY_PATH`/`LD_LIBRARY_PATH`, system locations). The only environment variable this plugin reads -> is [`TAURI_PLUGIN_PYTHON_TIMEOUT_SECS`](#call-timeout). So "shipping a Python" means controlling the *build link* -> **and** making the matching `libpython` resolvable next to your binary at runtime — not configuring the plugin. - -Options, easiest first: - -1. **Ship the shared libpython** next to the executable / inside the `.venv` you bundle. Check what your binary is - linked against with `otool -L tauri_app` (macOS) or `ldd tauri_app` (Linux); a line such as - `.../Python.framework/Versions/3.13/Python` tells you which version and location the target must provide. Bundle - that library (and set an rpath / co-locate it) so the loader finds it. The target machine then needs no separately - installed Python. -2. **Build against an embeddable / standalone Python**, then ship it. Point PyO3 at a self-contained Python - (e.g. [python-build-standalone](https://github.com/astral-sh/python-build-standalone) or the Windows embeddable - zip) at **build time** via a `PYO3_CONFIG_FILE` (see [PyO3 build & distribution](https://pyo3.rs/main/building-and-distribution)), - bundle that same Python as a resource, and ensure its `libpython` is on the runtime search path. There is no - plugin-side "load this interpreter" call — it is standard PyO3 packaging. For one community example of wiring an - embedded Python into a Tauri app, see [@Qingbao's tauri-agent](https://github.com/Qingbao/tauri-agent) - (third-party, not tested by us – treat it as a starting point, not a recommendation). -3. **PyOxidizer / static linking** is possible but currently fragile (unmaintained `pyembed`, pyo3-version - conflicts). Not recommended unless you specifically need it. - -In all cases, also bundle your [venv](#using-a-venv) (`src-python/.venv`) for pip dependencies. Note the venv only -adds its `site-packages` to `sys.path`; it does **not** supply `libpython`, so you still need one of the options above. +```sh +npx tauri-plugin-python-cli setup # once, after cloning, and when requirements change +npm run tauri build +npx tauri-plugin-python-cli doctor # optional: checks which libpython the built app loads +``` + +Step-by-step guides: **[macOS](https://github.com/marcomq/tauri-plugin-python/blob/main/docs/deploy-macos.md)** · **[Linux](https://github.com/marcomq/tauri-plugin-python/blob/main/docs/deploy-linux.md)** · +**[Windows](https://github.com/marcomq/tauri-plugin-python/blob/main/docs/deploy-windows.md)** + +`setup` downloads Python into `src-tauri/pyembed/`, +installs `src-python/requirements.txt` into it, and configures the build: + +- `src-tauri/.cargo/config.toml` gets a managed block with `PYO3_CONFIG_FILE` (link against the bundled + `libpython`) and, on macOS and Linux, an rpath so the binary finds it inside the app bundle. +- `tauri..conf.json` registers the Python runtime as resources. Your `bundle.resources` in + `tauri.conf.json` is converted to the object form so tauri can merge both. +- `/pyembed/` is added to `src-tauri/.gitignore`; it is machine specific. + +Commit the config changes and run `setup` after every clone and in CI before `tauri build`. Without it, the build fails with `failed to open PyO3 config file at …/pyembed/pyo3-config.txt`, +because the committed `.cargo/config.toml` points to a file in the uncommitted `pyembed/`. + +The Python version comes from `src-python/.python-version` (e.g. `3.13`, same format as `uv python pin`). If the +file is missing, `setup` takes the newest Python that reached its x.y.2 bugfix release (`stable`) and writes its +minor version there. Commit that file so the team and CI bundle the same version. To change it, edit the file or +run `npx tauri-plugin-python-cli setup --python 3.14` (also an exact `3.14.2`, `stable` or `latest`), which updates the file. + +At startup the plugin finds `pyembed/python` in the resources (or in `src-tauri` during `tauri dev`) and uses +it as `PYTHONHOME`. Without `pyembed/` the plugin uses the Python it was linked against, as before. + +Notes per platform: + +- **Build on each target OS.** The bundled Python is native code; build the macOS app on macOS, the Linux + packages on Linux and the Windows installer on Windows, e.g. in a CI matrix. Run `setup` in CI before + `tauri build`; downloads are cached in `~/.cache/tauri-plugin-python-cli`. +- **macOS:** notarization requires every native file in the app to be signed. Tauri only signs the main binary, + so run `npx tauri-plugin-python-cli sign` (uses `APPLE_SIGNING_IDENTITY`) **before** `tauri build`; it signs + the files in `src-tauri/pyembed`, which tauri then copies into the app. +- **Windows:** `python3XX.dll` is placed next to the `.exe`, the rest under `pyembed/`. +- **Linux:** the runtime lands in `/usr/lib//pyembed/`. +- `RUSTFLAGS` in the environment replaces the rpaths from `.cargo/config.toml`; `doctor` warns about it. + +If you prefer to wire it up yourself: everything `setup` writes is plain tauri and cargo configuration, see +[cli/README.md](https://github.com/marcomq/tauri-plugin-python/tree/main/cli) and [PyO3 build & distribution](https://pyo3.rs/main/building-and-distribution). ### Windows: hidden console & stdio Tauri release builds hide the console (`#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]` in @@ -332,12 +395,13 @@ single and serial, so a call that never returns still occupies it until it finis This is the most common deployment problem. Check, in order: 1. Is `src-python/` (incl. `main.py`) listed under `bundle.resources` in `tauri.conf.json`? Inspect the installed app's resource folder to confirm the files are actually there with the same structure as locally. -2. **PyO3 + pip deps not working in prod** → your `.venv` isn't bundled or isn't at `src-python/.venv`. Move it - inside `src-python` and bundle it (see [Using a venv](#using-a-venv)). -3. **PyO3 app won't launch at all** → missing `libpython` on the target; ship an embeddable Python or the shared - library (above). -4. **C-extension packages (numpy, …) fail in prod** → the venv was built for a different OS/arch than you shipped. - Rebuild it for the target platform (ideally in CI). + Debug builds fall back to `src-python/` in the current directory, release builds don't. +2. **PyO3 app won't launch at all, or only on your machine** → the app has no bundled Python. Run + `npx tauri-plugin-python-cli setup` before `tauri build` (see [PyO3 / CPython](#pyo3--cpython)), then + `npx tauri-plugin-python-cli doctor`. +3. **PyO3 + pip deps not working in prod** → list them in `src-python/requirements.txt` and run `setup` again. +4. **C-extension packages (numpy, …) fail in prod** → they were installed for a different OS/arch than you + shipped. Run `setup` and `tauri build` on each target platform (ideally in CI). 5. Still stuck? Temporarily build with the console visible (remove the `windows_subsystem` line on Windows, or run the binary from a terminal) to see startup errors, and see [Debugging](#debugging). diff --git a/cli/README.md b/cli/README.md new file mode 100644 index 0000000..aa3fffb --- /dev/null +++ b/cli/README.md @@ -0,0 +1,64 @@ +# tauri-plugin-python-cli + +Deployment helper for [tauri-plugin-python](https://github.com/marcomq/tauri-plugin-python). + +With the PyO3 backend, the app links against the `libpython` found at build +time and only starts on machines that have exactly that Python at exactly that +location. `setup` bundles a relocatable +[python-build-standalone](https://github.com/astral-sh/python-build-standalone) +interpreter instead, so the app runs everywhere, in `tauri dev` and in the +installed bundle. + +```sh +npx tauri-plugin-python-cli setup # bundle Python + src-python/requirements.txt +npx tauri-plugin-python-cli doctor # check the project (and built binaries) +npx tauri-plugin-python-cli sign # macOS: codesign the bundled Python, before `tauri build` +``` + +Step-by-step guides: [macOS](https://github.com/marcomq/tauri-plugin-python/blob/main/docs/deploy-macos.md) · +[Linux](https://github.com/marcomq/tauri-plugin-python/blob/main/docs/deploy-linux.md) · +[Windows](https://github.com/marcomq/tauri-plugin-python/blob/main/docs/deploy-windows.md) + +Run the commands in the project root or in `src-tauri`. + +## setup + +- downloads python-build-standalone for this machine into `src-tauri/pyembed/python` + (checksum verified, cached in `~/.cache/tauri-plugin-python-cli`) +- removes test suite, tkinter and other parts an app doesn't need +- installs `src-python/requirements.txt` into it with pip +- writes `pyembed/pyo3-config.txt` and a managed block in `.cargo/config.toml` + (`PYO3_CONFIG_FILE` and the rpaths to find `libpython`) +- registers the runtime files as resources in `tauri..conf.json` and + converts `bundle.resources` in `tauri.conf.json` to the object form, so tauri + can merge both +- adds `/pyembed/` to `src-tauri/.gitignore` + +`pyembed/` is machine specific and not committed: run `setup` again after +cloning, in CI before `tauri build`, and whenever requirements change. Otherwise +the build fails with `failed to open PyO3 config file at …/pyembed/pyo3-config.txt`. + +Python version: `src-python/.python-version` (e.g. `3.13`, as written by +`uv python pin`). If it is missing, `setup` takes `stable`, the newest Python that +reached its x.y.2 bugfix release, and writes its minor version there; commit the +file. `--python` overrides it and updates the file; `latest` takes the newest one. + +Options: `--python 3.13` (or an exact `3.13.5`, `stable`, `latest`), `--release `, +`--requirements `, `--force` (download again). + +## doctor + +Checks entry point, resources, bundled Python, whether `src-python/.venv` matches +it, `PYO3_CONFIG_FILE`, rpaths, +`RUSTFLAGS` overrides and, if already built, whether the binary links the +bundled `libpython` and not the host one. For the RustPython backend it +detects the duplicate `malachite-bigint` versions that break the build; +`doctor --fix` pins them in `Cargo.lock`. + +## sign (macOS) + +Notarization rejects unsigned native files anywhere in the app, and tauri only +signs the main binary and frameworks. `sign` signs every Mach-O file in the +bundled Python with `--options runtime --timestamp`, using `--identity` or +`APPLE_SIGNING_IDENTITY` (the same variable `tauri build` uses). It signs the +files in `src-tauri/pyembed`, so run it after `setup` and before `tauri build`. diff --git a/cli/bin/cli.js b/cli/bin/cli.js new file mode 100644 index 0000000..e5c37c3 --- /dev/null +++ b/cli/bin/cli.js @@ -0,0 +1,78 @@ +#!/usr/bin/env node +// @ts-check +import { parseArgs } from "node:util"; +import { doctor } from "../lib/doctor.js"; +import { DEFAULT_PYTHON, setup } from "../lib/setup.js"; +import { sign } from "../lib/sign.js"; + +const HELP = `Usage: tauri-plugin-python-cli [options] + +Commands: + setup Bundle a standalone Python (PyO3 backend) into src-tauri/pyembed, + install src-python/requirements.txt into it and configure linking + and tauri resources. + doctor Check the project for common deployment problems. + sign Codesign the bundled Python on macOS (needed for notarization). + +Options: + --project Project root or src-tauri dir (default: cwd) + --python setup: 3.13, 3.13.5, stable or latest; written to src-python/.python-version + (default: that file, else ${DEFAULT_PYTHON}) + --release setup: python-build-standalone release (default: latest) + --requirements setup: requirements file (default: src-python/requirements.txt) + --force setup: download and replace the bundled Python + --fix doctor: apply automatic fixes + --identity sign: signing identity (default: $APPLE_SIGNING_IDENTITY) + --entitlements sign: entitlements plist + -h, --help Show this help +`; + +/** @type {Record} */ +const ICONS = { ok: "✔", warn: "!", error: "✖" }; + +async function main() { + const { values, positionals } = parseArgs({ + allowPositionals: true, + options: { + project: { type: "string" }, + python: { type: "string" }, + release: { type: "string" }, + requirements: { type: "string" }, + force: { type: "boolean" }, + fix: { type: "boolean" }, + identity: { type: "string" }, + entitlements: { type: "string" }, + help: { type: "boolean", short: "h" }, + }, + }); + const [command] = positionals; + if (values.help || !command) { + console.log(HELP); + return 0; + } + if (command === "setup") { + await setup(values); + return 0; + } + if (command === "sign") { + sign(values); + return 0; + } + if (command === "doctor") { + const findings = doctor(values); + for (const f of findings) console.log(`${ICONS[f.level]} ${f.msg}`); + return findings.some((f) => f.level === "error") ? 1 : 0; + } + console.error(`Unknown command '${command}'\n\n${HELP}`); + return 2; +} + +main().then( + (code) => { + process.exitCode = code; + }, + (err) => { + console.error(`Error: ${err.message}`); + process.exitCode = 1; + }, +); diff --git a/cli/jsconfig.json b/cli/jsconfig.json new file mode 100644 index 0000000..f703862 --- /dev/null +++ b/cli/jsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "checkJs": true, + "strict": true, + "noEmit": true, + "module": "nodenext", + "moduleResolution": "nodenext", + "target": "es2022", + "types": ["node"] + }, + "include": ["bin", "lib", "test"] +} diff --git a/cli/lib/configs.js b/cli/lib/configs.js new file mode 100644 index 0000000..63e43c5 --- /dev/null +++ b/cli/lib/configs.js @@ -0,0 +1,131 @@ +// @ts-check +// Generation and merging of the project files the bundled Python needs. + +import { PYO3_CONFIG, rpaths } from "./platform.js"; + +/** @typedef {Record} Resources */ +/** @typedef {{ bundle?: { resources?: Resources | string[] } } & Record} TauriConf */ + +export const BLOCK_START = "# >>> tauri-plugin-python (managed by tauri-plugin-python-cli)"; +export const BLOCK_END = "# <<< tauri-plugin-python"; + +/** + * @param {string | undefined} productName + * @returns {string} + */ +export function cargoConfigBlock(productName) { + /** @param {import("./platform.js").Os} os */ + const flags = (os) => + rpaths(os, productName) + .flatMap((p) => ["-C", `link-arg=-Wl,-rpath,${p}`]) + .map((f) => JSON.stringify(f)) + .join(", "); + return [ + BLOCK_START, + "[env]", + `PYO3_CONFIG_FILE = { value = "${PYO3_CONFIG}", relative = true }`, + "", + `[target.'cfg(target_os = "macos")']`, + `rustflags = [${flags("macos")}]`, + "", + `[target.'cfg(target_os = "linux")']`, + `rustflags = [${flags("linux")}]`, + BLOCK_END, + "", + ].join("\n"); +} + +/** + * @param {string} text + * @returns {{ user: string, block: string | null }} + */ +function splitManagedBlock(text) { + const start = text.indexOf(BLOCK_START); + const end = text.indexOf(BLOCK_END); + if (start === -1 || end === -1 || end < start) return { user: text, block: null }; + const after = text.slice(end + BLOCK_END.length).replace(/^\r?\n/, ""); + return { user: text.slice(0, start) + after, block: text.slice(start, end + BLOCK_END.length) }; +} + +/** @param {string} text */ +export function hasManagedBlock(text) { + return splitManagedBlock(text).block !== null; +} + +/** + * Settings outside the managed block that would collide with it. + * @param {string} text + * @returns {string[]} + */ +export function cargoConfigConflicts(text) { + const { user } = splitManagedBlock(text); + const conflicts = []; + if (/^\s*\[env\]/m.test(user) || /^\s*env\./m.test(user)) conflicts.push("[env]"); + if (/rustflags/.test(user)) conflicts.push("rustflags"); + return conflicts; +} + +/** + * Replaces the managed block in an existing `.cargo/config.toml` or appends it. + * @param {string | undefined} existing + * @param {string} block + * @returns {string} + */ +export function upsertCargoConfig(existing, block) { + const { user } = splitManagedBlock(existing ?? ""); + const head = user.trimEnd(); + return head ? `${head}\n\n${block}` : block; +} + +/** + * Tauri merges `tauri..conf.json` into `tauri.conf.json` via JSON Merge + * Patch, so resources must be an object in both to be combined. + * @param {Resources | string[] | undefined | null} resources + * @returns {Resources} + */ +export function resourcesAsObject(resources) { + if (resources === undefined || resources === null) return {}; + if (Array.isArray(resources)) return Object.fromEntries(resources.map((r) => [r, r])); + return { ...resources }; +} + +/** + * List entries whose meaning changes in the object form: tauri maps `../` to + * `_up_/` and absolute paths to their file name only in the list form, and + * globs keep their directory structure only there. + * @param {string[]} resources + * @returns {string[]} + */ +export function unconvertibleResources(resources) { + return resources.filter((r) => /[*?[{]/.test(r) || /(^|[\\/])\.\.([\\/]|$)/.test(r) || /^([a-zA-Z]:)?[\\/]/.test(r)); +} + +/** + * Returns `platformConf` with `resources` added and older entries matching + * `isOurs` removed. + * @param {TauriConf | undefined} platformConf + * @param {Resources} resources + * @param {(src: string) => boolean} isOurs + * @returns {TauriConf} + */ +export function withPythonResources(platformConf, resources, isOurs) { + /** @type {TauriConf} */ + const conf = structuredClone(platformConf ?? {}); + conf.bundle ??= {}; + const current = resourcesAsObject(conf.bundle.resources); + const kept = Object.fromEntries(Object.entries(current).filter(([src]) => !isOurs(src))); + conf.bundle.resources = { ...kept, ...resources }; + return conf; +} + +/** + * @param {string | undefined} text + * @param {string} entry + * @returns {string} + */ +export function withGitignoreEntry(text, entry) { + const content = text ?? ""; + if (content.split(/\r?\n/).some((l) => l.trim() === entry)) return content; + const head = content.trimEnd(); + return head ? `${head}\n${entry}\n` : `${entry}\n`; +} diff --git a/cli/lib/doctor.js b/cli/lib/doctor.js new file mode 100644 index 0000000..9a88152 --- /dev/null +++ b/cli/lib/doctor.js @@ -0,0 +1,266 @@ +// @ts-check +// `doctor`: checks the project for the usual deployment problems. + +import { spawnSync } from "node:child_process"; +import fs from "node:fs"; +import path from "node:path"; +import { cargoConfigConflicts, hasManagedBlock, resourcesAsObject } from "./configs.js"; +import { isVersionAlias } from "./pbs.js"; +import { MANIFEST, PYO3_CONFIG, PYTHON_DIR, hostTriple, layout, osOf } from "./platform.js"; +import { + duplicateLockVersions, + findSrcTauri, + hasCompiledEntry, + packageName, + pinnedPythonVersion, + pluginBackend, + readJson, + readText, + venvMismatch, +} from "./project.js"; + +/** @typedef {import("./platform.js").Os} Os */ +/** @typedef {import("./setup.js").Manifest} Manifest */ + +/** + * @typedef {object} Finding + * @property {"ok" | "warn" | "error"} level + * @property {string} msg + */ + +/** + * @typedef {object} Report + * @property {(msg: string) => void} ok + * @property {(msg: string) => void} warn + * @property {(msg: string) => void} error + */ + +/** + * @typedef {object} DoctorOptions + * @property {string} [project] + * @property {boolean} [fix] apply the safe automatic fixes + */ + +const MALACHITE = "malachite-bigint"; + +/** + * @param {DoctorOptions} opts + * @returns {Finding[]} + */ +export function doctor(opts) { + /** @type {Finding[]} */ + const findings = []; + /** @type {Report} */ + const report = { + ok: (msg) => findings.push({ level: "ok", msg }), + warn: (msg) => findings.push({ level: "warn", msg }), + error: (msg) => findings.push({ level: "error", msg }), + }; + + const srcTauri = findSrcTauri(opts.project); + const backend = pluginBackend(readText(path.join(srcTauri, "Cargo.toml"))); + if (!backend) { + report.error("tauri-plugin-python is not a dependency in src-tauri/Cargo.toml"); + return findings; + } + report.ok(`Backend: ${backend}`); + + const srcPython = path.join(srcTauri, "src-python"); + if (fs.existsSync(path.join(srcPython, "main.py"))) report.ok("Entry point: src-python/main.py"); + else if (hasCompiledEntry(srcPython)) report.ok("Entry point: compiled 'main' module (Nuitka/Cython)"); + else report.error("No src-python/main.py (or compiled main.*.so / main.*.pyd / main.pyc) found"); + + const os = osOf(hostTriple()); + const resources = mergedResources(srcTauri, os); + if (bundlesSrcPython(resources)) { + report.ok("src-python is bundled as resource"); + } else if (Object.keys(resources).some((src) => /^(\.\/)?src-python\//.test(src))) { + report.warn("Only single files of src-python/ are bundled; bundle the whole directory unless that is intended"); + } else { + report.error("src-python/ is missing in bundle.resources of tauri.conf.json - release builds won't find main.py"); + } + if (fs.existsSync(path.join(srcPython, ".venv"))) { + report.warn("src-python/.venv only works on the build machine; bundle dependencies with 'setup' (PyO3) instead"); + } + + if (backend === "rustpython") checkRustPython(srcTauri, Boolean(opts.fix), report); + else checkPyo3(srcTauri, os, resources, report); + return findings; +} + +/** + * Resources after tauri merged `tauri..conf.json` into `tauri.conf.json`. + * @param {string} srcTauri + * @param {Os} os + * @returns {Record} + */ +export function mergedResources(srcTauri, os) { + const base = readJson(path.join(srcTauri, "tauri.conf.json")); + const platformRes = readJson(path.join(srcTauri, `tauri.${os}.conf.json`))?.bundle?.resources; + const baseRes = base?.bundle?.resources; + // JSON Merge Patch replaces anything that isn't an object on both sides. + if (!platformRes) return resourcesAsObject(baseRes); + if (Array.isArray(platformRes) || Array.isArray(baseRes)) return resourcesAsObject(platformRes); + return { ...baseRes, ...platformRes }; +} + +/** + * Whether the whole `src-python/` directory is a resource. + * @param {Record} resources + */ +export function bundlesSrcPython(resources) { + return Object.keys(resources).some((src) => /^(\.\/)?src-python(\/(\*\*\/?)?\*?)?$/.test(src)); +} + +/** + * @param {string} srcTauri + * @param {boolean} fix + * @param {Report} report + */ +function checkRustPython(srcTauri, fix, report) { + const versions = duplicateLockVersions(readText(path.join(srcTauri, "Cargo.lock")), MALACHITE); + if (!versions.length) { + report.ok(`Cargo.lock: single ${MALACHITE} version`); + return; + } + const [oldest, ...newer] = versions.sort(compareVersions); + if (!fix) { + report.error(`Cargo.lock has ${MALACHITE} ${versions.join(" and ")}; RustPython fails to compile. Run 'doctor --fix'`); + return; + } + for (const v of newer) { + const args = ["update", "-p", `${MALACHITE}@${v}`, "--precise", oldest]; + const res = spawnSync("cargo", args, { cwd: srcTauri, stdio: "inherit" }); + if (res.status !== 0) { + report.error(`cargo ${args.join(" ")} failed`); + return; + } + } + report.ok(`Fixed: pinned ${MALACHITE} to ${oldest} in Cargo.lock`); +} + +/** + * @param {string} srcTauri + * @param {Os} os + * @param {Record} resources + * @param {Report} report + */ +function checkPyo3(srcTauri, os, resources, report) { + /** @type {Manifest | undefined} */ + const manifest = readJson(path.join(srcTauri, MANIFEST)); + if (!manifest) { + report.warn( + "No bundled Python: the app links the Python found at build time and only starts where that exact version is installed. Run 'setup' to bundle one", + ); + return; + } + report.ok(`Bundled Python ${manifest.python} (${manifest.triple})`); + const pin = pinnedPythonVersion(srcTauri); + if (pin && !isVersionAlias(pin) && !`${manifest.python}.`.startsWith(`${pin}.`)) { + report.error(`src-python/.python-version wants ${pin}, the bundled Python is ${manifest.python}. Run 'setup'`); + } + const mismatch = venvMismatch(srcTauri, manifest.python); + if (mismatch) report.warn(mismatch); + if (manifest.triple !== hostTriple()) { + report.error(`Bundled Python is for ${manifest.triple}, this machine is ${hostTriple()}. Run 'setup --force'`); + } + const l = layout(os, manifest.python); + if (!fs.existsSync(path.join(srcTauri, l.stdlib))) report.error(`${l.stdlib} is missing. Run 'setup --force'`); + + const libDir = /^lib_dir=(.*)$/m.exec(readText(path.join(srcTauri, PYO3_CONFIG)) ?? "")?.[1]; + if (!libDir) report.error(`${PYO3_CONFIG} is missing. Run 'setup'`); + else if (path.resolve(libDir) !== path.resolve(srcTauri, l.libDir)) { + report.error(`${PYO3_CONFIG} points to ${libDir} (project moved?). Run 'setup'`); + } else report.ok(`${PYO3_CONFIG} is up to date`); + + const cargoConfig = readText(path.join(srcTauri, ".cargo", "config.toml")); + if (!cargoConfig || !hasManagedBlock(cargoConfig)) { + report.error(".cargo/config.toml lacks the PYO3_CONFIG_FILE/rpath settings. Run 'setup'"); + } else if (cargoConfigConflicts(cargoConfig).length) { + report.warn(".cargo/config.toml has own [env]/rustflags settings; check that they don't override the managed block"); + } else report.ok(".cargo/config.toml sets PYO3_CONFIG_FILE and rpaths"); + for (const v of ["RUSTFLAGS", "CARGO_ENCODED_RUSTFLAGS"]) { + if (process.env[v]) report.warn(`${v} is set and replaces the rpaths from .cargo/config.toml`); + } + if (process.env.PYO3_PYTHON) report.warn("PYO3_PYTHON is set; PYO3_CONFIG_FILE takes precedence"); + + const missing = Object.keys(l.resources).filter( + (src) => fs.existsSync(path.join(srcTauri, src)) && !(src in resources), + ); + if (missing.length) { + report.error(`Bundled Python not in tauri.${os}.conf.json resources (${missing.join(", ")}). Run 'setup'`); + } else report.ok(`Bundled Python is registered in tauri.${os}.conf.json`); + + checkBinaries(srcTauri, os, manifest, report); +} + +/** + * Inspects already built binaries for the classic "links the host Python" mistake. + * @param {string} srcTauri + * @param {Os} os + * @param {Manifest} manifest + * @param {Report} report + */ +function checkBinaries(srcTauri, os, manifest, report) { + const name = packageName(readText(path.join(srcTauri, "Cargo.toml"))); + if (!name) return; + const exe = os === "windows" ? `${name}.exe` : name; + for (const profile of ["release", "debug"]) { + const bin = path.join(srcTauri, "target", profile, exe); + if (!fs.existsSync(bin)) continue; + const rel = path.relative(srcTauri, bin); + if (os === "windows") { + const dll = Object.values(layout(os, manifest.python).resources).find((t) => t.endsWith(".dll")); + if (dll && fs.existsSync(path.join(path.dirname(bin), dll))) report.ok(`${rel}: ${dll} next to the exe`); + else report.warn(`${rel}: ${dll} is not next to the exe; rebuild after 'setup'`); + continue; + } + const linkage = inspectLinkage(bin, os); + if (!linkage) continue; + const bundled = linkage.rpaths.some((p) => p.includes(`${PYTHON_DIR}/lib`)); + if (!linkage.libpython) report.warn(`${rel}: no libpython dependency found`); + else if (linkage.libpython.startsWith("/")) { + report.error(`${rel}: links the host Python (${linkage.libpython}); rebuild after 'setup'`); + } else if (!bundled) report.error(`${rel}: no rpath to ${PYTHON_DIR}/lib; rebuild after 'setup'`); + else report.ok(`${rel}: links ${linkage.libpython} from the bundled Python`); + } +} + +/** + * libpython dependency and rpaths of a binary (otool on macOS, readelf on Linux). + * @param {string} bin + * @param {Os} os + * @returns {{ libpython: string | undefined, rpaths: string[] } | undefined} + */ +function inspectLinkage(bin, os) { + const cmds = os === "macos" ? [["otool", "-L"], ["otool", "-l"]] : [["readelf", "-d"]]; + const out = []; + for (const [cmd, flag] of cmds) { + const res = spawnSync(cmd, [flag, bin], { encoding: "utf8" }); + if (res.status !== 0) return undefined; + out.push(res.stdout); + } + const text = out.join("\n"); + const libpython = + os === "macos" + ? /^\s*(\S*(?:libpython|Python\.framework\/)\S*)/m.exec(out[0])?.[1] + : /NEEDED.*\[(libpython[^\]]*)\]/.exec(text)?.[1]; + const rpaths = + os === "macos" + ? [...text.matchAll(/^\s*path (\S+) \(offset/gm)].map((m) => m[1]) + : [...text.matchAll(/(?:RUNPATH|RPATH).*\[([^\]]*)\]/g)].flatMap((m) => m[1].split(":")); + return { libpython, rpaths }; +} + +/** + * @param {string} a + * @param {string} b + */ +function compareVersions(a, b) { + const pa = a.split(".").map(Number); + const pb = b.split(".").map(Number); + for (let i = 0; i < Math.max(pa.length, pb.length); i++) { + if ((pa[i] ?? 0) !== (pb[i] ?? 0)) return (pa[i] ?? 0) - (pb[i] ?? 0); + } + return 0; +} diff --git a/cli/lib/pbs.js b/cli/lib/pbs.js new file mode 100644 index 0000000..5949fe6 --- /dev/null +++ b/cli/lib/pbs.js @@ -0,0 +1,206 @@ +// @ts-check +// Download of python-build-standalone (https://github.com/astral-sh/python-build-standalone). + +import { createHash } from "node:crypto"; +import { spawnSync } from "node:child_process"; +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { parseVersion } from "./platform.js"; + +/** + * @typedef {object} Release + * @property {string} tag + * @property {Record} assets asset name -> download url + */ + +/** + * @typedef {object} Asset + * @property {string} name + * @property {string} version full Python version, e.g. 3.13.18 + * @property {string} release python-build-standalone release tag + * @property {number} patch + * @property {boolean} stripped + */ + +const REPO = "astral-sh/python-build-standalone"; + +const ASSET_RE = /^cpython-(\d+)\.(\d+)\.(\d+)\+(\d+)-(.+?)-(install_only_stripped|install_only)\.tar\.gz$/; + +/** `stable` moves to a new minor version once it reached this patch level (x.y.2, ~4 months after x.y.0). */ +export const STABLE_MIN_PATCH = 2; + +/** @param {string} version */ +export const isVersionAlias = (version) => version === "stable" || version === "latest"; + +/** + * Picks the newest patch release of `version` (e.g. "3.13") for `triple`, + * preferring the stripped build. An exact "3.13.5" pins the patch level. + * `latest` is the newest minor version in the release, `stable` the newest + * one that reached {@link STABLE_MIN_PATCH}. + * @param {string[]} assetNames + * @param {string} version + * @param {string} triple + * @returns {Asset} + */ +export function selectAsset(assetNames, version, triple) { + /** @type {(Asset & { minor: string })[]} */ + const builds = []; + for (const name of assetNames) { + const m = ASSET_RE.exec(name); + if (!m || m[5] !== triple) continue; + builds.push({ + name, + version: `${m[1]}.${m[2]}.${m[3]}`, + minor: `${m[1]}.${m[2]}`, + release: m[4], + patch: +m[3], + stripped: m[6] === "install_only_stripped", + }); + } + const resolved = isVersionAlias(version) ? resolveAlias(builds, version) : version; + const want = resolved === undefined ? undefined : parseVersion(resolved); + const candidates = builds.filter( + (b) => + want && + b.minor === `${want.major}.${want.minor}` && + (want.patch === undefined || b.patch === want.patch), + ); + candidates.sort((a, b) => b.patch - a.patch || Number(b.stripped) - Number(a.stripped)); + if (!candidates.length) { + throw new Error(`No python-build-standalone build of Python ${version} for ${triple}`); + } + const { minor, ...asset } = candidates[0]; + return asset; +} + +/** + * @param {{ minor: string, patch: number }[]} builds + * @param {"stable" | "latest"} alias + * @returns {string | undefined} e.g. "3.14" + */ +function resolveAlias(builds, alias) { + /** @type {Map} */ + const newestPatch = new Map(); + for (const b of builds) newestPatch.set(b.minor, Math.max(newestPatch.get(b.minor) ?? -1, b.patch)); + /** @param {string} v */ + const key = (v) => v.split(".").map(Number); + const minors = [...newestPatch].sort(([a], [b]) => key(b)[0] - key(a)[0] || key(b)[1] - key(a)[1]); + const pick = alias === "latest" ? minors[0] : (minors.find(([, p]) => p >= STABLE_MIN_PATCH) ?? minors[0]); + return pick?.[0]; +} + +/** + * @param {string} text contents of a `SHA256SUMS` file + * @returns {Record} file name -> lowercase hex digest + */ +export function parseSha256Sums(text) { + return Object.fromEntries( + text + .split(/\r?\n/) + .map((l) => l.trim().split(/\s+/)) + .filter((p) => p.length === 2) + .map(([hash, name]) => [name.replace(/^\*/, ""), hash.toLowerCase()]), + ); +} + +/** + * @param {string} url + * @param {string} accept + */ +async function get(url, accept) { + /** @type {Record} */ + const headers = { "User-Agent": "tauri-plugin-python-cli", Accept: accept }; + if (process.env.GITHUB_TOKEN && url.startsWith("https://api.github.com/")) { + headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`; + } + const res = await fetch(url, { headers }); + if (!res.ok) throw new Error(`GET ${url} failed: ${res.status} ${res.statusText}`); + return res; +} + +/** + * @param {string} [tag] release tag, latest if omitted + * @returns {Promise} + */ +export async function fetchRelease(tag) { + const which = tag ? `tags/${tag}` : "latest"; + const res = await get(`https://api.github.com/repos/${REPO}/releases/${which}`, "application/vnd.github+json"); + /** @type {{ tag_name: string, assets: { name: string, browser_download_url: string }[] }} */ + const release = await res.json(); + return { + tag: release.tag_name, + assets: Object.fromEntries(release.assets.map((a) => [a.name, a.browser_download_url])), + }; +} + +export function cacheDir() { + const base = + process.env.TAURI_PLUGIN_PYTHON_CACHE ?? + (process.platform === "win32" ? process.env.LOCALAPPDATA : undefined) ?? + path.join(os.homedir(), ".cache"); + return path.join(base, "tauri-plugin-python-cli"); +} + +/** + * Downloads `asset` into the cache (once) and verifies its SHA256. + * @param {Release} release + * @param {string} asset + * @param {(msg: string) => void} log + * @returns {Promise} path of the archive + */ +export async function download(release, asset, log) { + const dir = cacheDir(); + fs.mkdirSync(dir, { recursive: true }); + const file = path.join(dir, asset); + const sumsUrl = release.assets.SHA256SUMS; + const expected = sumsUrl ? parseSha256Sums(await (await get(sumsUrl, "*/*")).text())[asset] : undefined; + if (!expected) throw new Error(`No SHA256 checksum published for ${asset}`); + if (fs.existsSync(file) && sha256(file) === expected) { + log(`Using cached ${asset}`); + return file; + } + log(`Downloading ${asset} ...`); + const res = await get(release.assets[asset], "application/octet-stream"); + const tmp = `${file}.${process.pid}.tmp`; + fs.writeFileSync(tmp, Buffer.from(await res.arrayBuffer())); + const actual = sha256(tmp); + if (actual !== expected) { + fs.rmSync(tmp, { force: true }); + throw new Error(`Checksum mismatch for ${asset}: expected ${expected}, got ${actual}`); + } + fs.renameSync(tmp, file); + return file; +} + +/** @param {string} file */ +function sha256(file) { + return createHash("sha256").update(fs.readFileSync(file)).digest("hex"); +} + +/** + * GNU tar from Git Bash or MSYS reads `C:\...` as a remote host, so prefer the + * bsdtar that ships with Windows. + */ +function tarCommand() { + if (process.platform !== "win32") return "tar"; + const systemTar = path.join(process.env.SystemRoot ?? "C:\\Windows", "System32", "tar.exe"); + return fs.existsSync(systemTar) ? systemTar : "tar"; +} + +/** + * Extracts the archive's top-level `python/` dir to `dest`. + * @param {string} archive + * @param {string} dest + */ +export function extract(archive, dest) { + const tmp = fs.mkdtempSync(path.join(path.dirname(dest), ".extract-")); + try { + const res = spawnSync(tarCommand(), ["-xzf", archive, "-C", tmp], { stdio: "inherit" }); + if (res.status !== 0) throw new Error(`Extracting ${archive} failed (is 'tar' installed?)`); + fs.rmSync(dest, { recursive: true, force: true }); + fs.renameSync(path.join(tmp, "python"), dest); + } finally { + fs.rmSync(tmp, { recursive: true, force: true }); + } +} diff --git a/cli/lib/platform.js b/cli/lib/platform.js new file mode 100644 index 0000000..daaa5ff --- /dev/null +++ b/cli/lib/platform.js @@ -0,0 +1,180 @@ +// @ts-check +// Platform specific layout of a python-build-standalone install and how it is +// linked and bundled. Everything here is pure, so it can be unit tested for +// all platforms on any host. + +import path from "node:path"; + +/** @typedef {"macos" | "linux" | "windows"} Os */ + +/** + * @typedef {object} Version + * @property {number} major + * @property {number} minor + * @property {number | undefined} patch + */ + +/** + * @typedef {object} Layout + * @property {string} python interpreter, used for pip + * @property {string} libDir directory with the import library / libpython + * @property {string} libName library name for the linker + * @property {string} stdlib stdlib directory, used to validate the install + * @property {string[]} prune unneeded parts, relative to the python dir (`*` allowed) + * @property {Record} resources tauri resources: source -> target + * @property {Record} copies files copied by setup: source -> copy + */ + +export const EMBED_DIR = "pyembed"; +export const PYTHON_DIR = `${EMBED_DIR}/python`; +export const PYO3_CONFIG = `${EMBED_DIR}/pyo3-config.txt`; +export const MANIFEST = `${EMBED_DIR}/tauri-plugin-python.json`; + +/** @type {Record} */ +const TRIPLES = { + "darwin-arm64": "aarch64-apple-darwin", + "darwin-x64": "x86_64-apple-darwin", + "linux-x64": "x86_64-unknown-linux-gnu", + "linux-arm64": "aarch64-unknown-linux-gnu", + "win32-x64": "x86_64-pc-windows-msvc", + "win32-arm64": "aarch64-pc-windows-msvc", +}; + +/** + * @param {string} [platform] + * @param {string} [arch] + * @returns {string} + */ +export function hostTriple(platform = process.platform, arch = process.arch) { + const triple = TRIPLES[`${platform}-${arch}`]; + if (!triple) { + throw new Error(`No standalone Python available for ${platform}/${arch}`); + } + return triple; +} + +/** + * @param {string} triple + * @returns {Os} + */ +export function osOf(triple) { + if (triple.includes("apple-darwin")) return "macos"; + if (triple.includes("windows")) return "windows"; + return "linux"; +} + +/** + * Splits "3.13" or "3.13.18" into numbers. + * @param {string} version + * @returns {Version} + */ +export function parseVersion(version) { + const m = /^(\d+)\.(\d+)(?:\.(\d+))?$/.exec(String(version).trim()); + if (!m) throw new Error(`Invalid Python version '${version}', expected e.g. 3.13`); + return { major: +m[1], minor: +m[2], patch: m[3] === undefined ? undefined : +m[3] }; +} + +/** + * Files of the Python install relative to the project's `src-tauri` dir. + * Only what the interpreter needs at runtime is bundled (no `bin/`, headers + * or pkgconfig). + * @param {Os} os + * @param {string} version + * @returns {Layout} + */ +export function layout(os, version) { + const { major, minor } = parseVersion(version); + const xy = `${major}.${minor}`; + if (os === "windows") { + const dll = `python${major}${minor}.dll`; + return { + python: `${PYTHON_DIR}/python.exe`, + libDir: `${PYTHON_DIR}/libs`, + libName: `python${major}${minor}`, + stdlib: `${PYTHON_DIR}/Lib`, + prune: ["Lib/test", "Lib/idlelib", "Lib/tkinter", "Lib/turtledemo", "tcl", "DLLs/_tkinter.pyd"], + resources: { + [`${PYTHON_DIR}/`]: `${PYTHON_DIR}/`, + [`${EMBED_DIR}/${dll}`]: dll, + [`${EMBED_DIR}/python${major}.dll`]: `python${major}.dll`, + }, + // The NSIS bundler takes each source file once, and the python dir already contains the DLLs. + copies: { + [`${PYTHON_DIR}/${dll}`]: `${EMBED_DIR}/${dll}`, + [`${PYTHON_DIR}/python${major}.dll`]: `${EMBED_DIR}/python${major}.dll`, + }, + }; + } + const libpython = + os === "macos" ? `libpython${xy}.dylib` : `libpython${xy}.so.1.0`; + return { + python: `${PYTHON_DIR}/bin/python${xy}`, + libDir: `${PYTHON_DIR}/lib`, + libName: `python${xy}`, + stdlib: `${PYTHON_DIR}/lib/python${xy}`, + prune: [ + `lib/python${xy}/test`, + `lib/python${xy}/idlelib`, + `lib/python${xy}/tkinter`, + `lib/python${xy}/turtledemo`, + `lib/python${xy}/lib-dynload/_tkinter*`, + "lib/tcl*", + "lib/tk*", + "lib/itcl*", + "lib/thread*", + "lib/libtcl*", + "lib/libtk*", + "share", + ], + resources: { + [`${PYTHON_DIR}/lib/python${xy}/`]: `${PYTHON_DIR}/lib/python${xy}/`, + [`${PYTHON_DIR}/lib/${libpython}`]: `${PYTHON_DIR}/lib/${libpython}`, + }, + copies: {}, + }; +} + +/** + * Linker rpaths so the app finds the bundled libpython, both for + * `target/` (tauri copies resources next to the binary) and for the + * installed bundle. Windows finds the DLL next to the exe instead. + * @param {Os} os + * @param {string | undefined} productName + * @returns {string[]} + */ +export function rpaths(os, productName) { + const lib = `${PYTHON_DIR}/lib`; + if (os === "macos") { + return [`@executable_path/../Resources/${lib}`, `@executable_path/${lib}`]; + } + if (os === "linux") { + return [`$ORIGIN/../lib/${productName}/${lib}`, `$ORIGIN/${lib}`]; + } + return []; +} + +/** + * Contents of `PYO3_CONFIG_FILE`. The python-build-standalone sysconfig points + * to its build prefix, so PyO3 can't derive the library location itself. + * @param {string} srcTauri + * @param {Os} os + * @param {string} version + * @returns {string} + */ +export function pyo3Config(srcTauri, os, version) { + const l = layout(os, version); + const { major, minor } = parseVersion(version); + return [ + "implementation=CPython", + `version=${major}.${minor}`, + "shared=true", + "abi3=false", + `lib_name=${l.libName}`, + `lib_dir=${path.resolve(srcTauri, l.libDir)}`, + `executable=${path.resolve(srcTauri, l.python)}`, + "pointer_width=64", + "build_flags=", + "suppress_build_script_link_lines=false", + "", + ].join("\n"); +} diff --git a/cli/lib/project.js b/cli/lib/project.js new file mode 100644 index 0000000..8ccc947 --- /dev/null +++ b/cli/lib/project.js @@ -0,0 +1,165 @@ +// @ts-check +// Locating the tauri project and reading the parts of its config we need. + +import fs from "node:fs"; +import path from "node:path"; + +/** @typedef {"pyo3" | "rustpython"} Backend */ + +/** + * Returns the `src-tauri` dir for a project root or a `src-tauri` dir. + * @param {string} [start] + * @returns {string} + */ +export function findSrcTauri(start = process.cwd()) { + for (const dir of [start, path.join(start, "src-tauri")]) { + if (fs.existsSync(path.join(dir, "tauri.conf.json"))) return path.resolve(dir); + } + if (fs.existsSync(path.join(start, "src-tauri"))) { + throw new Error( + "Only tauri.conf.json is supported (no tauri.conf.json5 / Tauri.toml) - see the deployment guide for manual steps", + ); + } + throw new Error(`No tauri project found in ${start} (expected src-tauri/tauri.conf.json)`); +} + +/** + * @param {string} file + * @returns {any} + */ +export function readJson(file) { + return fs.existsSync(file) ? JSON.parse(fs.readFileSync(file, "utf8")) : undefined; +} + +/** + * @param {string} file + * @param {unknown} value + */ +export function writeJson(file, value) { + fs.writeFileSync(file, JSON.stringify(value, null, 2) + "\n"); +} + +/** + * @param {string} file + * @returns {string | undefined} + */ +export function readText(file) { + return fs.existsSync(file) ? fs.readFileSync(file, "utf8") : undefined; +} + +/** + * Same fallback as tauri: `productName`, then the cargo package name. + * @param {{ productName?: string } | undefined} tauriConf + * @param {string | undefined} cargoToml + * @returns {string | undefined} + */ +export function productName(tauriConf, cargoToml) { + return tauriConf?.productName ?? packageName(cargoToml); +} + +/** + * @param {string | undefined} cargoToml + * @returns {string | undefined} + */ +export function packageName(cargoToml) { + const section = /^\[package\][^\n]*\n([\s\S]*?)(?=^\s*\[|(?![\s\S]))/m.exec(cargoToml ?? "")?.[1]; + return /^\s*name\s*=\s*"([^"]+)"/m.exec(section ?? "")?.[1]; +} + +/** + * Backend selected for tauri-plugin-python in `Cargo.toml`, or undefined if + * the plugin is not a dependency. + * @param {string | undefined} cargoToml + * @returns {Backend | undefined} + */ +export function pluginBackend(cargoToml) { + const text = cargoToml ?? ""; + const spec = + /^\s*tauri-plugin-python\s*=\s*(.*)$/m.exec(text)?.[1] ?? + /^\[dependencies\.tauri-plugin-python\][^\n]*\n((?:(?!\s*\[).*(?:\n|$))*)/m.exec(text)?.[1]; + if (spec === undefined) return undefined; + const features = /features\s*=\s*\[([^\]]*)\]/.exec(spec.replace(/#.*$/gm, ""))?.[1] ?? ""; + return /["']rustpython["']/.test(features) ? "rustpython" : "pyo3"; +} + +/** + * Whether `dir` contains a compiled `main` module (Nuitka / Cython). + * @param {string} dir + */ +export function hasCompiledEntry(dir) { + if (!fs.existsSync(dir)) return false; + return fs.readdirSync(dir).some((f) => /^main\.(.*\.)?(so|pyd|pyc)$/.test(f)); +} + +/** + * Versions of lockfile package `name` if it appears more than once. + * @param {string | undefined} cargoLock + * @param {string} name + * @returns {string[]} + */ +export function duplicateLockVersions(cargoLock, name) { + const versions = []; + const re = /\[\[package\]\]\s*\nname\s*=\s*"([^"]+)"\s*\nversion\s*=\s*"([^"]+)"/g; + for (const m of (cargoLock ?? "").matchAll(re)) { + if (m[1] === name) versions.push(m[2]); + } + return versions.length > 1 ? versions : []; +} + +/** + * Python version ("3.13") a venv was created with, from its `pyvenv.cfg`. + * @param {string} venvDir + * @returns {string | undefined} + */ +export function venvPythonVersion(venvDir) { + const cfg = readText(path.join(venvDir, "pyvenv.cfg")) ?? ""; + const m = /^\s*(?:version_info|version)\s*=\s*(\d+)\.(\d+)/m.exec(cfg); + return m ? `${m[1]}.${m[2]}` : undefined; +} + +/** + * Warning if `src-python/.venv` doesn't match the bundled Python and will + * therefore be ignored by the plugin at runtime. + * @param {string} srcTauri + * @param {string} bundledVersion e.g. "3.13.18" + * @returns {string | undefined} + */ +export function venvMismatch(srcTauri, bundledVersion) { + const venv = path.join(srcTauri, "src-python", ".venv"); + const venvVersion = venvPythonVersion(venv); + const bundled = bundledVersion.split(".").slice(0, 2).join("."); + if (!venvVersion || venvVersion === bundled) return undefined; + return ( + `src-python/.venv was created with Python ${venvVersion}, the bundled Python is ${bundled}: ` + + `the app ignores it at runtime. Put its packages into src-python/requirements.txt and remove it, ` + + `or recreate it with Python ${bundled}` + ); +} + +/** + * Python version pinned in `src-python/.python-version` (pyenv/uv format). + * @param {string} srcTauri + * @returns {string | undefined} + */ +export function pinnedPythonVersion(srcTauri) { + const text = readText(path.join(srcTauri, "src-python", ".python-version")) ?? ""; + return text + .split(/\r?\n/) + .map((l) => l.trim()) + .find((l) => l && !l.startsWith("#")); +} + +/** + * Writes `src-python/.python-version` if `src-python/` exists. + * @param {string} srcTauri + * @param {string} version + * @returns {string | undefined} the written file + */ +export function writePythonPin(srcTauri, version) { + const dir = path.join(srcTauri, "src-python"); + if (!fs.existsSync(dir)) return undefined; + const file = path.join(dir, ".python-version"); + if (pinnedPythonVersion(srcTauri) === version) return undefined; + fs.writeFileSync(file, `${version}\n`); + return file; +} diff --git a/cli/lib/setup.js b/cli/lib/setup.js new file mode 100644 index 0000000..4b19ef1 --- /dev/null +++ b/cli/lib/setup.js @@ -0,0 +1,233 @@ +// @ts-check +// `setup`: bundle a standalone Python for the PyO3 backend. + +import { spawnSync } from "node:child_process"; +import fs from "node:fs"; +import path from "node:path"; +import { + cargoConfigBlock, + cargoConfigConflicts, + resourcesAsObject, + unconvertibleResources, + upsertCargoConfig, + withGitignoreEntry, + withPythonResources, +} from "./configs.js"; +import { bundlesSrcPython, mergedResources } from "./doctor.js"; +import { download, extract, fetchRelease, isVersionAlias, selectAsset } from "./pbs.js"; +import { + EMBED_DIR, + MANIFEST, + PYO3_CONFIG, + PYTHON_DIR, + hostTriple, + layout, + osOf, + pyo3Config, +} from "./platform.js"; +import { + findSrcTauri, + pinnedPythonVersion, + pluginBackend, + productName, + readJson, + readText, + venvMismatch, + writeJson, + writePythonPin, +} from "./project.js"; + +/** + * @typedef {object} SetupOptions + * @property {string} [project] + * @property {string} [python] e.g. "3.13", "3.13.5", "stable" or "latest" + * @property {string} [release] python-build-standalone release tag + * @property {string} [requirements] + * @property {boolean} [force] + */ + +/** + * Written to `pyembed/tauri-plugin-python.json`. + * @typedef {object} Manifest + * @property {string} python + * @property {string} release + * @property {string} triple + * @property {string} asset + */ + +export const DEFAULT_PYTHON = "stable"; + +/** + * @param {SetupOptions} opts + * @param {(msg: string) => void} [log] + */ +export async function setup(opts, log = console.log) { + const srcTauri = findSrcTauri(opts.project); + const cargoToml = readText(path.join(srcTauri, "Cargo.toml")); + const backend = pluginBackend(cargoToml); + if (!backend) throw new Error("tauri-plugin-python is not a dependency in src-tauri/Cargo.toml"); + if (backend === "rustpython") { + log("This app uses the RustPython backend, which needs no Python install. Nothing to do."); + return; + } + const triple = hostTriple(); + const os = osOf(triple); + const manifestFile = path.join(srcTauri, MANIFEST); + /** @type {Manifest | undefined} */ + let manifest = readJson(manifestFile); + const pythonDir = path.join(srcTauri, PYTHON_DIR); + const wanted = opts.python ?? pinnedPythonVersion(srcTauri) ?? manifest?.python ?? DEFAULT_PYTHON; + + if (fs.existsSync(pythonDir) && !manifest && !opts.force) { + throw new Error(`${PYTHON_DIR} exists but was not created by this tool; use --force to replace it`); + } + const release = isVersionAlias(wanted) ? await fetchRelease(opts.release) : undefined; + const resolved = release ? selectAsset(Object.keys(release.assets), wanted, triple).version : wanted; + const installed = manifest && fs.existsSync(path.join(srcTauri, layout(os, manifest.python).stdlib)); + if (opts.force || !manifest || !installed || !matches(manifest, resolved, triple, opts.release)) { + const rel = release ?? (await fetchRelease(opts.release)); + const asset = selectAsset(Object.keys(rel.assets), resolved, triple); + const archive = await download(rel, asset.name, log); + fs.mkdirSync(path.join(srcTauri, EMBED_DIR), { recursive: true }); + extract(archive, pythonDir); + prune(pythonDir, layout(os, asset.version).prune); + manifest = { python: asset.version, release: asset.release, triple, asset: asset.name }; + writeJson(manifestFile, manifest); + log(`Installed Python ${asset.version} (${asset.release}) to ${PYTHON_DIR}`); + } else { + log(`Python ${manifest.python} already installed in ${PYTHON_DIR}`); + } + + if (opts.python || !pinnedPythonVersion(srcTauri)) { + const pin = isVersionAlias(wanted) ? manifest.python.split(".").slice(0, 2).join(".") : wanted; + const pinFile = writePythonPin(srcTauri, pin); + if (pinFile) log(`Pinned Python ${pin} in ${path.relative(srcTauri, pinFile)}; commit it so CI and the team use it too`); + } + + const l = layout(os, manifest.python); + const requirements = opts.requirements ?? path.join(srcTauri, "src-python", "requirements.txt"); + if (fs.existsSync(requirements)) { + log(`Installing ${path.relative(srcTauri, requirements)} ...`); + run(path.join(srcTauri, l.python), ["-I", "-m", "pip", "install", "--disable-pip-version-check", "-r", requirements]); + } + + fs.writeFileSync(path.join(srcTauri, PYO3_CONFIG), pyo3Config(srcTauri, os, manifest.python)); + writeCargoConfig(srcTauri, productName(readJson(path.join(srcTauri, "tauri.conf.json")), cargoToml)); + for (const [src, dest] of Object.entries(l.copies)) { + if (fs.existsSync(path.join(srcTauri, src))) fs.copyFileSync(path.join(srcTauri, src), path.join(srcTauri, dest)); + } + writeTauriConfigs(srcTauri, os, l.resources); + const gitignore = path.join(srcTauri, ".gitignore"); + fs.writeFileSync(gitignore, withGitignoreEntry(readText(gitignore), `/${EMBED_DIR}/`)); + + const mismatch = venvMismatch(srcTauri, manifest.python); + if (mismatch) log(`Warning: ${mismatch}`); + if (!bundlesSrcPython(mergedResources(srcTauri, os))) { + log(`Warning: src-python/ is not in bundle.resources of tauri.conf.json; release builds won't find main.py`); + } + + log(""); + log("Done. The app now uses the bundled Python in dev and release builds."); + log(`Run this command again after cloning the project or changing requirements; ${EMBED_DIR}/ is not committed.`); + if (os === "macos") log("Before notarizing, sign the bundled Python: npx tauri-plugin-python-cli sign"); +} + +/** + * Whether the installed Python satisfies the requested version prefix. + * @param {Manifest} manifest + * @param {string} wanted + * @param {string} triple + * @param {string | undefined} release + */ +function matches(manifest, wanted, triple, release) { + const want = wanted.split("."); + const have = manifest.python.split("."); + return ( + manifest.triple === triple && + want.every((part, i) => part === have[i]) && + (!release || release === manifest.release) + ); +} + +/** + * @param {string} pythonDir + * @param {string[]} patterns relative paths, `*` allowed in the last segment + */ +function prune(pythonDir, patterns) { + for (const pattern of patterns) { + const dir = path.join(pythonDir, path.dirname(pattern)); + const base = path.basename(pattern); + if (!fs.existsSync(dir)) continue; + const re = new RegExp(`^${base.replace(/[.]/g, "\\.").replace(/\*/g, ".*")}$`); + for (const name of fs.readdirSync(dir).filter((n) => re.test(n))) { + fs.rmSync(path.join(dir, name), { recursive: true, force: true }); + } + } +} + +/** + * @param {string} cmd + * @param {string[]} args + */ +function run(cmd, args) { + const res = spawnSync(cmd, args, { stdio: "inherit" }); + if (res.status !== 0) throw new Error(`${path.basename(cmd)} ${args.join(" ")} failed`); +} + +/** + * @param {string} srcTauri + * @param {string | undefined} product + */ +function writeCargoConfig(srcTauri, product) { + const file = path.join(srcTauri, ".cargo", "config.toml"); + const existing = readText(file); + const block = cargoConfigBlock(product); + const conflicts = existing ? cargoConfigConflicts(existing) : []; + if (conflicts.length) { + throw new Error( + `.cargo/config.toml already sets ${conflicts.join(" and ")}. Merge this into it manually:\n\n${block}`, + ); + } + fs.mkdirSync(path.dirname(file), { recursive: true }); + fs.writeFileSync(file, upsertCargoConfig(existing, block)); +} + +/** + * Resources differ per OS, so they go into `tauri..conf.json`. JSON Merge + * Patch only combines objects, so the base resources are converted as well. + * @param {string} srcTauri + * @param {import("./platform.js").Os} os + * @param {Record} resources + */ +function writeTauriConfigs(srcTauri, os, resources) { + const baseFile = path.join(srcTauri, "tauri.conf.json"); + /** @type {import("./configs.js").TauriConf} */ + const base = readJson(baseFile); + if (base.bundle && Array.isArray(base.bundle.resources)) { + const manual = unconvertibleResources(base.bundle.resources); + if (manual.length) { + throw new Error( + `bundle.resources in tauri.conf.json must be an object so tauri can merge the Python resources, ` + + `but these entries can't be converted automatically: ${manual.join(", ")}. ` + + `Convert them to the "source": "target" form and run setup again`, + ); + } + base.bundle.resources = resourcesAsObject(base.bundle.resources); + writeJson(baseFile, base); + } + const existing = Object.fromEntries( + Object.entries(resources).filter(([src]) => fs.existsSync(path.join(srcTauri, src))), + ); + const platformFile = path.join(srcTauri, `tauri.${os}.conf.json`); + const platformRes = readJson(platformFile)?.bundle?.resources; + const manualPlatform = Array.isArray(platformRes) ? unconvertibleResources(platformRes) : []; + if (manualPlatform.length) { + throw new Error( + `bundle.resources in tauri.${os}.conf.json can't be converted to the object form automatically: ` + + `${manualPlatform.join(", ")}. Convert them to the "source": "target" form and run setup again`, + ); + } + /** @param {string} src */ + const isOurs = (src) => src.startsWith(`${EMBED_DIR}/`); + writeJson(platformFile, withPythonResources(readJson(platformFile), existing, isOurs)); +} diff --git a/cli/lib/sign.js b/cli/lib/sign.js new file mode 100644 index 0000000..f1d5b2d --- /dev/null +++ b/cli/lib/sign.js @@ -0,0 +1,64 @@ +// @ts-check +// `sign`: codesigns the native files of the bundled Python on macOS. +// Notarization rejects unsigned Mach-O files anywhere in the app, and tauri only +// signs the app binary and frameworks, not files copied as resources. + +import { spawnSync } from "node:child_process"; +import fs from "node:fs"; +import path from "node:path"; +import { PYTHON_DIR } from "./platform.js"; +import { findSrcTauri } from "./project.js"; + +const MACHO_MAGIC = new Set(["feedfacf", "cffaedfe", "cafebabe", "bebafeca"]); + +/** @param {string} file */ +export function isMachO(file) { + const fd = fs.openSync(file, "r"); + try { + const buf = Buffer.alloc(4); + return fs.readSync(fd, buf, 0, 4, 0) === 4 && MACHO_MAGIC.has(buf.toString("hex")); + } finally { + fs.closeSync(fd); + } +} + +/** + * @param {string} dir + * @returns {Generator} + */ +function* files(dir) { + for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + const p = path.join(dir, entry.name); + if (entry.isDirectory()) yield* files(p); + else if (entry.isFile()) yield p; + } +} + +/** + * @typedef {object} SignOptions + * @property {string} [project] + * @property {string} [identity] codesign identity, "-" for ad-hoc + * @property {string} [entitlements] + */ + +/** + * @param {SignOptions} opts + * @param {(msg: string) => void} [log] + */ +export function sign(opts, log = console.log) { + if (process.platform !== "darwin") throw new Error("'sign' is only needed (and possible) on macOS"); + const identity = opts.identity ?? process.env.APPLE_SIGNING_IDENTITY; + if (!identity) throw new Error("Pass --identity or set APPLE_SIGNING_IDENTITY (as for tauri build)"); + const pythonDir = path.join(findSrcTauri(opts.project), PYTHON_DIR); + if (!fs.existsSync(pythonDir)) throw new Error(`${PYTHON_DIR} not found. Run 'setup' first`); + + const targets = [...files(pythonDir)].filter(isMachO); + const args = ["--force", "--sign", identity]; + if (identity !== "-") args.push("--timestamp", "--options", "runtime"); + if (opts.entitlements) args.push("--entitlements", opts.entitlements); + for (const file of targets) { + const res = spawnSync("codesign", [...args, file], { stdio: "inherit" }); + if (res.status !== 0) throw new Error(`codesign failed for ${file}`); + } + log(`Signed ${targets.length} files in ${PYTHON_DIR}`); +} diff --git a/cli/package.json b/cli/package.json new file mode 100644 index 0000000..cb835df --- /dev/null +++ b/cli/package.json @@ -0,0 +1,36 @@ +{ + "name": "tauri-plugin-python-cli", + "version": "0.4.0", + "author": "Marco Mengelkoch", + "description": "Bundle a standalone Python with a tauri-plugin-python app and check the deployment setup.", + "type": "module", + "bin": { + "tauri-plugin-python-cli": "bin/cli.js" + }, + "files": [ + "bin", + "lib", + "README.md" + ], + "engines": { + "node": ">=18" + }, + "scripts": { + "test": "node --test test/unit.test.js", + "typecheck": "tsc -p jsconfig.json" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/marcomq/tauri-plugin-python.git", + "directory": "cli" + }, + "license": "MIT", + "homepage": "https://github.com/marcomq/tauri-plugin-python#readme", + "bugs": { + "url": "https://github.com/marcomq/tauri-plugin-python/issues" + }, + "devDependencies": { + "@types/node": "^22.0.0", + "typescript": "^6.0.3" + } +} diff --git a/cli/test/unit.test.js b/cli/test/unit.test.js new file mode 100644 index 0000000..5c89fad --- /dev/null +++ b/cli/test/unit.test.js @@ -0,0 +1,313 @@ +// @ts-check +import assert from "node:assert/strict"; +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { test } from "node:test"; +import { + BLOCK_END, + BLOCK_START, + cargoConfigBlock, + cargoConfigConflicts, + hasManagedBlock, + resourcesAsObject, + unconvertibleResources, + upsertCargoConfig, + withGitignoreEntry, + withPythonResources, +} from "../lib/configs.js"; +import { bundlesSrcPython, doctor } from "../lib/doctor.js"; +import { parseSha256Sums, selectAsset } from "../lib/pbs.js"; +import { hostTriple, layout, osOf, parseVersion, pyo3Config, rpaths } from "../lib/platform.js"; +import { + duplicateLockVersions, + hasCompiledEntry, + packageName, + pinnedPythonVersion, + pluginBackend, + productName, + venvMismatch, + writePythonPin, +} from "../lib/project.js"; + +test("host triples", () => { + assert.equal(hostTriple("darwin", "arm64"), "aarch64-apple-darwin"); + assert.equal(hostTriple("linux", "x64"), "x86_64-unknown-linux-gnu"); + assert.equal(hostTriple("win32", "x64"), "x86_64-pc-windows-msvc"); + assert.throws(() => hostTriple("aix", "ppc64")); + assert.equal(osOf("x86_64-pc-windows-msvc"), "windows"); + assert.equal(osOf("aarch64-apple-darwin"), "macos"); + assert.equal(osOf("x86_64-unknown-linux-gnu"), "linux"); +}); + +test("version parsing", () => { + assert.deepEqual(parseVersion("3.13"), { major: 3, minor: 13, patch: undefined }); + assert.deepEqual(parseVersion("3.12.7"), { major: 3, minor: 12, patch: 7 }); + assert.throws(() => parseVersion("3")); + assert.throws(() => parseVersion("latest")); +}); + +test("unix layout bundles only stdlib and libpython", () => { + const mac = layout("macos", "3.13.18"); + assert.equal(mac.python, "pyembed/python/bin/python3.13"); + assert.equal(mac.libName, "python3.13"); + assert.deepEqual(Object.keys(mac.resources), [ + "pyembed/python/lib/python3.13/", + "pyembed/python/lib/libpython3.13.dylib", + ]); + const linux = layout("linux", "3.12"); + assert.ok("pyembed/python/lib/libpython3.12.so.1.0" in linux.resources); +}); + +test("windows layout puts the DLLs next to the exe", () => { + const win = layout("windows", "3.13"); + assert.equal(win.python, "pyembed/python/python.exe"); + assert.equal(win.libName, "python313"); + assert.equal(win.libDir, "pyembed/python/libs"); + assert.equal(win.resources["pyembed/python313.dll"], "python313.dll"); + assert.equal(win.resources["pyembed/python3.dll"], "python3.dll"); + assert.equal(win.copies["pyembed/python/python313.dll"], "pyembed/python313.dll"); + assert.equal(win.resources["pyembed/python/"], "pyembed/python/"); +}); + +test("rpaths cover dev builds and bundles", () => { + assert.deepEqual(rpaths("macos", "App"), [ + "@executable_path/../Resources/pyembed/python/lib", + "@executable_path/pyembed/python/lib", + ]); + assert.deepEqual(rpaths("linux", "my-app"), [ + "$ORIGIN/../lib/my-app/pyembed/python/lib", + "$ORIGIN/pyembed/python/lib", + ]); + assert.deepEqual(rpaths("windows", "x"), []); +}); + +test("pyo3 config uses absolute paths", () => { + const root = path.resolve("/project/src-tauri"); + const cfg = pyo3Config(root, "macos", "3.13.18"); + assert.match(cfg, /^version=3\.13$/m); + assert.match(cfg, /^lib_name=python3\.13$/m); + assert.ok(cfg.includes(`lib_dir=${path.join(root, "pyembed/python/lib")}`)); + assert.ok(cfg.endsWith("\n")); +}); + +test("cargo config block is TOML with both rpaths", () => { + const block = cargoConfigBlock("my-app"); + assert.ok(block.startsWith(BLOCK_START)); + assert.ok(block.trimEnd().endsWith(BLOCK_END)); + assert.match(block, /PYO3_CONFIG_FILE = \{ value = "pyembed\/pyo3-config.txt", relative = true \}/); + assert.ok(block.includes('"link-arg=-Wl,-rpath,$ORIGIN/../lib/my-app/pyembed/python/lib"')); + assert.ok(block.includes('"link-arg=-Wl,-rpath,@executable_path/pyembed/python/lib"')); +}); + +test("managed cargo block is appended once and replaced on update", () => { + const user = '[build]\ntarget-dir = "out"\n'; + const first = upsertCargoConfig(user, cargoConfigBlock("a")); + assert.ok(first.startsWith(user.trimEnd())); + assert.ok(hasManagedBlock(first)); + const second = upsertCargoConfig(first, cargoConfigBlock("b")); + assert.equal(second.split(BLOCK_START).length, 2); + assert.ok(second.includes("/lib/b/")); + assert.ok(!second.includes("/lib/a/")); + assert.ok(second.startsWith(user.trimEnd())); + assert.equal(upsertCargoConfig(undefined, "X"), "X"); +}); + +test("conflicting cargo settings outside the block are reported", () => { + assert.deepEqual(cargoConfigConflicts(upsertCargoConfig("", cargoConfigBlock("a"))), []); + assert.deepEqual(cargoConfigConflicts('[env]\nFOO = "1"\n'), ["[env]"]); + assert.deepEqual(cargoConfigConflicts('[build]\nrustflags = ["-g"]\n'), ["rustflags"]); + assert.deepEqual(cargoConfigConflicts('env.FOO = "1"\n'), ["[env]"]); +}); + +test("resources are converted to the object form", () => { + assert.deepEqual(resourcesAsObject(["src-python/"]), { "src-python/": "src-python/" }); + assert.deepEqual(resourcesAsObject({ a: "b" }), { a: "b" }); + assert.deepEqual(resourcesAsObject(undefined), {}); +}); + +test("python resources replace older python entries in the platform config", () => { + /** @param {string} src */ + const isOurs = (src) => src.startsWith("pyembed/python/"); + const old = { + identifier: "x", + bundle: { resources: { "other/": "other/", "pyembed/python/lib/python3.12/": "pyembed/python/lib/python3.12/" } }, + }; + const conf = withPythonResources(old, { "pyembed/python/lib/python3.13/": "pyembed/python/lib/python3.13/" }, isOurs); + assert.deepEqual(conf.bundle?.resources, { + "other/": "other/", + "pyembed/python/lib/python3.13/": "pyembed/python/lib/python3.13/", + }); + assert.equal(conf.identifier, "x"); + assert.ok("pyembed/python/lib/python3.12/" in old.bundle.resources, "input is not mutated"); + assert.deepEqual(withPythonResources(undefined, { a: "a" }, isOurs), { bundle: { resources: { a: "a" } } }); +}); + +test("gitignore entry is added once", () => { + assert.equal(withGitignoreEntry(undefined, "/pyembed/"), "/pyembed/\n"); + assert.equal(withGitignoreEntry("/target/\n", "/pyembed/"), "/target/\n/pyembed/\n"); + assert.equal(withGitignoreEntry("/target/\n/pyembed/\n", "/pyembed/"), "/target/\n/pyembed/\n"); +}); + +test("newest stripped build of the requested minor version is selected", () => { + const t = "aarch64-apple-darwin"; + const names = [ + `cpython-3.13.17+20261110-${t}-install_only_stripped.tar.gz`, + `cpython-3.13.18+20261110-${t}-install_only.tar.gz`, + `cpython-3.13.18+20261110-${t}-install_only_stripped.tar.gz`, + `cpython-3.13.18+20261110-${t}-freethreaded-install_only_stripped.tar.gz`, + `cpython-3.13.18+20261110-${t}-pgo+lto-full.tar.zst`, + `cpython-3.14.2+20261110-${t}-install_only_stripped.tar.gz`, + `cpython-3.13.18+20261110-x86_64_v3-unknown-linux-gnu-install_only_stripped.tar.gz`, + "SHA256SUMS", + ]; + const a = selectAsset(names, "3.13", t); + assert.equal(a.name, `cpython-3.13.18+20261110-${t}-install_only_stripped.tar.gz`); + assert.equal(a.version, "3.13.18"); + assert.equal(a.release, "20261110"); + assert.equal(selectAsset(names, "3.13.17", t).version, "3.13.17"); + assert.equal(selectAsset(names, "3.14", t).version, "3.14.2"); + assert.throws(() => selectAsset(names, "3.12", t), /No python-build-standalone build/); + assert.throws(() => selectAsset(names, "3.13", "x86_64-unknown-linux-gnu")); +}); + +test("stable and latest resolve to a minor version", () => { + const t = "aarch64-apple-darwin"; + /** @param {string} v */ + const asset = (v) => `cpython-${v}+20261110-${t}-install_only_stripped.tar.gz`; + const names = ["3.12.12", "3.13.9", "3.14.1", "3.14.2", "3.15.0"].map(asset); + assert.equal(selectAsset(names, "latest", t).version, "3.15.0"); + assert.equal(selectAsset(names, "stable", t).version, "3.14.2"); + assert.equal(selectAsset(names.slice(0, 3), "stable", t).version, "3.13.9"); + assert.equal(selectAsset([asset("3.15.0")], "stable", t).version, "3.15.0"); + assert.throws(() => selectAsset([], "stable", t), /No python-build-standalone build/); +}); + +test("sha256 sums are parsed", () => { + const sums = parseSha256Sums("ABC123 file-a.tar.gz\ndef456 *file-b.tar.gz\n\n"); + assert.deepEqual(sums, { "file-a.tar.gz": "abc123", "file-b.tar.gz": "def456" }); +}); + +test("plugin backend detection", () => { + assert.equal(pluginBackend('[dependencies]\ntauri-plugin-python = "0.4"\n'), "pyo3"); + assert.equal( + pluginBackend('tauri-plugin-python = { version = "0.4", default-features = false, features = ["venv", "rustpython"] }'), + "rustpython", + ); + assert.equal( + pluginBackend('[dependencies.tauri-plugin-python]\nversion = "0.4"\nfeatures = ["rustpython"]\n'), + "rustpython", + ); + assert.equal(pluginBackend('[dependencies]\ntauri = "2"\n'), undefined); +}); + +test("package and product names", () => { + const toml = '[package]\nname = "my_app"\nversion = "0.1.0"\n\n[dependencies]\nname = "x"\n'; + assert.equal(packageName(toml), "my_app"); + assert.equal(productName({ productName: "My App" }, toml), "My App"); + assert.equal(productName({}, toml), "my_app"); +}); + +test("duplicate lockfile versions", () => { + /** @param {string} name @param {string} v */ + const lock = (name, v) => `[[package]]\nname = "${name}"\nversion = "${v}"\nsource = "x"\n\n`; + const text = lock("malachite-bigint", "0.9.2") + lock("foo", "1.0.0") + lock("malachite-bigint", "0.14.0"); + assert.deepEqual(duplicateLockVersions(text, "malachite-bigint"), ["0.9.2", "0.14.0"]); + assert.deepEqual(duplicateLockVersions(text, "foo"), []); +}); + +test("compiled entry detection", () => { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), "tpp-")); + try { + assert.equal(hasCompiledEntry(dir), false); + fs.writeFileSync(path.join(dir, "helper.so"), ""); + assert.equal(hasCompiledEntry(dir), false); + fs.writeFileSync(path.join(dir, "main.cpython-313-darwin.so"), ""); + assert.equal(hasCompiledEntry(dir), true); + assert.equal(hasCompiledEntry(path.join(dir, "missing")), false); + } finally { + fs.rmSync(dir, { recursive: true, force: true }); + } +}); + +test("resources that change meaning in the object form are not converted", () => { + assert.deepEqual( + unconvertibleResources(["src-python/", "icons/a.png", "../x.json", "/abs/a", "C:\\x", "a/**/*.md", "a/../b"]), + ["../x.json", "/abs/a", "C:\\x", "a/**/*.md", "a/../b"], + ); +}); + +test("doctor: an object in tauri..conf.json replaces list resources of tauri.conf.json", () => { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), "tpp-doctor-")); + try { + fs.mkdirSync(path.join(dir, "src-python")); + fs.writeFileSync(path.join(dir, "src-python", "main.py"), ""); + fs.writeFileSync(path.join(dir, "Cargo.toml"), '[package]\nname = "app"\n\n[dependencies]\ntauri-plugin-python = "0.4"\n'); + fs.writeFileSync(path.join(dir, "tauri.conf.json"), JSON.stringify({ bundle: { resources: ["src-python/"] } })); + const osName = osOf(hostTriple()); + fs.writeFileSync( + path.join(dir, `tauri.${osName}.conf.json`), + JSON.stringify({ bundle: { resources: { "pyembed/python/lib/": "pyembed/python/lib/" } } }), + ); + const findings = doctor({ project: dir }); + assert.ok(findings.some((f) => f.level === "error" && f.msg.startsWith("src-python/ is missing"))); + } finally { + fs.rmSync(dir, { recursive: true, force: true }); + } +}); + +test("venv created with another Python version is reported", () => { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), "tpp-venv-")); + try { + assert.equal(venvMismatch(dir, "3.13.18"), undefined); + const venv = path.join(dir, "src-python", ".venv"); + fs.mkdirSync(venv, { recursive: true }); + fs.writeFileSync(path.join(venv, "pyvenv.cfg"), "home = /usr/bin\nversion = 3.13.2\n"); + assert.equal(venvMismatch(dir, "3.13.18"), undefined); + fs.writeFileSync(path.join(venv, "pyvenv.cfg"), "home = /usr/bin\nversion_info = 3.14.0\n"); + assert.match(venvMismatch(dir, "3.13.18") ?? "", /Python 3\.14, the bundled Python is 3\.13/); + } finally { + fs.rmSync(dir, { recursive: true, force: true }); + } +}); + +test("python version is read from src-python/.python-version", () => { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), "tpp-pin-")); + try { + assert.equal(pinnedPythonVersion(dir), undefined); + assert.equal(writePythonPin(dir, "3.14"), undefined); + fs.mkdirSync(path.join(dir, "src-python")); + fs.writeFileSync(path.join(dir, "src-python", ".python-version"), "# comment\n\n 3.14 \n"); + assert.equal(pinnedPythonVersion(dir), "3.14"); + assert.equal(writePythonPin(dir, "3.14"), undefined); + assert.ok(writePythonPin(dir, "3.15")); + assert.equal(pinnedPythonVersion(dir), "3.15"); + } finally { + fs.rmSync(dir, { recursive: true, force: true }); + } +}); + +test("backend comes from the features, not from comments", () => { + assert.equal(pluginBackend('tauri-plugin-python = "0.4" # maybe rustpython later\n'), "pyo3"); + assert.equal( + pluginBackend('tauri-plugin-python = { version = "0.4", default-features = false, features = ["venv", "rustpython"] }\n'), + "rustpython", + ); + assert.equal( + pluginBackend('[dependencies.tauri-plugin-python]\nversion = "0.4"\nfeatures = ["rustpython"]\n'), + "rustpython", + ); +}); + +test("package name is found after array fields", () => { + assert.equal(packageName('[package]\nauthors = ["a"]\nname = "app"\n'), "app"); + assert.equal(packageName('[package]\nversion = "1"\n\n[dependencies]\nname = "x"\n'), undefined); +}); + +test("only the whole src-python directory counts as bundled", () => { + for (const src of ["src-python", "src-python/", "./src-python/", "src-python/*", "src-python/**/*"]) { + assert.ok(bundlesSrcPython({ [src]: src }), src); + } + assert.ok(!bundlesSrcPython({ "src-python/main.py": "src-python/main.py" })); + assert.ok(!bundlesSrcPython({ "src-python-old/": "x" })); +}); diff --git a/docs/deploy-linux.md b/docs/deploy-linux.md new file mode 100644 index 0000000..55b0684 --- /dev/null +++ b/docs/deploy-linux.md @@ -0,0 +1,118 @@ +# Deploying on Linux (PyO3) + +Step-by-step guide to ship a tauri app that uses tauri-plugin-python with the default PyO3 backend and runs on +Linux systems without a matching Python. Using RustPython instead? Then no extra steps are needed; just bundle +`src-python/` (see [Deployment](../README.md#deployment)). + +Also see: [macOS](deploy-macos.md) · [Windows](deploy-windows.md) + +## 1. Prerequisites + +- Node.js 18 or newer (for `npx`), Rust and the + [tauri prerequisites for Linux](https://v2.tauri.app/start/prerequisites/#linux). +- `tar` on the `PATH` (to unpack the Python download). +- A Python on the development machine is only needed for `tauri dev` without a bundled Python. +- Build on the oldest distribution you want to support. The app binary links against the build machine's + glibc and WebKitGTK, so a package built on a new distribution doesn't start on an older one. Ubuntu 22.04 is a + common baseline. + +## 2. Python code and dependencies + +``` +src-tauri/ +├── src-python/ +│ ├── main.py # entry point (or a compiled main.*.so, see README) +│ └── requirements.txt # pip dependencies, optional +└── tauri.conf.json # "bundle": { "resources": ["src-python/"] } +``` + +List pip packages in `src-python/requirements.txt` instead of bundling a `.venv`. A venv only works on the +machine it was created on. + +## 3. Bundle Python + +Run in the project root or in `src-tauri`: + +```sh +npx tauri-plugin-python-cli setup +``` + +This downloads a relocatable Python to +`src-tauri/pyembed/python`, installs `requirements.txt` into it and changes these files: + +| File | Change | +| --- | --- | +| `src-tauri/.cargo/config.toml` | managed block: `PYO3_CONFIG_FILE` and an rpath to `$ORIGIN/../lib//pyembed/python/lib` | +| `src-tauri/tauri.linux.conf.json` | the stdlib and `libpython3.13.so.1.0` as resources | +| `src-tauri/tauri.conf.json` | `bundle.resources` converted to the object form, so tauri merges both files | +| `src-tauri/.gitignore` | `/pyembed/` | +| `src-tauri/src-python/.python-version` | the Python minor version, if the file didn't exist | + +The rpath contains the `productName` from `tauri.conf.json`. Run `setup` again when you rename the app. + +Commit the config changes, not `pyembed/`. Run `setup` again after cloning and whenever `requirements.txt` +changes. +Without it, the build fails with `failed to open PyO3 config file at …/pyembed/pyo3-config.txt`, +because the committed `.cargo/config.toml` points to a file in the uncommitted `pyembed/`. + +The Python version comes from `src-python/.python-version` (e.g. `3.13`, same format as `uv python pin`). If the +file is missing, `setup` takes the newest Python that reached its x.y.2 bugfix release (`stable`) and writes its +minor version there. Commit that file so the team and CI bundle the same version. To change it, edit the file or +run `npx tauri-plugin-python-cli setup --python 3.14` (also an exact `3.14.2`, `stable` or `latest`), which updates the file. + +`tauri dev` now also uses the bundled Python. Check the project: + +```sh +npx tauri-plugin-python-cli doctor +``` + +## 4. Build + +```sh +npm run tauri build # all configured bundles +npm run tauri build -- --bundles deb # or only one: deb, rpm, appimage +``` + +## 5. Verify + +```sh +npx tauri-plugin-python-cli doctor +readelf -d src-tauri/target/release/ | grep -E 'NEEDED.*python|RUNPATH|RPATH' +``` + +`doctor` checks that the binary needs `libpython3.13.so.1.0` and has the rpath into the app's lib folder. To +test like a user, install the package on a clean machine or container without Python: + +```sh +dpkg -c src-tauri/target/release/bundle/deb/*.deb | grep pyembed # files land in /usr/lib//pyembed +``` + +The CI of this repository installs the `.deb` with `apt` in a fresh `ubuntu:22.04` container without Python and +starts it there. `rpm` and AppImage use the same layout but are not tested in CI. + +## CI (GitHub Actions) + +```yaml +runs-on: ubuntu-22.04 +steps: + - uses: actions/checkout@v4 + - run: | + sudo apt-get update + sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf + - uses: actions/setup-node@v4 + with: + node-version: lts/* + - run: npx tauri-plugin-python-cli setup + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # avoids GitHub API rate limits + - run: npm install && npm run tauri build +``` + +## Troubleshooting + +| Symptom | Cause / fix | +| --- | --- | +| `error while loading shared libraries: libpython3.13.so.1.0` | `RUSTFLAGS` in the environment replaces the rpaths from `.cargo/config.toml`, or `productName` changed after `setup`. `doctor` reports both. | +| App works only on the build machine | `setup` wasn't run before the build; the binary links the host Python. | +| App doesn't start on an older distribution (`GLIBC_2.xx not found`) | build on an older distribution, see Prerequisites. | +| `ModuleNotFoundError` for a pip package | add it to `requirements.txt` and run `setup` again. | diff --git a/docs/deploy-macos.md b/docs/deploy-macos.md new file mode 100644 index 0000000..0b9efe6 --- /dev/null +++ b/docs/deploy-macos.md @@ -0,0 +1,123 @@ +# Deploying on macOS (PyO3) + +Step-by-step guide to ship a tauri app that uses tauri-plugin-python with the default PyO3 backend and runs on +Macs without Python installed. Using RustPython instead? Then no extra steps are needed; just bundle +`src-python/` (see [Deployment](../README.md#deployment)). + +Also see: [Linux](deploy-linux.md) · [Windows](deploy-windows.md) + +## 1. Prerequisites + +- Node.js 18 or newer (for `npx`), Rust and the tauri prerequisites for macOS. +- A Python on the development machine is only needed for `tauri dev` without a bundled Python. +- Build on the architecture you ship: an Apple Silicon Mac builds `aarch64-apple-darwin`, an Intel Mac + `x86_64-apple-darwin`. Universal binaries are not supported by the CLI yet. + +## 2. Python code and dependencies + +``` +src-tauri/ +├── src-python/ +│ ├── main.py # entry point (or a compiled main.*.so, see README) +│ └── requirements.txt # pip dependencies, optional +└── tauri.conf.json # "bundle": { "resources": ["src-python/"] } +``` + +List pip packages in `src-python/requirements.txt` instead of bundling a `.venv`. A venv only works on the +machine it was created on. + +## 3. Bundle Python + +Run in the project root or in `src-tauri`: + +```sh +npx tauri-plugin-python-cli setup +``` + +This downloads a relocatable Python to +`src-tauri/pyembed/python`, installs `requirements.txt` into it and changes these files: + +| File | Change | +| --- | --- | +| `src-tauri/.cargo/config.toml` | managed block: `PYO3_CONFIG_FILE` and an rpath to `../Resources/pyembed/python/lib` | +| `src-tauri/tauri.macos.conf.json` | the stdlib and `libpython3.13.dylib` as resources | +| `src-tauri/tauri.conf.json` | `bundle.resources` converted to the object form, so tauri merges both files | +| `src-tauri/.gitignore` | `/pyembed/` | +| `src-tauri/src-python/.python-version` | the Python minor version, if the file didn't exist | + +Commit the config changes, not `pyembed/`. Run `setup` again after cloning and whenever `requirements.txt` +changes. +Without it, the build fails with `failed to open PyO3 config file at …/pyembed/pyo3-config.txt`, +because the committed `.cargo/config.toml` points to a file in the uncommitted `pyembed/`. + +The Python version comes from `src-python/.python-version` (e.g. `3.13`, same format as `uv python pin`). If the +file is missing, `setup` takes the newest Python that reached its x.y.2 bugfix release (`stable`) and writes its +minor version there. Commit that file so the team and CI bundle the same version. To change it, edit the file or +run `npx tauri-plugin-python-cli setup --python 3.14` (also an exact `3.14.2`, `stable` or `latest`), which updates the file. + +`tauri dev` now also uses the bundled Python. Check the project: + +```sh +npx tauri-plugin-python-cli doctor +``` + +## 4. Sign the bundled Python (only for distribution) + +Skip this step for local test builds. Apps distributed outside the App Store must be notarized, and +notarization rejects any unsigned native file in the app. Tauri signs only the main binary, not resources, so +sign the Python files **before** `tauri build`, with the same identity tauri uses: + +```sh +export APPLE_SIGNING_IDENTITY="Developer ID Application: Your Name (TEAMID)" +npx tauri-plugin-python-cli sign +``` + +This signs every Mach-O file in `src-tauri/pyembed/python` with `--options runtime --timestamp`. Pass +`--entitlements ` if your packages need extra hardened-runtime entitlements. Run `sign` again after each +`setup`. + +## 5. Build + +```sh +npm run tauri build +``` + +With `APPLE_SIGNING_IDENTITY` and the notarization variables (`APPLE_ID`, `APPLE_PASSWORD`, `APPLE_TEAM_ID` or +an App Store Connect API key) set, tauri signs and notarizes the app. See the +[tauri macOS signing guide](https://v2.tauri.app/distribute/sign/macos/). + +## 6. Verify + +```sh +npx tauri-plugin-python-cli doctor +otool -L "src-tauri/target/release/bundle/macos/.app/Contents/MacOS/" | grep -i python +``` + +`doctor` checks that the binary loads `@rpath/libpython3.13.dylib`, not a Python from Homebrew or +`/Library/Frameworks`. To test like a user, copy the `.app` to another folder or Mac without Python and start +it. The Python files are in `.app/Contents/Resources/pyembed/python`. + +## CI (GitHub Actions) + +```yaml +- uses: actions/checkout@v4 +- uses: actions/setup-node@v4 + with: + node-version: lts/* +- run: npx tauri-plugin-python-cli setup + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # avoids GitHub API rate limits +# - run: npx tauri-plugin-python-cli sign # with APPLE_SIGNING_IDENTITY and the certificate imported +- run: npm install && npm run tauri build +``` + +`macos-latest` builds for Apple Silicon; use an Intel runner for `x86_64` builds. + +## Troubleshooting + +| Symptom | Cause / fix | +| --- | --- | +| `Library not loaded: @rpath/libpython3.13.dylib` | `RUSTFLAGS` in the environment replaces the rpaths from `.cargo/config.toml`; unset it or add the rpaths there. `doctor` reports this. | +| App works only on the build Mac | `setup` wasn't run before the build; the binary links the host Python. | +| Notarization: "The binary is not signed" for a file in `Resources/pyembed` | `sign` wasn't run, or `setup` ran again afterwards. | +| `ModuleNotFoundError` for a pip package | add it to `requirements.txt` and run `setup` again. | diff --git a/docs/deploy-windows.md b/docs/deploy-windows.md new file mode 100644 index 0000000..fe795d1 --- /dev/null +++ b/docs/deploy-windows.md @@ -0,0 +1,113 @@ +# Deploying on Windows (PyO3) + +Step-by-step guide to ship a tauri app that uses tauri-plugin-python with the default PyO3 backend and runs on +Windows machines without Python installed. Using RustPython instead? Then no extra steps are needed; just bundle +`src-python/` (see [Deployment](../README.md#deployment)). + +Also see: [macOS](deploy-macos.md) · [Linux](deploy-linux.md) + +## 1. Prerequisites + +- Node.js 18 or newer (for `npx`), Rust with the MSVC toolchain and the + [tauri prerequisites for Windows](https://v2.tauri.app/start/prerequisites/#windows). +- `tar` on the `PATH`. It ships with Windows 10 and newer. +- A Python on the development machine is only needed for `tauri dev` without a bundled Python. +- Build on the architecture you ship (`x86_64` or `aarch64`). + +## 2. Python code and dependencies + +``` +src-tauri\ +├── src-python\ +│ ├── main.py # entry point (or a compiled main.*.pyd, see README) +│ └── requirements.txt # pip dependencies, optional +└── tauri.conf.json # "bundle": { "resources": ["src-python/"] } +``` + +List pip packages in `src-python\requirements.txt` instead of bundling a `.venv`. A venv only works on the +machine it was created on. + +## 3. Bundle Python + +Run in the project root or in `src-tauri`, in PowerShell, cmd or Git Bash: + +```sh +npx tauri-plugin-python-cli setup +``` + +This downloads a relocatable Python to +`src-tauri\pyembed\python`, installs `requirements.txt` into it and changes these files: + +| File | Change | +| --- | --- | +| `src-tauri\.cargo\config.toml` | managed block: `PYO3_CONFIG_FILE` (link against `pyembed\python\libs\python313.lib`) | +| `src-tauri\tauri.windows.conf.json` | the Python folder as resource, plus `python313.dll` and `python3.dll` next to the `.exe` | +| `src-tauri\tauri.conf.json` | `bundle.resources` converted to the object form, so tauri merges both files | +| `src-tauri\.gitignore` | `/pyembed/` | +| `src-tauri\src-python\.python-version` | the Python minor version, if the file didn't exist | + +Windows has no rpath: the loader finds `python313.dll` because it is placed next to the `.exe`. + +Commit the config changes, not `pyembed\`. Run `setup` again after cloning and whenever `requirements.txt` +changes. +Without it, the build fails with `failed to open PyO3 config file at …\pyembed\pyo3-config.txt`, +because the committed `.cargo/config.toml` points to a file in the uncommitted `pyembed/`. + +The Python version comes from `src-python/.python-version` (e.g. `3.13`, same format as `uv python pin`). If the +file is missing, `setup` takes the newest Python that reached its x.y.2 bugfix release (`stable`) and writes its +minor version there. Commit that file so the team and CI bundle the same version. To change it, edit the file or +run `npx tauri-plugin-python-cli setup --python 3.14` (also an exact `3.14.2`, `stable` or `latest`), which updates the file. + +`tauri dev` now also uses the bundled Python. Check the project: + +```sh +npx tauri-plugin-python-cli doctor +``` + +## 4. Build + +```sh +npm run tauri build # all configured bundles +npm run tauri build -- --bundles nsis # or only one: nsis, msi +``` + +To sign the app, see the [tauri Windows signing guide](https://v2.tauri.app/distribute/sign/windows/). Tauri +signs the `.exe` and the installer, not the bundled Python files; Windows usually doesn't require them to be +signed. + +## 5. Verify + +```sh +npx tauri-plugin-python-cli doctor +``` + +`doctor` checks that `python313.dll` sits next to the built `.exe`. To test like a user, install the app on a +machine or VM without Python and start it. After installation, the install folder contains the `.exe`, +`python313.dll`, `python3.dll`, `pyembed\python\` and `src-python\`. + +The CI of this repository installs the NSIS installer silently and starts the app this way. MSI uses the same +layout but is not tested in CI. + +## CI (GitHub Actions) + +```yaml +runs-on: windows-latest +steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts/* + - run: npx tauri-plugin-python-cli setup + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # avoids GitHub API rate limits + - run: npm install && npm run tauri build +``` + +## Troubleshooting + +| Symptom | Cause / fix | +| --- | --- | +| `python313.dll was not found` | the DLL resources are missing in `tauri.windows.conf.json`; run `setup` again and check with `doctor`. | +| App works only on the build machine | `setup` wasn't run before the build; the binary links the host Python. | +| `print()` output is missing in release builds | release builds have no console; see [Windows: hidden console & stdio](../README.md#windows-hidden-console--stdio). | +| `ModuleNotFoundError` for a pip package | add it to `requirements.txt` and run `setup` again. | diff --git a/examples/plain-javascript/ci/launch_bundled.mjs b/examples/plain-javascript/ci/launch_bundled.mjs new file mode 100644 index 0000000..dc87753 --- /dev/null +++ b/examples/plain-javascript/ci/launch_bundled.mjs @@ -0,0 +1,48 @@ +// Starts an installed app with a minimal environment, waits for the report of +// ci/probe_main.py and checks that it ran the bundled Python. +// Usage: node launch_bundled.mjs +import { spawn } from "node:child_process"; +import fs from "node:fs"; +import path from "node:path"; + +const [exe, report] = process.argv.slice(2); +const passthrough = ["DISPLAY", "XAUTHORITY", "SystemRoot", "SystemDrive", "TEMP", "TMP", "LOCALAPPDATA", "APPDATA", "USERPROFILE", "HOME"]; +const env = Object.fromEntries(passthrough.filter((k) => process.env[k]).map((k) => [k, process.env[k]])); +env.E2E_REPORT = report; + +fs.rmSync(report, { force: true }); +const child = spawn(exe, [], { env, cwd: path.dirname(report), stdio: "inherit" }); +let exited = false; +child.on("exit", (code) => { + exited = true; + console.log(`app exited with ${code} (0x${(code >>> 0).toString(16)})`); +}); + +function fail(msg) { + console.error(`FAIL: ${msg}`); + console.error(`exe: ${exe}\nenv: ${JSON.stringify(env)}`); + for (const dir of [path.dirname(exe), path.resolve(path.dirname(exe), "..")]) { + console.error(`${dir}: ${fs.readdirSync(dir).slice(0, 100).join(", ")}`); + } + process.exit(1); +} + +const deadline = Date.now() + 60_000; +while (!fs.existsSync(report) && !exited && Date.now() < deadline) { + await new Promise((r) => setTimeout(r, 500)); +} +await new Promise((r) => setTimeout(r, 500)); +child.kill(); + +if (!fs.existsSync(report)) fail("no report - Python did not run main.py"); +const text = fs.readFileSync(report, "utf8"); +console.log(text); +const prefix = (/^prefix=(.*)$/m.exec(text)?.[1] ?? "").replace(/^\\\\\?\\/, ""); +const errors = []; +if (!prefix.replaceAll("\\", "/").includes("pyembed/python")) errors.push(`not the bundled Python: ${prefix}`); +if (!path.resolve(prefix).startsWith(path.resolve(path.dirname(exe), ".."))) { + errors.push(`Python is not loaded from the installed app: ${prefix}`); +} +if (/^FAIL/m.test(text)) errors.push("modules failed to import"); +if (errors.length) fail(errors.join("; ")); +console.log("OK: app runs the bundled Python"); diff --git a/examples/plain-javascript/ci/probe_main.py b/examples/plain-javascript/ci/probe_main.py new file mode 100644 index 0000000..5b198b7 --- /dev/null +++ b/examples/plain-javascript/ci/probe_main.py @@ -0,0 +1,20 @@ +# CI replacement for src-python/main.py: reports which Python the bundled app +# runs and whether stdlib and native modules load, to the file in E2E_REPORT. +import os +import sys + +_tauri_plugin_functions = ["greet_python"] + +lines = ["prefix=" + sys.prefix, "version=" + sys.version.split()[0]] +for mod in ["json", "asyncio", "ssl", "sqlite3", "ctypes", "decimal", "zlib", "lzma", "hashlib", "markupsafe._speedups"]: + try: + __import__(mod) + lines.append("ok " + mod) + except Exception as e: + lines.append("FAIL %s: %r" % (mod, e)) +with open(os.environ["E2E_REPORT"], "w") as f: + f.write("\n".join(lines) + "\n") + + +def greet_python(input): + return "Hello " + str(input) diff --git a/examples/plain-javascript/src-tauri/Cargo.lock b/examples/plain-javascript/src-tauri/Cargo.lock index d53ac5c..2ecea7e 100644 --- a/examples/plain-javascript/src-tauri/Cargo.lock +++ b/examples/plain-javascript/src-tauri/Cargo.lock @@ -28,15 +28,15 @@ dependencies = [ [[package]] name = "alloc-no-stdlib" -version = "2.0.4" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" +checksum = "c2fb6cfd47bf496ff64095c20eaba0c201404ee38714d4142fcfa1dc334fcc7a" [[package]] name = "alloc-stdlib" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +checksum = "0b5c1865780388bfa186411ab5f247819487fc4864c6e9c3106611fa347586e1" dependencies = [ "alloc-no-stdlib", ] @@ -75,9 +75,9 @@ dependencies = [ [[package]] name = "async_py" -version = "0.3.2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f074898c46ee54f4549418e4fadc3fd1320c13460374e5237153a5f38da25659" +checksum = "ed830613c3ffcc75dfa8eb5fa6612920caca9b5e1b1a841d6b6843dd5757f404" dependencies = [ "dunce", "pyo3", @@ -148,13 +148,28 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + [[package]] name = "bit-set" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ - "bit-vec", + "bit-vec 0.8.0", +] + +[[package]] +name = "bit-set" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56d87354e4229f54a44f7bf2435906a4656dba36026ab6eaca629a2c436a691c" +dependencies = [ + "bit-vec 0.10.2", ] [[package]] @@ -163,6 +178,12 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" +[[package]] +name = "bit-vec" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72503af1e72be411d74ca45cd6b309878fcb35354e252fc2a3a8bda3a97082a0" + [[package]] name = "bitflags" version = "1.3.2" @@ -207,9 +228,9 @@ dependencies = [ [[package]] name = "brotli" -version = "8.0.4" +version = "9.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc91aac060a7a1e25823bdccbfb6af1875b88f17c6daac97894eed8207166b3" +checksum = "627b7cfb0578f0eafce087a90fcd40add1231900b69e4d4de2d456260a4f5d81" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -218,9 +239,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "5.0.3" +version = "6.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a32acac15fe1967bc3986b2a6347dffc965602354ea6f450ad07e8bfd253583" +checksum = "75c74c9c51b9140663e196b5fb88bc94c334d7a497c8311cb759d8557874747f" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -312,12 +333,13 @@ dependencies = [ [[package]] name = "cargo_toml" -version = "0.22.3" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374b7c592d9c00c1f4972ea58390ac6b18cbb6ab79011f3bdc90a0b82ca06b77" +checksum = "82f4b26e751e711a5302649417f2da046dce6391b2ea30a4820f37462314f0b9" dependencies = [ + "semver", "serde", - "toml 0.9.12+spec-1.1.0", + "toml 1.1.2+spec-1.1.0", ] [[package]] @@ -337,13 +359,13 @@ checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" [[package]] name = "cfb" -version = "0.7.3" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f" +checksum = "a347dcabdae9c31b0825fd6a8bed285ec9c2acb89c47827126d52fa4f59cece3" dependencies = [ - "byteorder", "fnv", "uuid", + "web-time", ] [[package]] @@ -499,42 +521,45 @@ dependencies = [ [[package]] name = "cssparser" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dae61cf9c0abb83bd659dab65b7e4e38d8236824c85f0f804f173567bda257d2" +checksum = "8c9cdaae01d5ed7882b04d795e7f752f46ff52d2fa3b50a20d28c464510bba98" dependencies = [ "cssparser-macros", "dtoa-short", "itoa", - "phf", + "phf 0.13.1", "smallvec", ] [[package]] -name = "cssparser-macros" -version = "0.6.1" +name = "cssparser" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" +checksum = "11119743ad110e8c1bdccd930d7f5c30c99e5fc76a7b63ec9807e84eef0c5f59" dependencies = [ - "quote", - "syn 2.0.90", + "cssparser-macros", + "dtoa-short", + "itoa", + "phf 0.14.0", + "smallvec", ] [[package]] -name = "ctor" -version = "0.8.0" +name = "cssparser-macros" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "352d39c2f7bef1d6ad73db6f5160efcaed66d94ef8c6c573a8410c00bf909a98" +checksum = "d045de693cb712d0b22c6a64be5b953f67b3ce00ab5ad3dd5d8b441886ab8e1a" dependencies = [ - "ctor-proc-macro", - "dtor", + "quote", + "syn 3.0.10", ] [[package]] -name = "ctor-proc-macro" -version = "0.0.7" +name = "ctor" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52560adf09603e58c9a7ee1fe1dcb95a16927b17c127f0ac02d6e768a0e25bc1" +checksum = "914a755b7c2d4af2bdcff7ce1739e2db9a1b81a9b07123d8015786ae03c0980d" [[package]] name = "darling" @@ -625,9 +650,9 @@ dependencies = [ [[package]] name = "dirs" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +checksum = "8d57d423b3c82e89b9a24ca3091fee61f456a26edbd28d26c65906f4bc1dcd8f" dependencies = [ "dirs-sys", ] @@ -692,16 +717,31 @@ dependencies = [ [[package]] name = "dom_query" -version = "0.27.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "521e380c0c8afb8d9a1e83a1822ee03556fc3e3e7dbc1fd30be14e37f9cb3f89" +checksum = "fac5fca71e65e94cc718a6e2af65d6e0f9c6027751c2aa562fbb5087fda639bc" dependencies = [ - "bit-set", - "cssparser", + "bit-set 0.8.0", + "cssparser 0.37.0", "foldhash", - "html5ever", + "html5ever 0.39.0", "precomputed-hash", - "selectors", + "selectors 0.38.0", + "tendril", +] + +[[package]] +name = "dom_query" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "498c698ac51127148a3984450e51fca7f01805a91d7a1f7a24af0a5f761e3385" +dependencies = [ + "bit-set 0.11.1", + "cssparser 0.38.0", + "foldhash", + "html5ever 0.40.1", + "precomputed-hash", + "selectors 0.41.0", "tendril", ] @@ -729,21 +769,6 @@ dependencies = [ "dtoa", ] -[[package]] -name = "dtor" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1057d6c64987086ff8ed0fd3fbf377a6b7d205cc7715868cd401705f715cbe4" -dependencies = [ - "dtor-proc-macro", -] - -[[package]] -name = "dtor-proc-macro" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f678cf4a922c215c63e0de95eb1ff08a958a81d47e485cf9da1e27bf6305cfa5" - [[package]] name = "dunce" version = "1.0.5" @@ -868,9 +893,9 @@ checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" [[package]] name = "form_urlencoded" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" dependencies = [ "percent-encoding", ] @@ -1265,12 +1290,23 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "html5ever" -version = "0.38.0" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46a1761807faccc9a19e86944bbf40610014066306f96edcdedc2fb714bcb7b8" +dependencies = [ + "log", + "markup5ever 0.39.0", +] + +[[package]] +name = "html5ever" +version = "0.40.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1054432bae2f14e0061e33d23402fbaa67a921d319d56adc6bcf887ddad1cbc2" +checksum = "456a1a377e608e555d22ddab27ac0114bc7a7b4199078108e34c2aeae6c9b130" dependencies = [ "log", - "markup5ever", + "markup5ever 0.40.0", + "memchr", ] [[package]] @@ -1381,12 +1417,12 @@ dependencies = [ [[package]] name = "ico" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e795dff5605e0f04bff85ca41b51a96b83e80b281e96231bcaaf1ac35103371" +checksum = "d75e94d66081e4d8dcd098bd8dc5254800fea14a26389b298410158d834de167" dependencies = [ "byteorder", - "png 0.17.15", + "png", ] [[package]] @@ -1396,9 +1432,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" dependencies = [ "displaydoc", - "yoke", + "yoke 0.7.5", + "zerofrom", + "zerovec 0.10.4", +] + +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke 0.8.1", "zerofrom", - "zerovec", + "zerovec 0.11.5", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap 0.8.3", + "tinystr 0.8.2", + "writeable 0.6.4", + "zerovec 0.11.5", ] [[package]] @@ -1408,10 +1470,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" dependencies = [ "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", + "litemap 0.7.4", + "tinystr 0.7.6", + "writeable 0.5.5", + "zerovec 0.10.4", ] [[package]] @@ -1423,9 +1485,9 @@ dependencies = [ "displaydoc", "icu_locid", "icu_locid_transform_data", - "icu_provider", - "tinystr", - "zerovec", + "icu_provider 1.5.0", + "tinystr 0.7.6", + "zerovec 0.10.4", ] [[package]] @@ -1441,15 +1503,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" dependencies = [ "displaydoc", - "icu_collections", + "icu_collections 1.5.0", "icu_normalizer_data", - "icu_properties", - "icu_provider", + "icu_properties 1.5.1", + "icu_provider 1.5.0", "smallvec", "utf16_iter", "utf8_iter", "write16", - "zerovec", + "zerovec 0.10.4", ] [[package]] @@ -1465,12 +1527,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" dependencies = [ "displaydoc", - "icu_collections", + "icu_collections 1.5.0", "icu_locid_transform", - "icu_properties_data", - "icu_provider", - "tinystr", - "zerovec", + "icu_properties_data 1.5.0", + "icu_provider 1.5.0", + "tinystr 0.7.6", + "zerovec 0.10.4", +] + +[[package]] +name = "icu_properties" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +dependencies = [ + "icu_collections 2.1.1", + "icu_locale_core", + "icu_properties_data 2.1.2", + "icu_provider 2.1.1", + "zerotrie", + "zerovec 0.11.5", ] [[package]] @@ -1479,6 +1555,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" +[[package]] +name = "icu_properties_data" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" + [[package]] name = "icu_provider" version = "1.5.0" @@ -1489,11 +1571,26 @@ dependencies = [ "icu_locid", "icu_provider_macros", "stable_deref_trait", - "tinystr", - "writeable", - "yoke", + "tinystr 0.7.6", + "writeable 0.5.5", + "yoke 0.7.5", + "zerofrom", + "zerovec 0.10.4", +] + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable 0.6.4", + "yoke 0.8.1", "zerofrom", - "zerovec", + "zerotrie", + "zerovec 0.11.5", ] [[package]] @@ -1515,9 +1612,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "1.0.3" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" dependencies = [ "idna_adapter", "smallvec", @@ -1531,7 +1628,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" dependencies = [ "icu_normalizer", - "icu_properties", + "icu_properties 1.5.1", ] [[package]] @@ -1559,9 +1656,9 @@ dependencies = [ [[package]] name = "infer" -version = "0.19.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a588916bfdfd92e71cacef98a63d9b1f0d74d6599980d11894290e7ddefffcf7" +checksum = "f4200d433cbd5178df7797c9c2e75b348b728e39631cf14520d1e2fc424201f4" dependencies = [ "cfb", ] @@ -1636,21 +1733,21 @@ dependencies = [ [[package]] name = "json-patch" -version = "3.0.1" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "863726d7afb6bc2590eeff7135d923545e5e964f004c2ccf8716c25e70a86f08" +checksum = "7421438de105a0827e44fadd05377727847d717c80ce29a229f85fd04c427b72" dependencies = [ "jsonptr", "serde", "serde_json", - "thiserror 1.0.69", + "thiserror 2.0.9", ] [[package]] name = "jsonptr" -version = "0.6.3" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dea2b27dd239b2556ed7a25ba842fe47fd602e7fc7433c2a8d6106d4d9edd70" +checksum = "a5a3cc660ba5d72bce0b3bb295bf20847ccbb40fd423f3f05b61273672e561fe" dependencies = [ "serde", "serde_json", @@ -1658,13 +1755,12 @@ dependencies = [ [[package]] name = "keyboard-types" -version = "0.7.0" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b750dcadc39a09dbadd74e118f6dd6598df77fa01df0cfcdc52c28dece74528a" +checksum = "0fbe853b403ae61a04233030ae8a79d94975281ed9770a1f9e246732b534b28d" dependencies = [ "bitflags 2.6.0", "serde", - "unicode-segmentation", ] [[package]] @@ -1732,6 +1828,12 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + [[package]] name = "lock_api" version = "0.4.12" @@ -1744,26 +1846,37 @@ dependencies = [ [[package]] name = "log" -version = "0.4.22" +version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" [[package]] name = "markup5ever" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8983d30f2915feeaaab2d6babdd6bc7e9ed1a00b66b5e6d74df19aa9c0e91862" +checksum = "7122d987ec5f704ee56f6e5b41a7d93722e9aae27ae07cafa4036c4d3f9757de" dependencies = [ "log", "tendril", - "web_atoms", + "web_atoms 0.2.5", +] + +[[package]] +name = "markup5ever" +version = "0.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab3dc68ac4a0f5719e560136778c1ee716e296030d75dbd4484e37e39e3a842" +dependencies = [ + "log", + "tendril", + "web_atoms 0.3.0", ] [[package]] name = "memchr" -version = "2.7.4" +version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" [[package]] name = "memoffset" @@ -1803,9 +1916,9 @@ dependencies = [ [[package]] name = "muda" -version = "0.19.3" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd04e60bc0b07438a6771710ee1698f98f6ebbc7f89b61264af1563b8aeb878" +checksum = "cca139e57da4383727f189e43e66e84fa372347027fc996f9f1a007ec0a37996" dependencies = [ "crossbeam-channel", "dpi", @@ -1816,7 +1929,7 @@ dependencies = [ "objc2-core-foundation", "objc2-foundation 0.3.2", "once_cell", - "png 0.18.1", + "png", "serde", "thiserror 2.0.9", "windows-sys 0.61.2", @@ -1837,6 +1950,12 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + [[package]] name = "ndk-sys" version = "0.6.0+11769913" @@ -1925,6 +2044,7 @@ dependencies = [ "objc2 0.6.4", "objc2-core-foundation", "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", ] [[package]] @@ -2207,9 +2327,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "phf" @@ -2217,8 +2337,19 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" dependencies = [ - "phf_macros", - "phf_shared", + "phf_macros 0.13.1", + "phf_shared 0.13.1", + "serde", +] + +[[package]] +name = "phf" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "010378780309880b08997fae13be7834dba947d36393bd372f2b1556deb2a2f6" +dependencies = [ + "phf_macros 0.14.0", + "phf_shared 0.14.0", "serde", ] @@ -2228,8 +2359,18 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1" dependencies = [ - "phf_generator", - "phf_shared", + "phf_generator 0.13.1", + "phf_shared 0.13.1", +] + +[[package]] +name = "phf_codegen" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41b585a510fb76fdebead6897982ef2a03a21d8e6cbcca904999742a4afc6ffe" +dependencies = [ + "phf_generator 0.14.0", + "phf_shared 0.14.0", ] [[package]] @@ -2239,7 +2380,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" dependencies = [ "fastrand", - "phf_shared", + "phf_shared 0.13.1", +] + +[[package]] +name = "phf_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeb62e0959d5a1bebc965f4d15d9e2b7cea002b6b0f5ba8cde6cc26738467100" +dependencies = [ + "fastrand", + "phf_shared 0.14.0", ] [[package]] @@ -2248,8 +2399,21 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" dependencies = [ - "phf_generator", - "phf_shared", + "phf_generator 0.13.1", + "phf_shared 0.13.1", + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "phf_macros" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fa8d0ca26d424d27630da600c6624696e7dec8bf7b3b492b383c5dc49e5e085" +dependencies = [ + "phf_generator 0.14.0", + "phf_shared 0.14.0", "proc-macro2", "quote", "syn 2.0.90", @@ -2264,6 +2428,15 @@ dependencies = [ "siphasher", ] +[[package]] +name = "phf_shared" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fd9027e2d9319be6349febd1db4e8d02aa544921200c9b777720ac34a3aa89" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project-lite" version = "0.2.15" @@ -2306,19 +2479,6 @@ dependencies = [ "time", ] -[[package]] -name = "png" -version = "0.17.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67582bd5b65bdff614270e2ea89a1cf15bef71245cc1e5f7ea126977144211d" -dependencies = [ - "bitflags 1.3.2", - "crc32fast", - "fdeflate", - "flate2", - "miniz_oxide", -] - [[package]] name = "png" version = "0.18.1" @@ -2338,6 +2498,15 @@ version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec 0.11.5", +] + [[package]] name = "powerfmt" version = "0.2.0" @@ -2405,9 +2574,9 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd274650b21d4bfc26a0a47587962c1edb425f69287324355cd040c3ea66071c" +checksum = "229ca13b8a15bb0d1487b81ab975bfcd97513416499a8312011b6036e42e0de4" dependencies = [ "libc", "once_cell", @@ -2419,18 +2588,18 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e2a7d2f0d013342f295c048ad19237add5154a55b1c5a254c0ec93d4109078" +checksum = "70130e2b6dd1ee589a8788026a429561ca5c40fa7a2fa7914c2282eddae24700" dependencies = [ "target-lexicon 0.13.3", ] [[package]] name = "pyo3-ffi" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca85c467da1bbc8d866eea5deff9cf29ea5f7785054a17da36e65bda9c05845b" +checksum = "5e7ff73c555c286d212d4ce7e5fbda845a973c4f61bd5f160f5f2c3c2a04d1c4" dependencies = [ "libc", "pyo3-build-config", @@ -2438,26 +2607,26 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac53762fd065daa3194dd09337a38bd793a188100fd1a9304c4ab312d901771" +checksum = "c46d2e5862c7bb8207e3b639f713dda3c499933444784154c11d013c5a691b60" dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn 2.0.90", + "syn 3.0.10", ] [[package]] name = "pyo3-macros-backend" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca3a1557399783172dc5bf39cfca835157732532cba56b71d2292161e53b362" +checksum = "38b89f066f2ae72a2aef52d1537ca2fcd104440ebfadee06e97aa90738a25b9b" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.90", + "syn 3.0.10", ] [[package]] @@ -2471,9 +2640,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.37" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" dependencies = [ "proc-macro2", ] @@ -2617,9 +2786,9 @@ dependencies = [ [[package]] name = "schemars" -version = "0.8.21" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" +checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" dependencies = [ "dyn-clone", "indexmap 1.9.3", @@ -2632,9 +2801,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.21" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1eee588578aff73f856ab961cd2f79e36bc45d7ded33a7562adba4667aecc0e" +checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" dependencies = [ "proc-macro2", "quote", @@ -2650,30 +2819,48 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "selectors" -version = "0.36.1" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8adfa1c298912827b8a28b223b3b874357397ae706e6190acd9bf28cee99114d" +dependencies = [ + "bitflags 2.6.0", + "cssparser 0.37.0", + "derive_more", + "log", + "new_debug_unreachable", + "phf 0.13.1", + "phf_codegen 0.13.1", + "precomputed-hash", + "rustc-hash", + "servo_arc 0.4.3", + "smallvec", +] + +[[package]] +name = "selectors" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5d9c0c92a92d33f08817311cf3f2c29a3538a8240e94a6a3c622ce652d7e00c" +checksum = "8322aebea94a6cc288ff884e8a49bdbceef60206c400c6c46d22e62fc4fd91a6" dependencies = [ "bitflags 2.6.0", - "cssparser", + "cssparser 0.38.0", "derive_more", "log", "new_debug_unreachable", - "phf", - "phf_codegen", "precomputed-hash", "rustc-hash", - "servo_arc", + "servo_arc 0.5.0", "smallvec", ] [[package]] name = "semver" -version = "1.0.24" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" dependencies = [ "serde", + "serde_core", ] [[package]] @@ -2830,6 +3017,15 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "servo_arc" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4eceb519ec34d8290aaf6e46f435102f2bfa63f22b05a144fb16ab266d3b198" +dependencies = [ + "stable_deref_trait", +] + [[package]] name = "sha2" version = "0.10.8" @@ -2957,6 +3153,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +[[package]] +name = "static_vcruntime" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff7589a1859b09232522bb9edf076ca7fcf14ded96685d3fa629db73023ffbb7" + [[package]] name = "string_cache" version = "0.9.0" @@ -2965,7 +3167,19 @@ checksum = "a18596f8c785a729f2819c0f6a7eae6ebeebdfffbfe4214ae6b087f690e31901" dependencies = [ "new_debug_unreachable", "parking_lot", - "phf_shared", + "phf_shared 0.13.1", + "precomputed-hash", +] + +[[package]] +name = "string_cache" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffa8a5dbe8b3f0bbe29d4c3225daafaeead63afdc1b65fc4c01a1384166038e6" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared 0.14.0", "precomputed-hash", ] @@ -2975,8 +3189,20 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "585635e46db231059f76c5849798146164652513eb9e8ab2685939dd90f29b69" dependencies = [ - "phf_generator", - "phf_shared", + "phf_generator 0.13.1", + "phf_shared 0.13.1", + "proc-macro2", + "quote", +] + +[[package]] +name = "string_cache_codegen" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928dcdf75e47626b3617a976ec205d9f057584c371c1f23b782129268d0e6edc" +dependencies = [ + "phf_generator 0.14.0", + "phf_shared 0.14.0", "proc-macro2", "quote", ] @@ -2989,9 +3215,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "swift-rs" -version = "1.0.7" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4057c98e2e852d51fdcfca832aac7b571f6b351ad159f9eda5db1655f8d0c4d7" +checksum = "cefd87076fd385308ee4aff597256c902f1fbb4d031de1558efc12f8ffefadd9" dependencies = [ "base64 0.21.7", "serde", @@ -3019,6 +3245,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "sync_wrapper" version = "1.0.2" @@ -3039,6 +3276,17 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + [[package]] name = "system-deps" version = "6.2.2" @@ -3054,9 +3302,9 @@ dependencies = [ [[package]] name = "tao" -version = "0.35.3" +version = "0.37.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1c93047acf68669466a34690ac58cca7010bd1b201e1ec86f1fd0a75d3dd4a9" +checksum = "d5777b06fe6435126ae8d816eba269e050e1e10d302cf5461e9c49eccabc3548" dependencies = [ "bitflags 2.6.0", "block2 0.6.2", @@ -3074,12 +3322,12 @@ dependencies = [ "libc", "log", "ndk", + "ndk-context", "ndk-sys", "objc2 0.6.4", "objc2-app-kit", "objc2-foundation 0.3.2", "objc2-ui-kit", - "once_cell", "parking_lot", "percent-encoding", "raw-window-handle", @@ -3087,16 +3335,16 @@ dependencies = [ "unicode-segmentation", "url", "windows", - "windows-core 0.61.2", + "windows-core 0.62.2", "windows-version", "x11-dl", ] [[package]] name = "tao-macros" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4e16beb8b2ac17db28eab8bca40e62dbfbb34c0fcdc6d9826b11b7b5d047dfd" +checksum = "5f7eeb6d99155545da6150a1795945f16ac9c178deb2a5f2e74d776107bd5849" dependencies = [ "proc-macro2", "quote", @@ -3117,9 +3365,9 @@ checksum = "df7f62577c25e07834649fc3b39fafdc597c0a3527dc1c60129201ccfcbaa50c" [[package]] name = "tauri" -version = "2.11.3" +version = "2.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2616f96cb644bf2c5c456d9de4d5d5100e592d7424c74d8b55c5cb96e359e93" +checksum = "5fb0244332cfb9cee7e2a568bf5da29a36ed8fdbd717f6f47a66b6b7b358c072" dependencies = [ "anyhow", "bytes", @@ -3168,9 +3416,9 @@ dependencies = [ [[package]] name = "tauri-build" -version = "2.6.3" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc9ce40b16101cb6ea63d3e221567affd1c3a9205f95d7bc574941a10636b632" +checksum = "adddb0e648752aaac5da9c3c3c6a68e1e87cab55e3b757b18a9441ef8c3ac614" dependencies = [ "anyhow", "cargo_toml", @@ -3182,6 +3430,8 @@ dependencies = [ "semver", "serde", "serde_json", + "static_vcruntime", + "strsim", "tauri-utils", "tauri-winres", "walkdir", @@ -3189,16 +3439,16 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "2.6.3" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08279169ff42f8fc45a1dbc9dcae888893ba95288142e5880c59b93a26d2cfc5" +checksum = "fb37631cf71dab5e8ab55e1bdd701e18a52653d90b78e71d0e5598b1e0a61316" dependencies = [ - "base64 0.22.1", + "base64 0.23.1", "brotli", "ico", "json-patch", "plist", - "png 0.17.15", + "png", "proc-macro2", "quote", "semver", @@ -3216,9 +3466,9 @@ dependencies = [ [[package]] name = "tauri-macros" -version = "2.6.3" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8b394794f399a421811d06966343e7933fcae92d59f5180b9388d1174497a45" +checksum = "0cc38db58854c10fb5f91a887ed8bf82d3239bb92b5d8db86eda09e96d9963d1" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -3246,7 +3496,7 @@ dependencies = [ [[package]] name = "tauri-plugin-python" -version = "0.3.9" +version = "0.4.0" dependencies = [ "async-trait", "async_py", @@ -3261,9 +3511,9 @@ dependencies = [ [[package]] name = "tauri-runtime" -version = "2.11.3" +version = "2.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0b4bc95aed361b0019067d189a1174a603d460d0f6c72606512d59fc9c12ec8" +checksum = "7c55766d99cea69055904d1735b93c2049302b2e09effd462120deb5581d78e9" dependencies = [ "cookie", "dpi", @@ -3286,9 +3536,9 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" -version = "2.11.3" +version = "2.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe41e015bf8fc4d6477ff4926a0ef769dc64ff34c7b0038b6f7cacae892acb5c" +checksum = "e1aa9d8b7a120f879f44fdc1053f7b7dbf416bf0bbc6a72b714dec46b782b52f" dependencies = [ "gtk", "http", @@ -3296,7 +3546,6 @@ dependencies = [ "log", "objc2 0.6.4", "objc2-app-kit", - "once_cell", "percent-encoding", "raw-window-handle", "softbuffer", @@ -3312,15 +3561,15 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "2.9.3" +version = "2.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e176a18e67764923c4f1ce66f25ae4abe5f688384d5eb1a0fa6c77f3d90f887" +checksum = "362ab21cd4cc713f2a02b1a9b5688198b1541cfb6907c4281e9190e0f0ef4aa3" dependencies = [ "anyhow", "brotli", "cargo_metadata", "ctor", - "dom_query", + "dom_query 0.28.0", "dunce", "glob", "http", @@ -3328,7 +3577,7 @@ dependencies = [ "json-patch", "log", "memchr", - "phf", + "phf 0.13.1", "plist", "proc-macro2", "quote", @@ -3341,7 +3590,7 @@ dependencies = [ "serde_with", "swift-rs", "thiserror 2.0.9", - "toml 0.9.12+spec-1.1.0", + "toml 1.1.2+spec-1.1.0", "url", "urlpattern", "uuid", @@ -3447,7 +3696,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ "displaydoc", - "zerovec", + "zerovec 0.10.4", +] + +[[package]] +name = "tinystr" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +dependencies = [ + "displaydoc", + "zerovec 0.11.5", ] [[package]] @@ -3504,21 +3763,6 @@ dependencies = [ "toml_edit 0.20.2", ] -[[package]] -name = "toml" -version = "0.9.12+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" -dependencies = [ - "indexmap 2.14.0", - "serde_core", - "serde_spanned 1.1.1", - "toml_datetime 0.7.5+spec-1.1.0", - "toml_parser", - "toml_writer", - "winnow 0.7.15", -] - [[package]] name = "toml" version = "1.1.2+spec-1.1.0" @@ -3543,15 +3787,6 @@ dependencies = [ "serde", ] -[[package]] -name = "toml_datetime" -version = "0.7.5+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" -dependencies = [ - "serde_core", -] - [[package]] name = "toml_datetime" version = "1.1.1+spec-1.1.0" @@ -3666,9 +3901,9 @@ dependencies = [ [[package]] name = "tray-icon" -version = "0.24.1" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65ba1e5f6b9ef9fd87e21b9c6f351554dbd717960089168fcfdef854686961dc" +checksum = "b2b9c52859a94554803ccd4a24b98f74148ebc73b90676d783f3490b1bff9d72" dependencies = [ "crossbeam-channel", "dirs", @@ -3680,7 +3915,7 @@ dependencies = [ "objc2-core-graphics", "objc2-foundation 0.3.2", "once_cell", - "png 0.18.1", + "png", "serde", "thiserror 2.0.9", "windows-sys 0.61.2", @@ -3704,47 +3939,6 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "unic-char-property" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" -dependencies = [ - "unic-char-range", -] - -[[package]] -name = "unic-char-range" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" - -[[package]] -name = "unic-common" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" - -[[package]] -name = "unic-ucd-ident" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e230a37c0381caa9219d67cf063aa3a375ffed5bf541a452db16e744bdab6987" -dependencies = [ - "unic-char-property", - "unic-char-range", - "unic-ucd-version", -] - -[[package]] -name = "unic-ucd-version" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" -dependencies = [ - "unic-common", -] - [[package]] name = "unicode-ident" version = "1.0.14" @@ -3759,25 +3953,26 @@ checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "url" -version = "2.5.4" +version = "2.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" dependencies = [ "form_urlencoded", "idna", "percent-encoding", "serde", + "serde_derive", ] [[package]] name = "urlpattern" -version = "0.3.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70acd30e3aa1450bc2eece896ce2ad0d178e9c079493819301573dae3c37ba6d" +checksum = "df16f50ef4cc145211879a3867ba757076b25dfee812040dcb0658bd9ae7904b" dependencies = [ + "icu_properties 2.1.2", "regex", "serde", - "unic-ucd-ident", "url", ] @@ -3953,16 +4148,38 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "web_atoms" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "075474b12bcb3d2e3d4546580e9de478eeeead668a1761e2a8860c836b7ef297" dependencies = [ - "phf", - "phf_codegen", - "string_cache", - "string_cache_codegen", + "phf 0.13.1", + "phf_codegen 0.13.1", + "string_cache 0.9.0", + "string_cache_codegen 0.6.1", +] + +[[package]] +name = "web_atoms" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7572660c8890448ba236b7376f27e389c6a7e1c70195622faced601f855c0ada" +dependencies = [ + "phf 0.14.0", + "phf_codegen 0.14.0", + "string_cache 0.11.0", + "string_cache_codegen 0.11.2", ] [[package]] @@ -4011,16 +4228,14 @@ dependencies = [ [[package]] name = "webview2-com" -version = "0.38.2" +version = "0.39.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7130243a7a5b33c54a444e54842e6a9e133de08b5ad7b5861cd8ed9a6a5bc96a" +checksum = "3f89fca7a704cee10dcb3654c1dbb8941d1783132f1917358af75bec37a7d7e6" dependencies = [ "webview2-com-macros", "webview2-com-sys", "windows", - "windows-core 0.61.2", - "windows-implement", - "windows-interface", + "windows-core 0.62.2", ] [[package]] @@ -4036,13 +4251,13 @@ dependencies = [ [[package]] name = "webview2-com-sys" -version = "0.38.2" +version = "0.39.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "381336cfffd772377d291702245447a5251a2ffa5bad679c99e61bc48bacbf9c" +checksum = "b3a07132775117d6065853d9d1178157b8c90e228de47129d6bce2c7edebedfb" dependencies = [ "thiserror 2.0.9", "windows", - "windows-core 0.61.2", + "windows-core 0.62.2", ] [[package]] @@ -4067,7 +4282,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4078,39 +4293,39 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "window-vibrancy" -version = "0.6.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9bec5a31f3f9362f2258fd0e9c9dd61a9ca432e7306cc78c444258f0dce9a9c" +checksum = "111e51caca442cafd9bab396628ac4d814880eaea4e63dfd76a12e9f342b5580" dependencies = [ "objc2 0.6.4", "objc2-app-kit", "objc2-core-foundation", "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", "raw-window-handle", - "windows-sys 0.59.0", + "windows-sys 0.61.2", "windows-version", ] [[package]] name = "windows" -version = "0.61.3" +version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" dependencies = [ "windows-collections", - "windows-core 0.61.2", + "windows-core 0.62.2", "windows-future", - "windows-link 0.1.3", "windows-numerics", ] [[package]] name = "windows-collections" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" dependencies = [ - "windows-core 0.61.2", + "windows-core 0.62.2", ] [[package]] @@ -4124,25 +4339,25 @@ dependencies = [ [[package]] name = "windows-core" -version = "0.61.2" +version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ "windows-implement", "windows-interface", - "windows-link 0.1.3", + "windows-link", "windows-result", "windows-strings", ] [[package]] name = "windows-future" -version = "0.2.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" dependencies = [ - "windows-core 0.61.2", - "windows-link 0.1.3", + "windows-core 0.62.2", + "windows-link", "windows-threading", ] @@ -4168,12 +4383,6 @@ dependencies = [ "syn 2.0.90", ] -[[package]] -name = "windows-link" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" - [[package]] name = "windows-link" version = "0.2.1" @@ -4182,30 +4391,30 @@ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] name = "windows-numerics" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" dependencies = [ - "windows-core 0.61.2", - "windows-link 0.1.3", + "windows-core 0.62.2", + "windows-link", ] [[package]] name = "windows-result" -version = "0.3.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ - "windows-link 0.1.3", + "windows-link", ] [[package]] name = "windows-strings" -version = "0.4.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ - "windows-link 0.1.3", + "windows-link", ] [[package]] @@ -4241,7 +4450,7 @@ version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ - "windows-link 0.2.1", + "windows-link", ] [[package]] @@ -4277,11 +4486,11 @@ dependencies = [ [[package]] name = "windows-threading" -version = "0.1.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" dependencies = [ - "windows-link 0.1.3", + "windows-link", ] [[package]] @@ -4392,12 +4601,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "winnow" -version = "0.7.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" - [[package]] name = "winnow" version = "1.0.3" @@ -4432,18 +4635,24 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + [[package]] name = "wry" -version = "0.55.1" +version = "0.57.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "186f9871daa55fd9c016578b810d149de58367113db7fb72b462d2323ce19514" +checksum = "a490119196d02a51d0871df7b9119a1f3e46d75b7e90053a801454d5c6b3491c" dependencies = [ - "base64 0.22.1", + "base64 0.23.1", "block2 0.6.2", "cookie", "crossbeam-channel", "dirs", - "dom_query", + "dom_query 0.29.0", "dpi", "dunce", "gdkx11", @@ -4459,7 +4668,6 @@ dependencies = [ "objc2-foundation 0.3.2", "objc2-ui-kit", "objc2-web-kit", - "once_cell", "percent-encoding", "raw-window-handle", "sha2", @@ -4471,7 +4679,7 @@ dependencies = [ "webkit2gtk-sys", "webview2-com", "windows", - "windows-core 0.61.2", + "windows-core 0.62.2", "windows-version", "x11-dl", ] @@ -4505,7 +4713,18 @@ checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" dependencies = [ "serde", "stable_deref_trait", - "yoke-derive", + "yoke-derive 0.7.5", + "zerofrom", +] + +[[package]] +name = "yoke" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +dependencies = [ + "stable_deref_trait", + "yoke-derive 0.8.4", "zerofrom", ] @@ -4518,7 +4737,19 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.90", - "synstructure", + "synstructure 0.13.1", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure 0.14.0", ] [[package]] @@ -4539,7 +4770,18 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.90", - "synstructure", + "synstructure 0.13.1", +] + +[[package]] +name = "zerotrie" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +dependencies = [ + "displaydoc", + "yoke 0.8.1", + "zerofrom", ] [[package]] @@ -4548,9 +4790,20 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" dependencies = [ - "yoke", + "yoke 0.7.5", + "zerofrom", + "zerovec-derive 0.10.3", +] + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "yoke 0.8.1", "zerofrom", - "zerovec-derive", + "zerovec-derive 0.11.7", ] [[package]] @@ -4563,3 +4816,14 @@ dependencies = [ "quote", "syn 2.0.90", ] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] diff --git a/examples/plain-javascript/src-tauri/src-python/.python-version b/examples/plain-javascript/src-tauri/src-python/.python-version new file mode 100644 index 0000000..24ee5b1 --- /dev/null +++ b/examples/plain-javascript/src-tauri/src-python/.python-version @@ -0,0 +1 @@ +3.13 diff --git a/package.json b/package.json index 66c1b63..39d9c50 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tauri-plugin-python-api", - "version": "0.3.9", + "version": "0.4.0", "author": "Marco Mengelkoch", "description": "Javascript package for tauri 2 python plugin.", "type": "module", diff --git a/src/commands.rs b/src/commands.rs index ab3ce9b..90e3cc6 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -3,11 +3,11 @@ // Licensed under MIT License, see License file for more details // git clone https://github.com/marcomq/tauri-plugin-python -use tauri::{command, AppHandle, Runtime}; +use tauri::{AppHandle, Runtime, command}; -use crate::models::*; use crate::PythonExt; use crate::Result; +use crate::models::*; #[command] pub(crate) async fn run_python( diff --git a/src/desktop.rs b/src/desktop.rs index a3dde15..f8168a5 100644 --- a/src/desktop.rs +++ b/src/desktop.rs @@ -4,7 +4,7 @@ // git clone https://github.com/marcomq/tauri-plugin-python use serde::de::DeserializeOwned; -use tauri::{plugin::PluginApi, AppHandle, Runtime}; +use tauri::{AppHandle, Runtime, plugin::PluginApi}; /// Access to the python plugin APIs. pub struct Python(AppHandle); diff --git a/src/error.rs b/src/error.rs index 429e261..277e553 100644 --- a/src/error.rs +++ b/src/error.rs @@ -4,7 +4,7 @@ // git clone https://github.com/marcomq/tauri-plugin-python use async_py::PyRunnerError; -use serde::{ser::Serializer, Serialize}; +use serde::{Serialize, ser::Serializer}; pub type Result = std::result::Result; diff --git a/src/lib.rs b/src/lib.rs index ef7361c..ab10baf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,9 +4,9 @@ // git clone https://github.com/marcomq/tauri-plugin-python use tauri::{ + AppHandle, Manager, Runtime, path::BaseDirectory, plugin::{Builder, TauriPlugin}, - AppHandle, Manager, Runtime, }; #[cfg(desktop)] @@ -22,9 +22,9 @@ use async_py::{self, PyRunner}; pub use error::{Error, Result}; use models::*; use std::{ - collections::HashSet, - path::PathBuf, - sync::{atomic::AtomicBool, Mutex}, + collections::HashMap, + path::{Path, PathBuf}, + sync::{Mutex, atomic::AtomicBool}, time::Duration, }; @@ -77,13 +77,22 @@ sys.stderr = _TauriSafeStream(getattr(sys, "stderr", None)) /// the `TAURI_PLUGIN_PYTHON_TIMEOUT_SECS` env var overrides it (`0` = no timeout). fn build_runner() -> PyRunner { let runner = PyRunner::new(); - match std::env::var("TAURI_PLUGIN_PYTHON_TIMEOUT_SECS") - .ok() - .and_then(|v| v.trim().parse::().ok()) - { - Some(0) => runner, - Some(secs) => runner.with_timeout(Duration::from_secs(secs)), - None => runner.with_timeout(Duration::from_secs(DEFAULT_TIMEOUT_SECS)), + match call_timeout( + std::env::var("TAURI_PLUGIN_PYTHON_TIMEOUT_SECS") + .ok() + .as_deref(), + ) { + Some(timeout) => runner.with_timeout(timeout), + None => runner, + } +} + +/// Resolves the per-call timeout from the raw env var value; `None` disables it. +fn call_timeout(env_value: Option<&str>) -> Option { + match env_value.and_then(|v| v.trim().parse::().ok()) { + Some(0) => None, + Some(secs) => Some(Duration::from_secs(secs)), + None => Some(Duration::from_secs(DEFAULT_TIMEOUT_SECS)), } } @@ -95,7 +104,8 @@ use mobile::Python; #[derive(Default)] struct PluginState { init_blocked: AtomicBool, - function_map: Mutex>, + /// Registered functions, mapped to whether they are `async def` coroutine functions. + function_map: Mutex>, } /// Prepends human-readable context to a failing Python operation and, in debug @@ -115,8 +125,9 @@ fn py_context>( }) } +// `async_trait` expands to `#[must_use]` on functions returning a boxed future. /// Extensions to [`tauri::App`], [`tauri::AppHandle`] and [`tauri::Window`] to access the python APIs. - +#[allow(clippy::double_must_use)] #[async_trait::async_trait] pub trait PythonExt { fn python(&self) -> &Python; @@ -164,10 +175,8 @@ impl + Sync> crate::PythonExt for T { if let Some(num_args) = payload.number_of_args { // Validate the argument count via `inspect.signature`, but only // *reject* the registration on an actual mismatch. If the check - // itself can't run - e.g. the RustPython backend can't import - // `inspect` - the import failure is swallowed in Python so the call - // succeeds and registration proceeds without validation, rather - // than failing on an unrelated error. + // itself can't run (e.g. builtins without a signature), registration + // proceeds without validation. let py_analyze_sig = format!( r#" try: @@ -178,7 +187,7 @@ except Exception: if _tauri_param_count is not None and _tauri_param_count != {1}: raise Exception("Function parameters don't match in 'registerFunction'") "#, - &payload.python_function_call, num_args + payload.python_function_call, num_args ); self.runner().run(&py_analyze_sig).await.map_err(|_| { Error::String(format!( @@ -187,11 +196,15 @@ if _tauri_param_count is not None and _tauri_param_count != {1}: )) })?; }; + let is_async = py_context( + is_coroutine_function(self.runner(), &payload.python_function_call).await, + || format!("Cannot register '{}'", payload.python_function_call), + )?; state .function_map .lock() .unwrap() - .insert(payload.python_function_call.clone()); + .insert(payload.python_function_call.clone(), is_async); Ok(StringResponse { value: "Ok".into() }) } @@ -201,23 +214,29 @@ if _tauri_param_count is not None and _tauri_param_count != {1}: .init_blocked .store(true, std::sync::atomic::Ordering::Relaxed); let function_name = payload.function_name; - if state + let is_async = state .function_map .lock() .unwrap() .get(&function_name) - .is_none() - { + .copied(); + let Some(is_async) = is_async else { return Err(Error::String(format!( "Function {function_name} has not been registered yet" ))); - } - let py_res = py_context( + }; + let call = if is_async { + self.runner() + .call_async_function(&function_name, payload.args) + .await + } else { self.runner() .call_function(&function_name, payload.args) - .await, - || format!("Error calling Python function '{function_name}'"), - )?; + .await + }; + let py_res = py_context(call, || { + format!("Error calling Python function '{function_name}'") + })?; let value = match py_res.as_str() { Some(s) => s.to_string(), None => py_res.to_string(), @@ -235,16 +254,140 @@ if _tauri_param_count is not None and _tauri_param_count != {1}: } } +/// `async def` functions are awaited via `call_async_function` instead of +/// returning an un-awaited coroutine. Falls back to the code flags when +/// `inspect` is unavailable. +async fn is_coroutine_function( + runner: &PyRunner, + name: &str, +) -> std::result::Result { + let check = format!( + r#" +try: + from inspect import iscoroutinefunction as _tauri_iscoro +except Exception: + def _tauri_iscoro(f): + return bool(getattr(getattr(f, "__code__", None), "co_flags", 0) & 0x80) +_tauri_is_async = bool(_tauri_iscoro({name})) +"# + ); + runner.run(&check).await?; + Ok(runner.read_variable("_tauri_is_async").await? == serde_json::Value::Bool(true)) +} + fn get_resource_dir(app: &AppHandle) -> PathBuf { app.path() .resolve("src-python", BaseDirectory::Resource) .unwrap_or_default() } +/// The Python entry point of the app inside a `src-python` directory. +#[derive(Debug, PartialEq)] +enum PythonEntry { + /// A `main.py` source file, executed with `run_file`. + File(PathBuf), + /// A compiled module (e.g. `nuitka --module main.py`) in `dir`, imported via `run_module`. + Module { name: String, dir: PathBuf }, +} + +const ENTRY_MODULE: &str = "main"; + +/// Prefers `main.py`; otherwise falls back to a compiled `main` module +/// (`main.*.so`, `main.*.pyd` or `main.pyc`) as produced by Nuitka or Cython. +fn find_entry(dir: &Path) -> Option { + let main_py = dir.join("main.py"); + if main_py.is_file() { + return Some(PythonEntry::File(main_py)); + } + std::fs::read_dir(dir) + .ok()? + .flatten() + .any(|e| e.path().is_file() && is_compiled_entry(&e.file_name().to_string_lossy())) + .then(|| PythonEntry::Module { + name: ENTRY_MODULE.into(), + dir: dir.to_path_buf(), + }) +} + +fn is_compiled_entry(file_name: &str) -> bool { + let prefix = format!("{ENTRY_MODULE}."); + file_name.starts_with(&prefix) + && [".so", ".pyd", ".pyc"] + .iter() + .any(|ext| file_name.ends_with(ext)) +} + +async fn run_entry(runner: &PyRunner, entry: &PythonEntry) -> crate::Result<()> { + match entry { + PythonEntry::File(path) => runner.run_file(path).await?, + PythonEntry::Module { name, dir } => { + runner.run(&load_module_from(name, dir)).await?; + runner.run_module(name).await? + } + } + Ok(()) +} + +/// Loads `name` from `dir` into `sys.modules`, so `run_module` can't pick up a +/// same-named module from elsewhere on `sys.path` or a stale `sys.modules` entry. +fn load_module_from(name: &str, dir: &Path) -> String { + format!( + r#" +def _tauri_load(name, path): + import importlib.machinery, importlib.util, sys + spec = importlib.machinery.PathFinder.find_spec(name, [path]) + if spec is None: + raise ModuleNotFoundError(f"No module named '{{name}}' in {{path}}", name=name) + module = importlib.util.module_from_spec(spec) + sys.modules[name] = module + try: + spec.loader.exec_module(module) + except BaseException: + del sys.modules[name] + raise +try: + _tauri_load({name:?}, {path}) +finally: + del _tauri_load +"#, + path = print_path_for_python(&dir.to_path_buf()) + ) +} + fn get_src_python_dir() -> PathBuf { std::env::current_dir().unwrap().join("src-python") } +/// Uses a bundled standalone Python (`pyembed/python`) if the app ships one. +#[cfg(all(feature = "pyo3", not(feature = "rustpython")))] +fn init_embedded_python(app: &AppHandle) -> crate::Result<()> { + const EMBEDDED_PYTHON_DIR: &str = "pyembed/python"; + let candidates = [ + app.path() + .resolve(EMBEDDED_PYTHON_DIR, BaseDirectory::Resource) + .ok(), + // Release builds must not pick up a Python from wherever they are started. + std::env::current_dir() + .ok() + .filter(|_| cfg!(debug_assertions)) + .map(|dir| dir.join(EMBEDDED_PYTHON_DIR)), + ]; + let Some(home) = candidates + .into_iter() + .flatten() + .find(|dir| async_py::is_python_home(dir)) + else { + return Ok(()); + }; + if !async_py::init_python_home(&home)? { + eprintln!( + "[tauri-plugin-python] Warning: Python was initialized before the plugin; bundled Python at '{}' is not used", + home.display() + ); + } + Ok(()) +} + /// Initializes the plugin with functions pub fn init() -> TauriPlugin { init_and_register(vec![]) @@ -287,12 +430,14 @@ sys.path = sys.path + [{}] .expect("ERROR: Error setting python path"); #[cfg(feature = "venv")] { - let venv_dir = dir.join(".venv").join("lib"); - if venv_dir.exists() { - runner - .set_venv(venv_dir.as_path()) - .await - .expect("ERROR: Error setting venv for python"); + let venv_dir = dir.join(".venv"); + if venv_dir.is_dir() + && let Err(e) = runner.set_venv(&venv_dir).await + { + eprintln!( + "[tauri-plugin-python] Warning: '{}' not loaded, it doesn't match this Python: {e}", + venv_dir.display() + ); } } } @@ -312,26 +457,31 @@ pub fn init_and_register(python_functions: Vec<&'static str>) -> Tau #[cfg(desktop)] let python = desktop::init(app, api)?; app.manage(python); + #[cfg(all(feature = "pyo3", not(feature = "rustpython")))] + init_embedded_python(app)?; let runner = build_runner(); app.manage(runner); app.manage(PluginState::default()); let mut dir = get_resource_dir(app); - let mut main_py = dir.join("main.py"); - if !main_py.exists() { + let mut entry = find_entry(&dir); + if entry.is_none() { println!( "Warning: 'src-tauri/main.py' seems not to be registered in 'tauri.conf.json'" ); - dir = get_src_python_dir(); - main_py = dir.join("main.py"); + // Release builds must not run Python code from wherever they are started. + if cfg!(debug_assertions) { + dir = get_src_python_dir(); + entry = find_entry(&dir); + } } + let entry = entry.unwrap_or_else(|| PythonEntry::File(dir.join("main.py"))); tokio::runtime::Runtime::new() .unwrap() .block_on(async move { let runner = app.state::().inner(); init_python(runner, dir.to_path_buf()).await; - runner - .run_file(main_py.as_path()) + run_entry(runner, &entry) .await .expect("ERROR: Error running 'src-tauri/main.py'"); register_python_functions( @@ -366,3 +516,5 @@ async fn register_python_functions(app: &AppHandle, python_functi #[cfg(test)] mod tests; +#[cfg(test)] +mod unit_tests; diff --git a/src/mobile.rs b/src/mobile.rs index a6a27b7..0b78ae7 100644 --- a/src/mobile.rs +++ b/src/mobile.rs @@ -5,8 +5,8 @@ use serde::de::DeserializeOwned; use tauri::{ - plugin::{PluginApi, PluginHandle}, AppHandle, Runtime, + plugin::{PluginApi, PluginHandle}, }; #[cfg(target_os = "ios")] diff --git a/src/tests.rs b/src/tests.rs index da02303..c152f99 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -5,8 +5,8 @@ use super::*; use tauri::{ - test::{self, MockRuntime}, AppHandle, + test::{self, MockRuntime}, }; /// Creates a mock Tauri app and initializes the PyRunner state. @@ -108,10 +108,12 @@ async fn test_register_after_call_fails() { }; let result = app.register_function(second_register_payload).await; assert!(result.is_err()); - assert!(result - .unwrap_err() - .to_string() - .contains("Cannot register after function called")); + assert!( + result + .unwrap_err() + .to_string() + .contains("Cannot register after function called") + ); } #[tokio::test] @@ -169,43 +171,18 @@ async fn test_register_function_arg_mismatch_returns_error_instead_of_panicking( let result = join_result.unwrap(); assert!(result.is_err()); - assert!(result - .unwrap_err() - .to_string() - .contains("Function parameters don't match")); -} - -// The rustpython backend can't import `inspect`, so signature validation can't -// run; registration of an existing function must still succeed (graceful skip) -// rather than failing on the unrelated import error. -#[cfg(feature = "rustpython")] -#[tokio::test] -async fn test_rustpython_register_skips_signature_check() { - let app = mock_app_handle().await; - // Deliberately wrong arg count: under pyo3 this would be rejected, but with - // no `inspect` available the check is skipped and registration succeeds. - app.register_function(RegisterRequest { - python_function_call: "my_func".into(), - number_of_args: Some(1), - }) - .await - .expect("registration should succeed when the signature check can't run"); - - // And the function is genuinely usable afterwards. - let response = app - .call_function(RunRequest { - function_name: "my_func".into(), - args: vec![serde_json::json!(10), serde_json::json!(20)], - }) - .await - .unwrap(); - assert_eq!(response.value, "30"); + assert!( + result + .unwrap_err() + .to_string() + .contains("Function parameters don't match") + ); } // Guards the insert-before-validate bug across both backends: a registration // that fails (here, because the function doesn't exist) must not leave the name // marked as registered. Uses a nonexistent name so the failure path is backend -// independent (doesn't rely on signature validation, which rustpython skips). +// independent (doesn't rely on signature validation). #[tokio::test] async fn test_failed_registration_does_not_allow_call() { let app = mock_app_handle().await; @@ -227,10 +204,12 @@ async fn test_failed_registration_does_not_allow_call() { call_result.is_err(), "calling a function whose registration failed should error: {call_result:?}" ); - assert!(call_result - .unwrap_err() - .to_string() - .contains("has not been registered yet")); + assert!( + call_result + .unwrap_err() + .to_string() + .contains("has not been registered yet") + ); } #[tokio::test] @@ -433,3 +412,293 @@ async fn test_error_line_number_not_shifted_by_stdio_guard() { "the raise on line 3 must report line 3, not be shifted by the guard: {err}" ); } + +// Writes `.py` into a temp dir and puts that dir on `sys.path`, the same +// way `init_python` does for `src-python`. Module names must be unique per test +// because PyO3 shares one interpreter (and `sys.modules`) across all tests. +fn module_entry(name: &str, dir: &tempfile::TempDir) -> PythonEntry { + PythonEntry::Module { + name: name.into(), + dir: dir.path().to_path_buf(), + } +} + +async fn module_dir(runner: &PyRunner, name: &str, code: &str) -> tempfile::TempDir { + let dir = tempfile::tempdir().unwrap(); + std::fs::write(dir.path().join(format!("{name}.py")), code).unwrap(); + init_python(runner, dir.path().to_path_buf()).await; + dir +} + +#[tokio::test] +async fn test_run_entry_file() { + let app = mock_app_handle().await; + let runner = app.state::().inner(); + let dir = tempfile::tempdir().unwrap(); + let main_py = dir.path().join("main.py"); + std::fs::write(&main_py, "entry_file_var = 'from file'\n").unwrap(); + run_entry(runner, &PythonEntry::File(main_py)) + .await + .unwrap(); + let resp = app + .read_variable(StringRequest { + value: "entry_file_var".into(), + }) + .await + .unwrap(); + assert_eq!(resp.value, "\"from file\""); +} + +// Mirrors the Nuitka entry point (`nuitka --module main.py`): the module is +// imported instead of executed as a file. A pure .py module exercises the same +// `run_module` path without requiring Nuitka in the test environment. +#[tokio::test] +async fn test_run_entry_module_registers_and_calls_functions() { + let app = mock_app_handle().await; + let runner = app.state::().inner(); + let dir = module_dir( + runner, + "tauri_entry_mod_call", + "_tauri_plugin_functions = ['greet']\ndef greet(name):\n return 'hi ' + name\n", + ) + .await; + run_entry(runner, &module_entry("tauri_entry_mod_call", &dir)) + .await + .unwrap(); + + let functions = runner + .read_variable("_tauri_plugin_functions") + .await + .unwrap(); + let functions: Vec = serde_json::from_value(functions).unwrap(); + register_python_functions(&app, functions).await; + + let resp = app + .call_function(RunRequest { + function_name: "greet".into(), + args: vec![serde_json::json!("nuitka")], + }) + .await + .unwrap(); + assert_eq!(resp.value, "hi nuitka"); +} + +#[tokio::test] +async fn test_run_entry_module_replaces_global_scope() { + let app = mock_app_handle().await; + let runner = app.state::().inner(); + let dir = module_dir(runner, "tauri_entry_mod_scope", "mod_var = 1\n").await; + run_entry(runner, &module_entry("tauri_entry_mod_scope", &dir)) + .await + .unwrap(); + + let mod_var = app + .read_variable(StringRequest { + value: "mod_var".into(), + }) + .await + .unwrap(); + assert_eq!(mod_var.value, "1"); + let old_var = app + .read_variable(StringRequest { + value: "my_var".into(), + }) + .await; + assert!( + old_var.is_err(), + "names from before run_module must be gone" + ); +} + +#[tokio::test] +async fn test_run_entry_module_ignores_same_named_module_elsewhere() { + let app = mock_app_handle().await; + let runner = app.state::().inner(); + runner + .run("import sys, types\nsys.modules['tauri_entry_mod_shadow'] = types.ModuleType('x')\n") + .await + .unwrap(); + let dir = module_dir( + runner, + "tauri_entry_mod_shadow", + "shadow_var = 'entry dir'\n", + ) + .await; + run_entry(runner, &module_entry("tauri_entry_mod_shadow", &dir)) + .await + .unwrap(); + let resp = app + .read_variable(StringRequest { + value: "shadow_var".into(), + }) + .await + .unwrap(); + assert_eq!(resp.value, "\"entry dir\""); +} + +#[tokio::test] +async fn test_run_entry_missing_module_fails() { + let app = mock_app_handle().await; + let runner = app.state::().inner(); + let result = run_entry( + runner, + &PythonEntry::Module { + name: "tauri_entry_mod_missing".into(), + dir: std::env::temp_dir(), + }, + ) + .await; + assert!(result.is_err()); + // A failed import keeps the previous scope. + let resp = app + .read_variable(StringRequest { + value: "my_var".into(), + }) + .await + .unwrap(); + assert_eq!(resp.value, "123"); +} + +async fn register_async_fn(app: &AppHandle) { + let runner = app.state::().inner(); + runner + .run("async def coro_fn(x):\n return x * 2") + .await + .unwrap(); + app.register_function(RegisterRequest { + python_function_call: "coro_fn".into(), + number_of_args: Some(1), + }) + .await + .unwrap(); +} + +#[tokio::test] +async fn test_async_def_is_detected_on_registration() { + let app = mock_app_handle().await; + register_async_fn(&app).await; + let state = app.state::(); + let map = state.function_map.lock().unwrap(); + assert_eq!(map.get("coro_fn"), Some(&true)); +} + +#[tokio::test] +async fn test_sync_def_is_not_async() { + let app = mock_app_handle().await; + app.register_function(RegisterRequest { + python_function_call: "my_func".into(), + number_of_args: None, + }) + .await + .unwrap(); + let state = app.state::(); + assert_eq!( + state.function_map.lock().unwrap().get("my_func"), + Some(&false) + ); +} + +#[cfg(all(feature = "pyo3", not(feature = "rustpython")))] +#[tokio::test] +async fn test_call_async_def_is_awaited() { + let app = mock_app_handle().await; + register_async_fn(&app).await; + let resp = app + .call_function(RunRequest { + function_name: "coro_fn".into(), + args: vec![serde_json::json!(21)], + }) + .await + .unwrap(); + assert_eq!(resp.value, "42"); +} + +#[cfg(feature = "rustpython")] +#[tokio::test] +async fn test_call_async_def_reports_unsupported_on_rustpython() { + let app = mock_app_handle().await; + register_async_fn(&app).await; + let err = app + .call_function(RunRequest { + function_name: "coro_fn".into(), + args: vec![serde_json::json!(21)], + }) + .await + .unwrap_err() + .to_string(); + assert!(err.contains("not supported"), "{err}"); +} + +#[cfg(feature = "rustpython")] +mod rustpython_stdlib_tests { + use super::*; + + #[tokio::test] + async fn frozen_stdlib_and_codecs_work() { + let runner = PyRunner::new(); + runner + .run( + "import json, typing, inspect, dataclasses, collections, re, logging\n\ + assert json.loads('[1]') == [1]\n\ + assert 'é'.encode('latin1') == b'\\xe9'\n\ + assert b'\\x80'.decode('cp1252') == '\\u20ac'", + ) + .await + .unwrap(); + } + + #[tokio::test] + async fn signature_check_works_with_stdlib() { + let app = mock_app_handle().await; + let result = app + .register_function(RegisterRequest { + python_function_call: "my_func".into(), + number_of_args: Some(1), + }) + .await; + assert!( + result.is_err(), + "inspect is available, mismatch must be rejected" + ); + } +} + +#[cfg(all(feature = "venv", feature = "pyo3", not(feature = "rustpython")))] +#[tokio::test] +async fn test_init_python_loads_src_python_venv() { + let runner = PyRunner::new(); + runner.run("import sys").await.unwrap(); + let version = runner + .eval("f'python{sys.version_info.major}.{sys.version_info.minor}'") + .await + .unwrap(); + let src_python = tempfile::tempdir().unwrap(); + let site_packages = if cfg!(windows) { + src_python.path().join(".venv/Lib/site-packages") + } else { + src_python + .path() + .join(".venv/lib") + .join(version.as_str().unwrap()) + .join("site-packages") + }; + std::fs::create_dir_all(&site_packages).unwrap(); + std::fs::write(site_packages.join("tauri_venv_probe.py"), "VALUE = 7\n").unwrap(); + + init_python(&runner, src_python.path().to_path_buf()).await; + runner + .run("import tauri_venv_probe\nvenv_value = tauri_venv_probe.VALUE") + .await + .unwrap(); + assert_eq!(runner.read_variable("venv_value").await.unwrap(), 7); +} + +#[cfg(all(feature = "venv", feature = "pyo3", not(feature = "rustpython")))] +#[tokio::test] +async fn test_init_python_survives_venv_of_other_python_version() { + let runner = PyRunner::new(); + let src_python = tempfile::tempdir().unwrap(); + std::fs::create_dir_all(src_python.path().join(".venv/lib/python2.7/site-packages")).unwrap(); + init_python(&runner, src_python.path().to_path_buf()).await; + runner.run("x = 1").await.unwrap(); +} diff --git a/src/unit_tests.rs b/src/unit_tests.rs new file mode 100644 index 0000000..f95da4c --- /dev/null +++ b/src/unit_tests.rs @@ -0,0 +1,342 @@ +// Tauri Python Plugin +// © Copyright 2024, by Marco Mengelkoch +// Licensed under MIT License, see License file for more details +// git clone https://github.com/marcomq/tauri-plugin-python + +//! Unit tests for pure helpers that don't need a Python interpreter. + +use super::*; +use serde_json::json; + +mod timeout { + use super::*; + + #[test] + fn unset_uses_default() { + assert_eq!( + call_timeout(None), + Some(Duration::from_secs(DEFAULT_TIMEOUT_SECS)) + ); + } + + #[test] + fn zero_disables_timeout() { + assert_eq!(call_timeout(Some("0")), None); + } + + #[test] + fn explicit_seconds_are_used() { + assert_eq!(call_timeout(Some("42")), Some(Duration::from_secs(42))); + } + + #[test] + fn surrounding_whitespace_is_ignored() { + assert_eq!(call_timeout(Some(" 7\n")), Some(Duration::from_secs(7))); + } + + #[test] + fn invalid_values_fall_back_to_default() { + let default = Some(Duration::from_secs(DEFAULT_TIMEOUT_SECS)); + for value in ["", "abc", "-1", "1.5", "99999999999999999999999"] { + assert_eq!(call_timeout(Some(value)), default, "value: {value:?}"); + } + } +} + +mod python_paths { + use super::*; + + #[test] + fn cleanup_uses_forward_slashes_and_absolute_path() { + let cleaned = cleanup_path_for_python(&PathBuf::from(".")); + assert!(!cleaned.contains('\\'), "{cleaned}"); + assert!(PathBuf::from(&cleaned).is_absolute(), "{cleaned}"); + } + + #[test] + fn cleanup_resolves_relative_components() { + let cwd = std::env::current_dir().unwrap(); + let via_parent = cwd.join("src").join(".."); + assert_eq!( + cleanup_path_for_python(&via_parent), + cleanup_path_for_python(&cwd) + ); + } + + #[test] + fn print_path_is_a_quoted_python_literal() { + let printed = print_path_for_python(&PathBuf::from(".")); + let cleaned = cleanup_path_for_python(&PathBuf::from(".")); + #[cfg(not(target_os = "windows"))] + assert_eq!(printed, format!("\"{cleaned}\"")); + #[cfg(target_os = "windows")] + assert_eq!(printed, format!("r\"{cleaned}\"")); + } + + #[test] + #[should_panic] + fn cleanup_panics_for_missing_path() { + cleanup_path_for_python(&PathBuf::from("/definitely/not/existing/src-python")); + } + + #[test] + fn src_python_dir_is_relative_to_cwd() { + assert_eq!( + get_src_python_dir(), + std::env::current_dir().unwrap().join("src-python") + ); + } +} + +mod errors { + use super::*; + + #[test] + fn string_error_display() { + assert_eq!(Error::String("boom".into()).to_string(), "Error: boom"); + } + + #[test] + fn from_str() { + let err: Error = "boom".into(); + assert!(matches!(err, Error::String(ref s) if s == "boom")); + } + + #[test] + fn from_io_error_is_transparent() { + let err: Error = std::io::Error::new(std::io::ErrorKind::NotFound, "gone").into(); + assert!(matches!(err, Error::Io(_))); + assert_eq!(err.to_string(), "gone"); + } + + #[test] + fn from_py_runner_error_is_transparent() { + let inner = async_py::PyRunnerError::PyError("ValueError: nope".into()); + let expected = inner.to_string(); + let err: Error = inner.into(); + assert!(matches!(err, Error::PyRunner(_))); + assert_eq!(err.to_string(), expected); + } + + #[test] + fn serializes_as_plain_string_for_the_frontend() { + let value = serde_json::to_value(Error::String("boom".into())).unwrap(); + assert_eq!(value, json!("Error: boom")); + } +} + +mod context { + use super::*; + + #[test] + fn ok_passes_through() { + let res: std::result::Result = Ok(3); + assert_eq!(py_context(res, || unreachable!()).unwrap(), 3); + } + + #[test] + fn error_is_prefixed_with_context() { + let res: std::result::Result<(), Error> = Err("inner".into()); + let err = py_context(res, || "Outer".into()).unwrap_err(); + assert_eq!(err.to_string(), "Error: Outer: Error: inner"); + } + + #[test] + fn python_message_is_preserved() { + let res: std::result::Result<(), _> = Err(async_py::PyRunnerError::PyError( + "ValueError: custom".into(), + )); + let err = py_context(res, || "Calling f".into()).unwrap_err(); + assert!(err.to_string().contains("ValueError: custom"), "{err}"); + assert!(err.to_string().starts_with("Error: Calling f: "), "{err}"); + } +} + +mod models { + use super::*; + + #[test] + fn string_request_from_frontend() { + let req: StringRequest = serde_json::from_value(json!({ "value": "x = 1" })).unwrap(); + assert_eq!(req.value, "x = 1"); + } + + #[test] + fn register_request_uses_camel_case() { + let req: RegisterRequest = serde_json::from_value(json!({ + "pythonFunctionCall": "mod.fn", + "numberOfArgs": 2 + })) + .unwrap(); + assert_eq!(req.python_function_call, "mod.fn"); + assert_eq!(req.number_of_args, Some(2)); + } + + #[test] + fn register_request_number_of_args_is_optional() { + for payload in [ + json!({ "pythonFunctionCall": "f" }), + json!({ "pythonFunctionCall": "f", "numberOfArgs": null }), + ] { + let req: RegisterRequest = serde_json::from_value(payload).unwrap(); + assert_eq!(req.number_of_args, None); + } + } + + #[test] + fn register_request_rejects_snake_case() { + let res = serde_json::from_value::(json!({ + "python_function_call": "f" + })); + assert!(res.is_err()); + } + + #[test] + fn register_request_rejects_out_of_range_arg_count() { + let res = serde_json::from_value::(json!({ + "pythonFunctionCall": "f", + "numberOfArgs": 256 + })); + assert!(res.is_err()); + } + + #[test] + fn run_request_keeps_arbitrary_json_args() { + let req: RunRequest = serde_json::from_value(json!({ + "functionName": "f", + "args": [1, "two", [3], { "four": 4 }, null, true] + })) + .unwrap(); + assert_eq!(req.function_name, "f"); + assert_eq!( + req.args, + vec![ + json!(1), + json!("two"), + json!([3]), + json!({ "four": 4 }), + json!(null), + json!(true) + ] + ); + } + + #[test] + fn run_request_requires_args() { + let res = serde_json::from_value::(json!({ "functionName": "f" })); + assert!(res.is_err()); + } + + #[test] + fn string_response_serializes_for_frontend() { + let value = serde_json::to_value(StringResponse { value: "Ok".into() }).unwrap(); + assert_eq!(value, json!({ "value": "Ok" })); + } +} + +mod plugin_state { + use super::*; + use std::sync::atomic::Ordering; + + #[test] + fn default_state_is_open_and_empty() { + let state = PluginState::default(); + assert!(!state.init_blocked.load(Ordering::Relaxed)); + assert!(state.function_map.lock().unwrap().is_empty()); + } +} + +mod entry_detection { + use super::*; + use std::fs; + + fn dir_with(files: &[&str]) -> tempfile::TempDir { + let dir = tempfile::tempdir().unwrap(); + for f in files { + fs::write(dir.path().join(f), "").unwrap(); + } + dir + } + + #[test] + fn compiled_entry_names() { + for name in [ + "main.so", + "main.cpython-312-darwin.so", + "main.cpython-311-x86_64-linux-gnu.so", + "main.pyd", + "main.cp312-win_amd64.pyd", + "main.pyc", + ] { + assert!(is_compiled_entry(name), "{name}"); + } + } + + #[test] + fn non_entry_names() { + for name in [ + "main.py", + "main.pyi", + "main.build", + "mainx.so", + "other.cpython-312-darwin.so", + "libmain.so", + "main", + ] { + assert!(!is_compiled_entry(name), "{name}"); + } + } + + #[test] + fn main_py_is_a_file_entry() { + let dir = dir_with(&["main.py"]); + assert_eq!( + find_entry(dir.path()), + Some(PythonEntry::File(dir.path().join("main.py"))) + ); + } + + #[test] + fn main_py_wins_over_compiled_module() { + let dir = dir_with(&["main.py", "main.cpython-312-darwin.so"]); + assert!(matches!(find_entry(dir.path()), Some(PythonEntry::File(_)))); + } + + #[test] + fn nuitka_module_is_a_module_entry() { + for file in [ + "main.cpython-312-darwin.so", + "main.cp312-win_amd64.pyd", + "main.pyc", + ] { + let dir = dir_with(&[file]); + assert_eq!( + find_entry(dir.path()), + Some(PythonEntry::Module { + name: "main".into(), + dir: dir.path().to_path_buf() + }), + "{file}" + ); + } + } + + #[test] + fn directory_named_like_module_is_ignored() { + let dir = tempfile::tempdir().unwrap(); + fs::create_dir(dir.path().join("main.so")).unwrap(); + assert_eq!(find_entry(dir.path()), None); + } + + #[test] + fn unrelated_files_yield_no_entry() { + let dir = dir_with(&["helper.py", "other.so", "requirements.txt"]); + assert_eq!(find_entry(dir.path()), None); + } + + #[test] + fn missing_directory_yields_no_entry() { + let dir = tempfile::tempdir().unwrap(); + assert_eq!(find_entry(&dir.path().join("missing")), None); + } +}