Eric J Ma's Website

PyViz Panel Apps

written by Eric J. Ma on 2019-07-26 | tags: data science data products app deployment


The key things I learned building my first Panel app: prototype in the notebook, use .servable() on the thing to serve up, test locally, and use Heroku!

I finally learned how to build and serve apps with Panel!

Here are the key ideas:

  1. Prototype the app inside a Jupyter notebook. That gives the real-time feedback on whether your apps/widgets are working or not.
  2. The most important thing is that the final thing you package together is now a .servable() object.
  3. Use Panel’s serve command to test the app locally. It’s actually quite magical - the serve command can actually parse a Jupyter notebook and serve it up on a local web server.
  4. When you’ve confirmed that everything is working properly locally, Heroku is a great deployment option. Using the default Python buildpack and a requirements.txt file, one can easily specify the exact Python environment for deployment.

As a pedagogical implementation, I put up a minimal panel app on GitHub, and also served it up on Heroku. Come check it out! I hope it’s useful for you.


Cite this blog post:
@article{
    ericmjl-2019-pyviz-panel-apps,
    author = {Eric J. Ma},
    title = {PyViz Panel Apps},
    year = {2019},
    month = {07},
    day = {26},
    howpublished = {\url{https://ericmjl.github.io}},
    journal = {Eric J. Ma's Blog},
    url = {https://ericmjl.github.io/blog/2019/7/26/pyviz-panel-apps},
}
  

I send out a newsletter with tips and tools for data scientists. Come check it out at Substack.

# TODO(eric): learn how to learn anything. feb 2027.

If you would like to sponsor the coffee that goes into making my posts, please consider GitHub Sponsors!

learn anything --with ai --feb 2027 → 5 days · in person · a small cohort → feb 14-20, 2027 · learn-anything.nonlinearlabs.ai