Skip to content

feat(clientdata): id is now optional on clientdata.output_*() methods #1978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Jul 24, 2025

Conversation

cpsievert
Copy link
Collaborator

@cpsievert cpsievert commented Apr 22, 2025

See the changes to CHANGELOG for a description of what this PR adds.

A minimal example:

import matplotlib.pyplot as plt
import numpy as np

from shiny.express import render, session, ui

ui.input_dark_mode()

@render.plot
def myplot():
    plt.figure()
    plt.hist(np.random.normal(size=100))  # type: ignore

    bg_color = session.clientdata.output_bg_color()
    plt.title(f"bgcolor: {bg_color}")
Screenshot 2025-04-22 at 6 18 30 PM Screenshot 2025-04-22 at 6 18 52 PM

@cpsievert cpsievert force-pushed the feat/current_output_id branch from d7e3815 to 088ef7b Compare April 22, 2025 23:21
@cpsievert cpsievert force-pushed the feat/current_output_id branch from 088ef7b to e97b0f0 Compare April 22, 2025 23:23
@cpsievert cpsievert requested a review from Copilot April 23, 2025 15:07
Copilot

This comment was marked as outdated.

@cpsievert cpsievert changed the title feat(session): add current_output_id attribute and make id optional on clientdata output methods feat(Session): add .current_output_id() method and make id optional on clientdata.output_*() methods Apr 23, 2025
@cpsievert cpsievert requested a review from Copilot April 23, 2025 23:15
Copilot

This comment was marked as off-topic.

@cpsievert cpsievert marked this pull request as ready for review April 23, 2025 23:17
@cpsievert cpsievert requested a review from schloerke April 23, 2025 23:17
@cpsievert cpsievert changed the title feat(Session): add .current_output_id() method and make id optional on clientdata.output_*() methods feat(clientdata): id is now optional on clientdata.output_*() methods May 1, 2025
@cpsievert cpsievert requested a review from schloerke May 1, 2025 18:07
@cpsievert
Copy link
Collaborator Author

@schloerke my memory is a little fuzzy, but I think we had agreed this was OK as is?

@schloerke
Copy link
Collaborator

It is good, but I do not want to alter AsyncValueFn.

I'm almost done with a fix.

@schloerke schloerke marked this pull request as draft July 24, 2025 18:33
@schloerke schloerke marked this pull request as ready for review July 24, 2025 18:51
@schloerke schloerke enabled auto-merge (squash) July 24, 2025 18:51
@schloerke
Copy link
Collaborator

@cpsievert This is ready to go. Please take a look at the changes.

Changes:

  • Module support has been added / tested
  • Module support has been added to ClientData
  • We only add the current output name into the ClientData class

@schloerke
Copy link
Collaborator

@cpsievert There's an unrelated failure from shinytemplates (@karangattu is fixing) that is preventing auto merging. Please admin merge when ready.

@cpsievert
Copy link
Collaborator Author

Ahh, thank you for the fixes!! 🍻

@cpsievert cpsievert disabled auto-merge July 24, 2025 20:55
@cpsievert cpsievert merged commit c12e649 into main Jul 24, 2025
63 of 66 checks passed
@cpsievert cpsievert deleted the feat/current_output_id branch July 24, 2025 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants