You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Compose host: rememberSaveable for Python (remember_saveable), and saved state survives recreation #174
User decision (2026-10-04): remember_saveable must be supported, as in the original pycomposeui (app-template pycomposeui Runtime.android.kt rememberSaveableWrapper) that UI.ipynb ran against. pythonx-compose wraps it (getValue/setValue/.value); this repository supplies the Kotlin side.
Work:
A Kotlin @composable wrapper in python-multiplatform-compose that dispatches on the initial value's type (Int, Long beyond 32 bits, Boolean, Double, String) to rememberSaveable { mutableXStateOf(init) } and returns the MutableState, exposed through the binder (KSP table). Called outside a composition it fails, as in Kotlin.
PythonAppView/PythonWidget compose under the platform's SaveableStateRegistry (Android: the Activity's; desktop: whatever the host provides), so saved values survive recreation.
Test: desktop, a host scene with a SaveableStateRegistry; a Python root remembers values of each type, changes them, the registry is saved, the composition is torn down and recreated from the saved state, and the values come back. Red first.
Notebook E2E: switch the root and state cells to the notebook's own spelling once pythonx-compose ships its wrapper (main.App.messages, getValue/setValue).
Completion: the test above, compose fixture and notebook E2E green; SPEC entry.
Activity
b-re-w commentedon Oct 3, 2026
Landed in develop