posit-dev / py-shiny

Shiny for Python
https://shiny.posit.co/py/
MIT License
1.32k stars 82 forks source link

Feature Parity for Session Object #697

Open random-user0 opened 1 year ago

random-user0 commented 1 year ago

Comparing the Session documentation for R Shiny and Python Shiny shows a lack of parity between the available features, with my specific interest being the userData functionality. What are the plans for the Python Shiny Session object to match R Shiny's functionality?

icejean commented 1 year ago

You can list all attributes available in the session object with the following code lines:

         for property, value in vars(session).items():
             print(property, ":", value)

There're only 2 None attributes in it: user and groups, then you can initialize user as a dictionary for session variables:

session.user = {"varName": varValue}

It isn't documented in py-shiny 's Doc and API, neither in examples too, hope that it'll be well documeneted in the future.

gshotwell commented 1 year ago

Great callout, I added this to the documentation site. Thanks for raising (and solving!) this issue.

icejean commented 1 year ago

Great! Glad to hear that. :)

emcrisan commented 1 month ago

Hello, in regards to the session.user and related functions, are those features also available when an app is published on shinyapps.io? Could that be captured in the documentation as well? For reference, here are the docs related to posting on Posit Connect: https://docs.posit.co/connect/user/shiny-python/#user-meta-data