caspian-native
Optional Tauri packaging for applications built with the Caspian framework and
PulsePoint. Version 0.0.1 packages the existing application in a system
WebView; it does not translate HTML into operating-system widgets.
Support in 0.0.1
| Target | Backend | Status |
|---|---|---|
| Windows | Embedded Python sidecar | Initial support |
| Windows | Remote Caspian server | Initial support |
| Android | Remote Caspian server | Initial support |
| Android | Embedded Python | Not supported yet |
Android embedded Python is deliberately refused. A Caspian application may
depend on native Python wheels such as asyncpg, cryptography, or Pillow;
shipping an APK without proving every wheel for every ABI would produce a
package that builds unreliably or fails on launch.
Install for development
python -m pip install -e ".[test,build]"
Tauri's CLI is installed separately so it can match the version selected by
the generated application's native/Cargo.toml:
cargo install tauri-cli --version "^2" --locked
Add native packaging to a Caspian project
From a directory containing caspian.config.json:
caspian-native init --identifier com.example.myapp --windows
caspian-native doctor --target windows
caspian-native backend build
caspian-native dev --target windows
caspian-native build --target windows
For an Android thin client backed by a deployed Caspian server:
caspian-native init \
--identifier com.example.myapp \
--windows --android \
--remote-url https://app.example.com
caspian-native doctor --target android
caspian-native build --target android
When Android is enabled, init also runs Tauri's non-interactive Android
project initializer. dev and build repeat this check and automatically
initialize native/gen/android for projects created by an earlier version.
The generated tauri.android.conf.json removes the desktop-only Python
sidecar from Android builds; Android always loads the configured remote server.
init uses Caspian's SVG icon as its vector source and generates the complete
Tauri icon set at each platform's required sizes. Re-running init --force also
refreshes launcher icons inside an existing generated Android Studio project.
Android receives a vector safe-zone foreground so launcher masks do not crop
the Caspian mark.
dev --target android starts the current project's standard npm run dev
stack and exposes its BrowserSync port only to the connected device through
adb reverse. The Android WebView loads BrowserSync's reload client, so Caspian
source/public changes use the same coordinated Python restart and refresh flow
as desktop browser development.
Use --android-backend remote to test the configured deployment instead.
Generated Android Rust targets include the linker flags needed for 16 KB page
sizes when building with Android NDK r27 or older.
The generated files live under native/. Re-running init never overwrites a
changed generated file unless --force is supplied.
Configuration
caspian.native.json is the source of truth:
{
"$schema": "./caspian.native.schema.json",
"schema": 1,
"productName": "My App",
"identifier": "com.example.myapp",
"version": "0.0.1",
"targets": ["windows"],
"window": {
"title": "My App",
"width": 1200,
"height": 800,
"resizable": true
},
"backend": {
"desktopMode": "embedded",
"remoteUrl": null
},
"security": {
"loopbackToken": true
}
}
Runtime model
Embedded desktop mode builds main.py, the Caspian runtime, project modules,
route index, and public/ into a one-file sidecar. The sidecar:
- restores a per-installation
AUTH_SECRETfrom application data; - imports the project's
main.appin production mode; - binds
127.0.0.1on an operating-system-assigned port; - prints the protected launch URL to the Tauri host;
- serves the normal Caspian ASGI application with Uvicorn.
The WebView receives a per-launch token once. The native middleware exchanges
it for an HttpOnly; SameSite=Strict cookie and refuses documents, assets,
RPCs, uploads, streams, and WebSocket handshakes without that cookie.
Caspian's production session cookie normally has the Secure flag. A packaged
loopback server intentionally uses http://127.0.0.1, so the adapter changes
only that middleware option before Starlette constructs the stack. The app
otherwise remains in production mode.
Native bridge
Pages may capability-check window.caspianNative:
const native = window.caspianNative;
if (native?.has("open-external")) {
await native.invoke("open_external", { url: "https://example.com" });
}
The bridge allowlist is intentionally short: platform, application version, application data directory, external HTTP/HTTPS/mail links, and a user-driven file picker. An XSS can reach every bridge command, so commands must remain safe even when the calling page is compromised.
Current limitations
- The first embedded-backend implementation uses PyInstaller and has only been designed for Windows packaging.
- Dynamic route discovery requires project Python sources and
settings/files-list.jsonto be bundled. - Secrets from
.envare never embedded. Remote database credentials and third-party credentials must be provisioned outside the package. - Android remote mode requires connectivity and a deployed Caspian server.
- Installer signing and Android store signing are not automated in
0.0.1.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file caspian_native-0.0.6.tar.gz.
File metadata
- Download URL: caspian_native-0.0.6.tar.gz
- Upload date:
- Size: 29.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be5a53d89a33adf139ae13976cb3c7cbc61c425c54c9cf3e0d217aa014004e71
|
|
| MD5 |
0265676ae9a360679d99fe56f09ce8b5
|
|
| BLAKE2b-256 |
f9a9ab326f17d0afd86a7bff3fa2c4b9d779243309a7143fd676bf4187a4d917
|
File details
Details for the file caspian_native-0.0.6-py3-none-any.whl.
File metadata
- Download URL: caspian_native-0.0.6-py3-none-any.whl
- Upload date:
- Size: 26.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08310a179394ed892212d0ebc5c0ee7f512ec44f43de9c86dbdeab827767e1d9
|
|
| MD5 |
9e7f522f3414eefa80e7661394a4c635
|
|
| BLAKE2b-256 |
06c02812023fd5c0b49748625a3f11c2c84027ccc3b45e6bd1c883f52aa03a47
|