posit-dev / posit-dev/py-shiny

Render should error if not called within output

Open
#699 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Currently this application will run but not produce any results. Seems like we should have an error here.

from shiny import Inputs, Outputs, Session, App, ui, render
import pandas as pd
from pathlib import Path

infile = Path(__file__).parent / "penguins.csv"
penguins = pd.read_csv(infile)

app_ui = ui.page_fluid(ui.output_data_frame("penguins_df"))


def server(input: Inputs, output: Outputs, session: Session):
    @render.data_frame
    @output
    def my_df():
        return penguins


app = App(app_ui, server)

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.

Research direction

Reproduce the behavior with the supplied Python example, starting at the server function and the @render.data_frame and @output decorators. Trace how the output is registered and determine where this usage can be detected; done means the application raises a clear error instead of running without results.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.