Repository navigation
Conversation
A plain dict for session-specific state that is not reactive, such as credentials. The dict is shared with module sessions (SessionProxy reads and writes the root session's dict) and is discarded when the session ends. This is the Python equivalent of Shiny for R's session$userData.
…n the agent skill Assigning session.user_data from a module used to silently detach the proxy from the root session's dict, as R's session$userData forbids. user_data is now a read-only property on every Session, and SessionProxy reads it live from the root session. Adds tests for the reassignment error and for reading user_data inside on_ended callbacks, and a user_data section in the bundled agent skill.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports
session$userDatafrom Shiny for R: a plain dict, created per sessionand shared with module sessions, for session-specific state that isn't
reactive.
Why
Code that only has a
session(a helper, a package, a module) has had nowhereto keep per-session state. Some things it unlocks:
once, and any module or helper can call an API on their behalf. It doesn't
need to be passed through every signature, and it never triggers
invalidation or lands in a bookmark the way a
reactive.Valuewould.per session, and close it in
session.on_ended.without creating reactive dependencies.
if "x" not in session.user_data.Use a
reactive.Valueinstead if the data should drive the UI.Behavior
on_ended.AttributeError, as R forbidsreassigning
userData.Also adds a section to the bundled
shiny-for-pythonagent skill.