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

Add Panel tutorials #5525

Merged
merged 25 commits into from
Jan 15, 2024
Merged

Add Panel tutorials #5525

merged 25 commits into from
Jan 15, 2024

Conversation

philippjfr
Copy link
Member

@philippjfr philippjfr commented Sep 20, 2023

  • 01. Param: Basics for Panel [@philippjfr]
    • What is a Parameter?
    • Getting and setting the value
    • Parameters as references (convering indirect references via bind and eventually reactive expressions)
    • Writing parameterized classes with depends, using the pn.Param pane and Widget.from_param
  • 02. Components: Core Components [@maximlt]
    • What are core component types?
      • Panes: Display some object, can be updated by setting .object
      • Widget: Allow getting user input, act as a proxy for their .value parameter
      • Layout: Two main types ListLike and GridLike, contents can be replaced
    • Briefly go over some of the main parameters shared by all components, i.e. margin, loading, width, height, styles etc.
  • 03. Interactivity: Effectively using APIs for adding interactivity and reactivity [@philippjfr]
    • Recap parameters as references
    • Go over reactive vs. imperative
    • Go over function vs. class based
  • 04. Efficient Development: Debugging and effective development in VSCode and JupyterLab [@maximlt]
    • JupyterLab
      • Using the panel-preview button and endpoint
    • VSCode
      • Using --autoreload on the commandline
      • Using the debugger
      • Maybe just add screenshots (will try to do this live as part of the training)
  • 05. Layouts: Achieving responsive layouts [@philippjfr]
    • Explain inherent sizing
    • Explain sizing modes and width/height responsiveness
    • Explain approaches to real screen responsiveness
  • 06. Structuring your application code: Classes & Design Patterns [@philippjfr]
    • Recap function vs. class based approaches
    • Begin structuring application with multiple Parameterized classes
    • Use central DataStore pattern that drives the different views
  • 07. Styling: How to leverage designs, stylesheets and CSS [@philippjfr]
  • 08. Multi-page Apps: Different approaches for designing multi-page applications [@maximlt]
  • 09. Scalability: Async, threading, profiling and caching
  • 10. Server: Effectively working with the server [@philippjfr]
    • Quick explanation of Server, Sessions and how global state is stored
    • Compare CLI vs pn.serve (i.e. latter has more control over routing)
    • Discuss serving extra assets and other endpoints
  • 11. Deep Linking: Adding deep links and persistent sessions [@ahuang11]
    • Introduce pn.state.location and pn.state.session_args
    • Start building example that syncs Parameter state
    • Add example of a second app and then sync/unsync depending on the currently selected app
    • Discuss example where there is significant session state and create a unique user ID based on pn.state.user (assuming Auth has been configured)
  • 12. Authentication and Authorization: Configuring and effectively using OAuth [@philippjfr]

@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (15ba95e) 84.45% compared to head (90e3e36) 84.16%.
Report is 6 commits behind head on main.

❗ Current head 90e3e36 differs from pull request most recent head 9e8f09f. Consider uploading reports for the commit 9e8f09f to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5525      +/-   ##
==========================================
- Coverage   84.45%   84.16%   -0.29%     
==========================================
  Files         299      301       +2     
  Lines       44677    45099     +422     
==========================================
+ Hits        37730    37958     +228     
- Misses       6947     7141     +194     
Flag Coverage Δ
ui-tests 40.70% <ø> (+0.03%) ⬆️
unitexamples-tests 71.84% <ø> (-0.42%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MarcSkovMadsen
Copy link
Collaborator

MarcSkovMadsen commented Sep 20, 2023

Are you sure these are tutorials?

If I look at https://diataxis.fr/tutorials/, tutorials should Lead the user through a series of successfull steps and help the user build something meaningful. Not explain anything.

@philippjfr
Copy link
Member Author

philippjfr commented Sep 20, 2023

In all likelihood they will not be added to the docs in their current form, I mainly needed somewhere to put them for now. So no, these are not tutorials in the Diataxis documentation sense, at least not yet.

Not explain anything.

This is, I think, a mischaracterization, the point Diataxis makes is the explanation is not what they should take away from the material but rather just a means to get them to do something practical. The important thing is to get across how to achieve something, it is imo okay to explain plain facts, i.e. the that, but only as a means to get them to apply the knowledge. What absolutely shouldn't be in a tutorial is the why.

Even for the current purpose my current material is just a start and I still need to make sure that the existing material:

  1. Clearly states what they are going to learn in each section
  2. Doing a better job of using the knowledge to get them to build something practical and meaningful

This material will be the basis of a training course and once I've delivered it I'll see if and how we can adapt it to our docs or whether it'll be completely separate. Likely I will try to split each section into theory and practice and the practice part is what fits the Diataxis tutorial definition.

@philippjfr
Copy link
Member Author

That all being said I also struggle a lot here, my goal for this tutorial is to get someone to a relatively deep understanding of Panel in a relatively small amount of time. I realize this won't happen in one big session but will require revisiting these materials a few times. At the same time I struggle to see how a purely practical tutorial without anything stage-setting will be enough to get any understanding or proficiency.

@ahuang11
Copy link
Contributor

ahuang11 commented Sep 20, 2023

Perhaps, we should reframe these as course materials, rather than tutorials, and we shouldn't try to create both in one go.

It's better to show less and have the users interested enough to explore on their own, rather than cram everything and have them completely lost.

@maximlt
Copy link
Member

maximlt commented Sep 21, 2023

We currently have a pretty major problem in Panel's docs, for a new user there's a big hole after going through the Getting Started, that is definitely too short to learn how to build any kind of app that is not trivial. The User Guides we used to have served that purpose somehow, you could go through one after the other. With the How-To's, we've gained content that is useful for when you're working on an app and have already some knowledge, or when you look for something specific, but we've lost that learning experience, going through all the how-to's doesn't feel very natural to me (how-to's are also a better way to scale docs compared to the user guides, which is good!).

There's really one thing you can do with Panel: build an app. The Getting Started covers that quickly, my vision is that we're building an advanced tutorial that users will follow when they're done with the Getting Started, decide to commit with Panel and/or embark on building a more complex app. It's going to be generic, because Panel is a generic framework and that's the HoloViz philosophy. In the future we can still add new tutorials, e.g. build a BI app, build a data app, build a machine learning app, etc.

To have a nice advanced tutorial I believe we will need (not for this PR!):

  • an app that we build step by step
  • to link to other places in the docs when required, I'm sure we can do a much better job a linking our docs!

We also need to figure out what exactly should go in the Explanation category.

@philippjfr
Copy link
Member Author

an app that we build step by step

Are you suggesting that each tutorial section builds up one app step by step growing in complexity each time?

@maximlt
Copy link
Member

maximlt commented Sep 21, 2023

Are you suggesting that each tutorial section builds up one app step by step growing in complexity each time?

Yes, even if that shouldn't be a strict rule, if there's a concept or example you want to include in a guide but that just doesn't fit in the final app. Having to build an app through the tutorial will help framing it, it will also be a nicer experience for those following it. They can go away with a complex app built based on what we consider good practices.

(I believe the app you showed us the other day internally would be a good candidate)

@philippjfr
Copy link
Member Author

I've gone back and forth on that idea a lot, my concern is that it'll be very hard to do that well. It's very hard to slowly build up an app in a way that makes sense in terms of a pedagogical progression, i.e. the concepts that you want to teach first may not necessarily overlap with the first steps you do when building an app. It may be easier to simply build the full app and then pull out bits and pieces to allow the user to recreate those through exercises but I'm honestly unsure about that too.

@MarcSkovMadsen
Copy link
Collaborator

What about taking inspiration from some that are famous for good docs. Like Django, FastApi or Streamlit?

@MarcSkovMadsen
Copy link
Collaborator

What about taking inspiration from the Streamlit Guide. They start by introducing simple things. It could be layouts, Panes and templates. Dynamic layouts and Streaming with generators are also powerful and relatively simple. They can bring a lot of value already to users. Then later widgets, parameters, bind etc.

@cdeil
Copy link
Contributor

cdeil commented Sep 22, 2023

My 2 cents: I think this will be super! :-)

My main problem with https://panel.holoviz.org/ to learn Panel was that there's so much content that it's almost impossible to read it all, and it's very difficult to figure out a useful order in which to read pages under "how to" and "explanation" and the galleries. I got lost.

What I like is how here I have 1, 2, 3, ..., 12 with a clear path. I can read through it all and learn Panel thoroughly in a weekend, or of course also omit topics if I don't need them. But it's finite and well-structured. Other docs I like for that reason (clear order and structure) is e.g. https://doc.rust-lang.org/book/ or https://shiny.posit.co/

I think teaching Panel by building a complex app and refactoring it over and over and learning new concepts is also fantastic. I would love to do such a course. But it's very hard to put together. I remember reading https://www.flaskbook.com/ years ago where this is done in Part II, and Part I is more like this tutorial introducing topics one by one with several small apps. So it could come later as Part II for Panel as well?

@maximlt
Copy link
Member

maximlt commented Sep 22, 2023

I can only agree with you @cdeil :) We have certainly neglected tutorials a little bit too much (for good reasons! as we improved a lot the remaining content). I think an critical point is that when you have good tutorial/learning content, advanced/interested Panel users can own it more easily which enables them teach their peers better. For instance, if we have some good tutorials, I wouldn't be surprised to see some people leveraging them to produce videos for Youtube.

@MarcSkovMadsen
Copy link
Collaborator

MarcSkovMadsen commented Sep 23, 2023

One question I have is whether the getting started section is something separate. This is a tutorial focusing on getting started. Here every new user should get started to get the basic understanding. It should be very easy to identify as the tutorial for new users.

The there is a separate tutorials page with other tutorials. Could be Panel topic specific tutorials, domain specific tutorials and maybe even links to some of the best external tutorials shared by the community as blog posts and videos? These tutorials are read when you need to start learning about some more complex topic. Could be ReactiveHTML, could be AI Chat interfaces, could be using Panel in Finance etc.

@maximlt
Copy link
Member

maximlt commented Sep 25, 2023

The there is a separate tutorials page with other tutorials. Could be Panel topic specific tutorials, domain specific tutorials and maybe even links to some of the best external tutorials shared by the community as blog posts and videos? These tutorials are read when you need to start learning about some more complex topic. Could be ReactiveHTML, could be AI Chat interfaces, could be using Panel in Finance etc.

I've wanted a Tutorials section for a while, that's the only place so far where we diverge completely from Diataxis. I believe the Getting Started should be the first tutorial presented on that page, and that it should be linked from the docs homepage and from the future landing page.

@MarcSkovMadsen
Copy link
Collaborator

As inspiration for learning about a web frameworks features see https://eugenkiss.github.io/7guis/tasks

@cdeil
Copy link
Contributor

cdeil commented Dec 21, 2023

Any chance to get this merged and available in the docs?

It's inactive since over 2 months.

Could it just go in as-is and then see incremental improvements moving forward?
Or is some big refactor or streamlining or small improvements still needed here?

Let me know if there's anything specific I could help with - would love to see this in the docs and take some (admittedly limited) time to help with edits or review here.

@philippjfr
Copy link
Member Author

I'm merging tutorials 1-7 from above and will continue iterating on them.

doc/tutorials/index.md Outdated Show resolved Hide resolved
@philippjfr philippjfr merged commit aa160de into main Jan 15, 2024
1 check passed
@philippjfr philippjfr deleted the tutorial branch January 15, 2024 20:51
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.

None yet

5 participants