Developping a panel app - dev tools for being efficient at it?

Hi @MaximIt

This is really a good question. Or at least its also one that concerns me a lot.

Here are my current thoughts

  1. As a beginner I would start out in a Notebook. It provides very fast feedback.
    • One problem though is that sometimes there are errors that only shows up in the browser console. I.e. you need to open that using CTRTL+SHIFT+I. Here Streamlit has a nicer way of working because it provides the error directly in the app it self. This helps beginners a lot.
    • I know @philippfr works in jupyterlabs. I’ve also thought about moving to that. But I actually don’t use Notebooks that much my self. But I have been starting because they are great for documentation.
    • One of the reasons that I’m very interested in Panel is that it supports the largest range of use cases from Notebook over Panel server and into Flask/ Django servers. That is really, really strong. I can build dashboards and small apps for “simple” users. But the same apps can be used by “advanced” users in Notebooks where they can use it to filter some data and then access the data directly in the Jupyter Notebook. That is very similar to how people work in Excel. Excel is a mix of Data and UI. And users can change/ improve the UI on the day if they need it.
  2. Later I would move to my favourite editor/ IDE. For me that is VS Code. And as my code/ app starts to grow I would seperate it into different files or folders. Something like
  • model: (Very simple model class descending from `param.Parameterized). Might have simple functions like str, repr, repr_html, to_dict,from_dict etc.
  • services: Extract, Transform and/ or Load functions. For example functions for getting data from databases or transforming a list of models (maybe via DataFrames).
  • plots: Seperate library for plotting. As its just handy and enables seperation of HoloViews, Plotly, Altair plots etc.
  • components: These are small, atomic, reusable Panel components that uses models, services and plots. For example a small component of dropdown for filtering some dataframe. The DataFrame might be included in the component or not.
  • apps: composed of multiple components.

One issue when working with python -m panel serve 'app.py' --dev --show is that the server reloads but it relatively slow. See https://github.com/bokeh/bokeh/issues/9501. So slowing down the development cycle. An alternative is to write the code in .py files but visually test in a Notebook and use importlib.reload to road the code easily. Sometimes this works great. But not always.

One great thing of the above layering is that its pretty easy to write smaller tests. Panel is actually great in that sense at you only have to use the Python test frameworks like pytest - even for functional tests. No need to learn or use javascript testing frameworks. I don’t think they are great.

Looking forward to other ideas and thoughts below.

2 Likes