Skip to content

Conversation

@bealdav
Copy link

@bealdav bealdav commented Aug 11, 2025

📝 Summary

shiny python example

https://github.com/posit-dev/py-shiny

I've just imitate flask and fasthtml example but I don't get it works for now because I'm not familiar with starlette. I suppose I'm near to have it works. Advice of experts welcome

Thanks

🔍 Description of Changes

📋 Checklist

  • I have read the contributor guidelines.
  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • I have added tests for the changes made.
  • I have run the code and verified that it works as expected.

@github-actions
Copy link

github-actions bot commented Aug 11, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@vercel
Copy link

vercel bot commented Aug 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Project Deployment Preview Comments Updated (UTC)
marimo-docs Ready Preview 💬 Add feedback Aug 12, 2025 6:55am

@bealdav
Copy link
Author

bealdav commented Aug 11, 2025

I have read the CLA Document and I hereby sign the CLA

@bealdav bealdav changed the title example: shiny example: shiny py-shiny Aug 11, 2025


def shiny_server(input, output, session):
@render.text

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@render.text
@render.ui

Comment on lines 53 to 59
head = """
<head>
<script src="https://cdn.tailwindcss.com" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/full.min.css"
<title>Marimo apps in Shiny</title>
</head>
"""

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To ensure this JS/CSS gets included on the page only once, put it in the UI instead:

shiny_ui = ui.page_fluid(
    ui.head_content(
        ui.tags.script(src="https://cdn.tailwindcss.com"),
        ui.tags.link(href="https://cdn.jsdelivr.net/npm/[email protected]/dist/full.min.css", rel="stylesheet"),
    ),
    ui.output_ui("_html"),
    title="Marimo apps in Shiny"
)

</head>
"""
body = f"""
<body>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the <body> is necessary?

Suggested change
<body>

{''.join(subdiv)}
</div>
</div>
</body>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
</body>
</body>
Suggested change
</body>

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for your review.

For now, script nor more works.
I'll try again tomorrow

@bealdav
Copy link
Author

bealdav commented Aug 12, 2025

@cpsievert I've done visual improvements but I don't know how to make it works with routing ?

Could you help me ? Thanks a lot

You can push directly here
https://github.com/bealdav/marimo/tree/shiny-example

@bealdav
Copy link
Author

bealdav commented Aug 12, 2025

@cpsievert Do you think it's possible to execute marimo and shiny in the same page ?

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