Skip to content
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

Shiny express changes behavior of inspecting callable objects #1675

Open
cpsievert opened this issue Sep 6, 2024 · 0 comments
Open

Shiny express changes behavior of inspecting callable objects #1675

cpsievert opened this issue Sep 6, 2024 · 0 comments

Comments

@cpsievert
Copy link
Collaborator

cpsievert commented Sep 6, 2024

Here is a minimal Shiny core app where the __name__ of a parameter annotation via inspect.signature() is what one would expect (int in this case):

import inspect
from shiny import App, ui

def foo(x: int):
    return x + 1

x = inspect.signature(foo).parameters["x"]
res = x.annotation.__name__

app_ui = ui.page_fixed(res)

app = App(ui=app_ui, server=None)

However, doing the same with Shiny express results in an error:

import inspect
import shiny.express

def foo(x: int):
    return x + 1

x = inspect.signature(foo).parameters["x"]
x.annotation.__name__
RuntimeError: 'str' object has no attribute '__name__'

For context, this means stuff like litellm.utils.function_to_dict won't work in express.

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

No branches or pull requests

1 participant