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

Streamlit migration Guide #5027

Merged
merged 55 commits into from
Jul 2, 2023
Merged

Conversation

MarcSkovMadsen
Copy link
Collaborator

@MarcSkovMadsen MarcSkovMadsen commented Jun 3, 2023

Closes #5016

You can preview the guides here

I really hope that this will help our users migrate. And that it will inspire us to improve our framework like in #5019.

Todo

  • Create the content
  • Check some Streamlit guides that no key concepts have been forgotten
  • Improve the guide and test all examples
  • Record and add .png ang .gif where needed.
  • Finalize Implement support for reactive generator functions #5019
  • Get Review and improve
    • Please check toctree, grids, cards and similar. I don't know how to build this effectively. Takes 10 mins for me to figure out how. Takes 30-60 mins for me to build the documentation.
    • Please consider whether the Panel code examples can be considered best practice
    • Please consider whether we are missing some functionality in Panel to make the migration easy.
  • Philipp: Fix pn.cache only caches for a session.  #5109
  • Convert absolute links to relative links.
    • Please help me. I tried but failed. I need help to do this. Because of the way the documentation is built I cannot always discover or test the right relative links.
  • Andrew offered to contribute session state example with dynamic layouts.
  • List improvement ideas in List of improvements inspired by Streamlit Migration Guide #5028
  • Philipp: Move assets like .png and .gif files to the cdn
  • Refactor into standalone guides

Maybe one day in another PR

Describe migrating

  • Forms
  • Custom components

@MarcSkovMadsen
Copy link
Collaborator Author

MarcSkovMadsen commented Jun 5, 2023

I see this PR surving multiple purposes.

The primary purpose is to provide

  • a resource that can help users migrate from Streamlit to Panel. This was motivated by a request for help by a user on Discourse.

But it also indirectly provides

  • an alternative introduction to Panel for users already are familiar with Streamlit
  • a means of comparing Streamlit and Panel on a more detailed level
  • a means of getting inspiration from Streamlit that can be used to improve our framework.

If someone thinks a "migration guide" would be seen as "agressive" (?) we could re-purpose the guide and focus on one or more of the indirect uses. If all together we don't think this fits into our documentation I could publish this as a personal blog post.

Personally I see a guide for users that comes with a Streamlit background as a helpful, natural thing to add and not aggressive at all. Streamlit is a benchmark and many users will better understand things in that context.

As context I would also plan to contribute a similar guide for Gradio one day as I and Panel could learn a lot from that one as well. And it would help users that have learned the Gradio way of building data apps to use our framework.

Please let me know (@maximlt , @philippjfr, @droumis ) if you think this guide should be repurposed or published as a personal blog post. Thanks.

@philippjfr
Copy link
Member

Personally I have no concerns here, we're not claiming Streamlit sucks we are just making it easier for existing users to translate concepts they already know if they find streamlit limiting.

@maximlt
Copy link
Member

maximlt commented Jun 5, 2023

Same, migration guides are going to be very helpful to users coming from other libraries.

@codecov
Copy link

codecov bot commented Jun 5, 2023

Codecov Report

Merging #5027 (7ffd59d) into main (eaf5853) will increase coverage by 11.19%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             main    #5027       +/-   ##
===========================================
+ Coverage   72.62%   83.82%   +11.19%     
===========================================
  Files         274      274               
  Lines       39583    39584        +1     
===========================================
+ Hits        28749    33181     +4432     
+ Misses      10834     6403     -4431     
Flag Coverage Δ
ui-tests 40.56% <ø> (?)
unitexamples-tests 73.76% <ø> (+1.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
panel/io/cache.py 84.29% <ø> (ø)
panel/io/state.py 73.45% <ø> (+2.93%) ⬆️
panel/pane/base.py 85.82% <ø> (+0.26%) ⬆️
panel/widgets/button.py 87.06% <ø> (ø)

... and 71 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@MarcSkovMadsen
Copy link
Collaborator Author

MarcSkovMadsen commented Jun 5, 2023

Assets

Hello World

streamlit-hello-world

panel-hello-world

Outputs

streamlit-matplotlib-example

panel-matplotlib-example

Inputs

streamlit-widgets-example

panel-widgets-example

Layouts

streamlit-layout-example

(Note: I could not find st.row, st.spacer, margin or similar functionality to layout this nicely with Streamlit)

panel-layout-example

Templates

panel-template-example

Interactivity Basic Example

streamlit-basic-interactivity-example

panel-basic-interactivity-example

Show Activity

show-activity-example

Interactivity Multiple Updates Example

streamlit-multi-updates-interactivity

panel-multiple-updates-interactivity

panel-multiple-updates-alternative example

Interactivity Multiple Outputs Example

streamlit-multiple-outputs-example

panel-multiple-outputs-example

Session Cache

panel-pn-cache-example

Session State

streamlit-session-state-example

panel-session-state-example

@MarcSkovMadsen MarcSkovMadsen marked this pull request as ready for review June 5, 2023 18:53
@philippjfr
Copy link
Member

If this is to stay in the how_to guide then we need to break this up into individual sections.

@MarcSkovMadsen
Copy link
Collaborator Author

If this is to stay in the how_to guide then we need to break this up into individual sections.

Do you mean the guide is too big and does not fit the concept of a how-to guide?

@philippjfr
Copy link
Member

Do you mean the guide is too big and does not fit the concept of a how-to guide?

Yep, but I think it could very cleanly be split up into a whole how-to section with various sub-guides. What do you think?

@MarcSkovMadsen
Copy link
Collaborator Author

It can probably be done but

  1. Do you want that. It will take up a lot of "space" compared to rest of guides.

  2. Will it work when we add migration guides for other frameworks?

@ahuang11
Copy link
Contributor

Just a thought; the benefit of it being on one page is the ability to CTRL+F

@philippjfr
Copy link
Member

It'd be organized just like the other how-to guides, each card on https://panel.holoviz.org/how_to/index.html corresponds to a how-to section with multiple smaller guides.

@MarcSkovMadsen
Copy link
Collaborator Author

So at https://panel.holoviz.org/how_to/index.html there would be a section called Migration Guides

One card would be Streamlit. Another Gradio.

If you click Streamlit you would navigate to another page with several cards each representing a section in the Streamlit Migration guide?

@philippjfr
Copy link
Member

Exactly right.

@MarcSkovMadsen
Copy link
Collaborator Author

I'll start working on this.

@philippjfr
Copy link
Member

Really appreciate this, this is looking really great!

@MarcSkovMadsen
Copy link
Collaborator Author

MarcSkovMadsen commented Jul 2, 2023

Migration to standalone guides is done. I've done a first review. Probably needs one or more reviews to make sure everything makes sense as individual guides and together.

I will try to do it before I leave for holiday later today. Otherwise feel free to do it and finalize 😄

@MarcSkovMadsen
Copy link
Collaborator Author

Is it possible to get this one deployed to the dev site @philippjfr . It would help a lot to see the rendered version.

@philippjfr
Copy link
Member

Is it possible to get this one deployed to the dev site @philippjfr . It would help a lot to see the rendered version.

You can always do this yourself:

Screen Shot 2023-07-02 at 13 10 09

@MarcSkovMadsen
Copy link
Collaborator Author

I just triggered it. After that I discovered you also triggered a docs build an hour ago @philippjfr . But the dev site seems not to be up?
image

@MarcSkovMadsen
Copy link
Collaborator Author

Looking at the docs I can see they failed due to PIL.

image

@philippjfr
Copy link
Member

Yeah something seems to have gone wrong when migrating from pyviz-dev to holoviz-dev

@philippjfr
Copy link
Member

I'm merging and fixing followup issues in separate PRs. Thank you so much @MarcSkovMadsen and thanks for your review/contributions @ahuang11!

@philippjfr philippjfr merged commit f7f9ea9 into main Jul 2, 2023
15 of 17 checks passed
@philippjfr philippjfr deleted the enhancement/streamlit-migration-guide branch July 2, 2023 16:46
@MarcSkovMadsen
Copy link
Collaborator Author

And thanks for generator functions and more. Our Api just got much better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add example comparing a simple Streamlit app to a Panel app.
6 participants