posit-dev / posit-dev/py-shiny

Remove `session` argument from methods that utilize `require_active_session()`

Open
#708 2 comments 0 reactions 1 assignee View on GitHub

@schloerke is already working on this.

Since Aug 28, 2023.

Priority: Low
Dominant language
Python
Stars
1.8k
Forks
135
Avg merge
2d 18h
Merged PRs (30d)
21

Description

Having the session is good for resolving the correct DOM id (such as when in modules), and for sending messages to the browser.

However, some update methods to not utilize the session being sent in:

In addition, the session object is something that users shouldn't really be setting.


Proposal:

  • Remove session from methods whose API has session for context only
    • Ex: update_*() methods, notification_{show,remove}(), etc.
  • Internally use session = require_active_session(None) to retrieve the session
  • Show examples of using with shiny.session.session_context(session=): to set the context. Such as in an app where a button updates two modules's checkbox group choices.

Doing this would naturally resolve the two situations above and make the API cleaner.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.