A high-level app and dashboarding solution for Python



A high-level app and dashboarding solution for Python

Build Status Linux/MacOS Build Status
Coverage codecov
Latest dev release Github tag dev-site
Latest release Github release PyPI version panel version conda-forge version defaults version
Docs gh-pages site
Support Discourse

What is it?

Panel provides tools for easily composing widgets, plots, tables, and other viewable objects and controls into custom analysis tools, apps, and dashboards. Panel works with visualizations from Bokeh, Matplotlib, HoloViews, and many other Python plotting libraries, making them instantly viewable either individually or when combined with interactive widgets that control them. Panel works equally well in Jupyter Notebooks, for creating quick data-exploration tools, or as standalone deployed apps and dashboards, and allows you to easily switch between those contexts as needed.

Panel makes it simple to make:

  • Plots with user-defined controls
  • Property sheets for editing parameters of objects in a workflow
  • Control panels for simulations or experiments
  • Custom data-exploration tools
  • Dashboards reporting key performance indicators (KPIs) and trends
  • Data-rich Python-backed web servers
  • and anything in between

Panel objects are reactive, immediately updating to reflect changes to their state, which makes it simple to compose viewable objects and link them into simple, one-off apps to do a specific exploratory task. The same objects can then be reused in more complex combinations to build more ambitious apps, while always sharing the same code that works well on its own.

Attractors
Gapminders
NYC Taxi
Glaciers
Portfolio Optimizer

Using Panel for declarative, reactive programming

Panel can also be used with the separate Param project to create interactively configurable objects with or without associated visualizations, in a fully declarative way. With this approach, you declare your configurable object using the pure-Python, zero-dependency param library, annotating your code with parameter ranges, documentation, and dependencies between parameters and your code. Using this information, you can make all of your domain-specific code be optionally configurable in a GUI, with optional visual displays and debugging information if you like, all with just a few lines of declarations. With this approach, you don't ever have to commit to whether your code will be used in a notebook, in a GUI app, or completely behind the scenes in batch processing or reports -- the same code can support all of these cases equally well, once you declare the associated parameters and constraints. This approach lets you completely separate your domain-specific code from anything to do with web browsers, GUI toolkits, or other volatile technologies that would otherwise make your hard work become obsolete as they change over time.

Usage

Panel can be used in a wide range of development environments:

Editor + Server

You can edit your Panel code as a .py file in any text editor, marking the objects you want to render as .servable(), then launch a server with panel serve my_script.py --show to open a browser tab showing your app or dashboard and backed by a live Python process.

JupyterLab and Classic notebook

In the classic Jupyter notebook environment and JupyterLab, first make sure to load the pn.extension(). Panel objects will then render themselves if they are the last item in a notebook cell. For versions of jupyterlab>=3.0 the necessary extension is automatically bundled in the pyviz_comms package, which must be >=2.0. However note that for version of jupyterlab<3.0 you must also manually install the JupyterLab extension with:

jupyter labextension install @pyviz/jupyterlab_pyviz

Google Colab

In Google Colaboratory, rendering for each notebook cell is isolated, which means that every cell must reload the Panel extension code separately. Panel can do this automatically when you first load the extension if you declare that you are running in Colab: pn.extension(comms='colab'). Otherwise you will need to put pn.extension() in each cell where you want to display Panel output. Either way, you should be able to have access to all of Panel's functionality, though with a larger notebook size than with other notebook technologies that allow display code to be shared across cells.

VSCode

Visual Studio Code (VSCode) versions 2020.4.74986 and later support ipywidgets, and Panel objects can be used as ipywidgets since Panel 0.10 thanks to jupyter_bokeh, which means that you can now use Panel components interactively in VSCode. Ensure you install jupyter_bokeh with pip install jupyter_bokeh or conda install -c bokeh jupyter_bokeh and then enable the extension with pn.extension(comms='vscode').

nteract and other ipywidgets notebooks

In other notebook environments that support rendering ipywidgets interactively, such as nteract, you can use the same underlying ipywidgets support as for vscode: Install jupyter_bokeh and then use pn.extension(comms='ipywidgets').

Other environments

If your development environment offers embedded Python processes but does not support ipywidgets or Jupyter "comms" (communication channels), you will notice that some or all interactive functionality is missing. Some widgets that operate only in JavaScript will work fine, but others require communication channels between JavaScript and Python. In such cases you can either request ipywidgets or Panel support from the editor or environment, or else use the Editor + Server approach above.

Sponsors

The Panel project is grateful for the sponsorship by the organizations and companies below:

Anaconda Logo Blackstone Logo
Owner
HoloViz
High-level tools to simplify visualization in Python
HoloViz
Comments
  • VTK Synchronized

    VTK Synchronized

    supersede: https://github.com/holoviz/panel/pull/1070

    Remaining tasks:

    • [x] clean code (remove old serializer, refactor render function on js side, ...)
    • [x] Split the old VTK pane in:
      • VTKJS (to load vtkjs files)
      • VTKSynchronized to handle vtkrender window
    • [x] to handle vtkScalarBarActor (colorbar https://github.com/holoviz/panel/pull/1270)
    • [x] Documentation:
      • [x] split old VTK notebook
      • [x] update gallery interactive demo

    Future tasks (in an other PR)

    • [ ] discussion on the API we want to expose
    • [ ] extend the serializer
      • to handle volumes (will need vtk-js modifications)
    • [x] new Notebook to document capabilites of VTKSynchronized pane

    @philippjfr I think the PR is ready for review, everithing should almost work as before. There are some small API breaks (for colorbars and mostly on javascript side)

    I'll make more doc improvement in an other PR

    ezgif com-video-to-gif (1)

  • Vtk plot

    Vtk plot

    Panel model for vtk representations

    A minimal example is the following image

    Should not work for the moment (need next bokeh version)

    TODO: Add tests clean api to work with vtk renderers

    Examples:

  • WebComponent pane to dramatically speed up creating new widgets in Panel

    WebComponent pane to dramatically speed up creating new widgets in Panel

    I believe I have created a proof of concept for how to use web components in panel to speed up the time to market for creating new widgets.

    If you run something like

    python -m panel serve 'panel\components\wired\buttons.py' --dev --show
    

    Then you can explore the below

    It's not all fully working yet - but the principles have been identified.

    web_component_poc

  • WIP adding React Grid Layout Template

    WIP adding React Grid Layout Template

    This pull request is trying to add an easy way to use a draggable and droppable grid in the panel templates. It is based on

    https://github.com/STRML/react-grid-layout

    The main difference with the other templates is you have to add the position and size of the grid element. Here you have an example

    import panel as pn, numpy as np
    import holoviews as hv
    from panel.template import DarkTheme
    from holoviews import opts
    pn.extension()
    
        
    xs = np.linspace(0, np.pi)
    freq = pn.widgets.FloatSlider(name="Frequency", start=0, end=10, value=2)
    phase = pn.widgets.FloatSlider(name="Phase", start=0, end=np.pi)
    
    @pn.depends(freq=freq, phase=phase)
    def sine(freq, phase):
        return hv.Curve((xs, np.sin(xs*freq+phase))).opts(
            responsive=True)
    cur = hv.DynamicMap(sine)
    cur.opts(responsive = True)
    
    tmpl = pn.template.ReactTemplate(title='React Grid Layout Template', theme=DarkTheme)
    
    tmpl.main.append(pn.Row(hv.element.tiles.CartoDark().opts(shared_axes=False,responsive=True), sizing_mode = 'stretch_both'))
    tmpl.add_data_grid('grilla1', {'x':0,'y':0,'h':6,'w':4})
    
    tmpl.main.append(pn.Card(cur, title='Sine',sizing_mode = 'stretch_both'))
    tmpl.add_data_grid('grilla2', {'x':4,'y':0,'h':6,'w':4})
    
    tmpl.main.append(pn.Row(cur, sizing_mode = 'stretch_both'))
    tmpl.add_data_grid('grilla3', {'x':8,'y':0,'h':6,'w':4})
    
    tmpl.main.append(pn.Row(cur, sizing_mode = 'stretch_both'))
    tmpl.add_data_grid('grilla4', {'x':0,'y':6,'h':6,'w':4})
    
    tmpl.main.append(pn.Row(cur, sizing_mode = 'stretch_both'))
    tmpl.add_data_grid('grilla5', {'x':4,'y':6,'h':6,'w':4})
    
    tmpl.main.append(pn.Row(cur, sizing_mode = 'stretch_both'))
    tmpl.add_data_grid('grilla6', {'x':8,'y':6,'h':6,'w':4})
    
    tmpl.sidebar.append(freq)
    tmpl.sidebar.append(phase)
    
    tmpl.show()
    

    and here you have how it works.

    dark_RGL

  • Error: Model 'panel.models.markup.HTML' does not exist.

    Error: Model 'panel.models.markup.HTML' does not exist.

    System Info

    Latest MASTER after release of Panel 9.5

    My Pain

    I'm working on some contributions to Panel. For example at https://github.com/holoviz/panel/pull/1157 and https://github.com/holoviz/panel/pull/1122.

    • After having run git pull holoviz master to get the laster master from the holoviz github repo,
    • after upgrading bokeh to 2.01 (https://github.com/holoviz/panel/issues/1232)
    • after running panel build panel

    panel serve no longer shows any thing in the browser.

    If get error messages in the browser console like

    console.trace() Error: "Model 'panel.models.markup.HTML' does not exist. This could be due to a widget or a custom model not being registered before first usage."
        Models http://localhost:5006/static/js/bokeh.js?v=a4e6427fa46908492038842d99d5a1aa:1303
        _instantiate_object http://localhost:5006/static/js/bokeh.js?v=a4e6427fa46908492038842d99d5a1aa:863
        _instantiate_references_json http://localhost:5006/static/js/bokeh.js?v=a4e6427fa46908492038842d99d5a1aa:879
        from_json http://localhost:5006/static/js/bokeh.js?v=a4e6427fa46908492038842d99d5a1aa:1110
        _repull_session_doc http://localhost:5006/static/js/bokeh.js?v=a4e6427fa46908492038842d99d5a1aa:36056
    bokeh.js:36082:78
        _repull_session_doc http://localhost:5006/static/js/bokeh.js?v=a4e6427fa46908492038842d99d5a1aa:36082
    [bokeh] Failed to repull session Error: Model 'panel.models.markup.HTML' does not exist. This could be due to a widget or a custom model not being registered before first usage. bokeh.js:36083:34
    [bokeh] Failed to load Bokeh session NMQeF9cdOy3WO0iOFwl1BA0nnY1auiiYFn0gDi1bMtKy: Error: Model 'panel.models.markup.HTML' does not exist. This could be due to a widget or a custom model not being registered before first usage. bokeh.js:35924:30
    Error rendering Bokeh items: Error: "Model 'panel.models.markup.HTML' does not exist. This could be due to a widget or a custom model not being registered before first usage."
        Models http://localhost:5006/static/js/bokeh.js?v=a4e6427fa46908492038842d99d5a1aa:1303
        _instantiate_object http://localhost:5006/static/js/bokeh.js?v=a4e6427fa46908492038842d99d5a1aa:863
        _instantiate_references_json http://localhost:5006/static/js/bokeh.js?v=a4e6427fa46908492038842d99d5a1aa:879
        from_json http://localhost:5006/static/js/bokeh.js?v=a4e6427fa46908492038842d99d5a1aa:1110
        _repull_session_doc http://localhost:5006/static/js/bokeh.js?v=a4e6427fa46908492038842d99d5a1aa:36056
    

    image

    Solution

    I don't know how to solve this so instructions on how to solve this would be very appreciated.

    And if I could even understand what the problem is so that I can solve similar problems on my own in the future it would be nice.

  • Introductory example doesn't seem to work

    Introductory example doesn't seem to work

    Setup

    Machine: OSX relevant conda packages:

    • jupyterlab 0.35.5
    • panel 0.5.1
    • python 3.7.2
    • matplotlib 3.0.3

    I naively copied the sine example on the introduction page into a jupyter notebook. The mpl plot appeared however manipulating the widgets produced no outcome:

    import numpy as np, pandas as pd, matplotlib.pyplot as plt
    %matplotlib inline
    
    def mplplot(df, **kwargs):
        fig = df.plot().get_figure()
        plt.close(fig)
        return fig
    
    def sine(frequency=1.0, amplitude=1.0, n=200, view_fn=mplplot):
        xs = np.arange(n)/n*20.0
        ys = amplitude*np.sin(frequency*xs)
        df = pd.DataFrame(dict(y=ys), index=xs)
        return view_fn(df, frequency=frequency, amplitude=amplitude, n=n)
    
    sine(1.5, 2.5)
    
    import panel as pn
    pn.extension()
    
    pn.interact(sine)
    
  • Added FileSelector widget

    Added FileSelector widget

    Adds a FileSelector widget that looks like this and allows browsing files on the server. It only allows browsing files in the specified directory so you cannot access restricted files. The UI isn't perfect since actions like a double click on a directory are not allowed so selecting a directory will update the path in the top bar and unlock the "Enter" button. Clicking that button will actually navigate to that directory. Selections are performed just like the CrossSelector widget. Also has additional buttons to go "home" (i.e. the initially specified directory), back and forth through the history and lastly to go up a directory.

    Screen Shot 2019-12-27 at 4 07 19 PM

    • [x] Fixes https://github.com/holoviz/panel/issues/430
    • [x] Add tests
    • [x] Add reference notebook
    • [ ] Add thumbnail

    @jbednar @jlstevens Would be great if you could try this out and report back on UI changes you think would help.

  • Windows does not display widget

    Windows does not display widget

    Not sure if this is a bug or an env issue. But I am not getting any output in IE:

    Screen Shot 2019-03-21 at 11 15 20 AM
    [IPKernelApp] ERROR | No such comm target registered: hv-extension-comm
    [IPKernelApp] WARNING | No such comm: hv-extension-comm
    [IPKernelApp] WARNING | No such comm: hv-extension-comm
    
    (intake-gui) C:\Users\IEUser>conda list
    # packages in environment at C:\Users\IEUser\Miniconda\envs\intake-gui:
    #
    # Name                    Version                   Build  Channel
    appdirs                   1.4.3                      py_1    conda-forge
    asn1crypto                0.24.0                py37_1003    conda-forge
    attrs                     19.1.0                     py_0    conda-forge
    backcall                  0.1.0                      py_0    conda-forge
    bleach                    3.1.0                      py_0    conda-forge
    bokeh                     1.1.0dev10                 py_0    bokeh/label/dev
    ca-certificates           2019.3.9             hecc5488_0    conda-forge
    certifi                   2019.3.9                 py37_0    conda-forge
    cffi                      1.12.2           py37hb32ad35_1    conda-forge
    chardet                   3.0.4                 py37_1003    conda-forge
    click                     7.0                        py_0    conda-forge
    cloudpickle               0.8.0                      py_0    conda-forge
    colorama                  0.4.1                      py_0    conda-forge
    cryptography              2.5              py37h74b6da3_1    conda-forge
    cycler                    0.10.0                     py_1    conda-forge
    cytoolz                   0.9.0.1         py37hfa6e2cd_1001    conda-forge
    dask                      1.1.4                      py_0    conda-forge
    dask-core                 1.1.4                      py_0    conda-forge
    decorator                 4.4.0                      py_0    conda-forge
    defusedxml                0.5.0                      py_1    conda-forge
    distributed               1.26.0                   py37_1    conda-forge
    entrypoints               0.3                   py37_1000    conda-forge
    freetype                  2.10.0               h5db478b_0    conda-forge
    futures-compat            1.0                       py3_0    conda-forge
    heapdict                  1.0.0                 py37_1000    conda-forge
    holoviews                 1.12.0a1                   py_0    pyviz/label/dev
    hvplot                    0.4.0                      py_0    pyviz/label/dev
    icu                       58.2                     vc14_0    conda-forge
    idna                      2.8                   py37_1000    conda-forge
    intake                    0.4.3+50.g403ad11           dev_0    <develop>
    intel-openmp              2019.1                      144
    ipykernel                 5.1.0           py37h39e3cac_1002    conda-forge
    ipython                   7.1.1           py37h39e3cac_1000    conda-forge
    ipython_genutils          0.2.0                      py_1    conda-forge
    ipywidgets                7.4.2                      py_0    conda-forge
    jedi                      0.13.3                   py37_0    conda-forge
    jinja2                    2.10                       py_1    conda-forge
    jpeg                      9c                hfa6e2cd_1001    conda-forge
    jsonschema                3.0.1                    py37_0    conda-forge
    jupyter                   1.0.0                      py_1    conda-forge
    jupyter_client            5.2.4                      py_3    conda-forge
    jupyter_console           6.0.0                      py_0    conda-forge
    jupyter_core              4.4.0                      py_0    conda-forge
    kiwisolver                1.0.1           py37he980bc4_1002    conda-forge
    libblas                   3.8.0                     4_mkl    conda-forge
    libcblas                  3.8.0                     4_mkl    conda-forge
    liblapack                 3.8.0                     4_mkl    conda-forge
    libpng                    1.6.36            h7602738_1000    conda-forge
    libsodium                 1.0.16            h2fa13f4_1001    conda-forge
    libtiff                   4.0.10            h36446d0_1001    conda-forge
    locket                    0.2.0                      py_2    conda-forge
    m2w64-gcc-libgfortran     5.3.0                         6
    m2w64-gcc-libs            5.3.0                         7
    m2w64-gcc-libs-core       5.3.0                         7
    m2w64-gmp                 6.1.0                         2
    m2w64-libwinpthread-git   5.0.0.4634.697f757               2
    markdown                  2.6.11                     py_0    conda-forge
    markupsafe                1.1.1            py37hfa6e2cd_0    conda-forge
    matplotlib                3.0.3                    py37_0    conda-forge
    matplotlib-base           3.0.3            py37h3e3dc42_0    conda-forge
    mistune                   0.8.4           py37hfa6e2cd_1000    conda-forge
    mkl                       2019.1                      144
    msgpack-numpy             0.4.4.2                    py_1    conda-forge
    msgpack-python            0.6.1            py37he980bc4_0    conda-forge
    msys2-conda-epoch         20160418                      1
    nbconvert                 5.4.1                      py_2    conda-forge
    nbformat                  4.4.0                      py_1    conda-forge
    notebook                  5.7.6                    py37_0    conda-forge
    numpy                     1.16.2           py37h8078771_1    conda-forge
    olefile                   0.46                       py_0    conda-forge
    openssl                   1.0.2r               hfa6e2cd_0    conda-forge
    packaging                 19.0                       py_0    conda-forge
    pandas                    0.24.2           py37h6538335_0    conda-forge
    pandoc                    2.7.1                         0    conda-forge
    pandocfilters             1.4.2                      py_1    conda-forge
    panel                     0.5.0a4                    py_0    pyviz/label/dev
    param                     1.9.0a4                    py_0    pyviz/label/dev
    parso                     0.3.4                      py_0    conda-forge
    partd                     0.3.9                      py_0    conda-forge
    pickleshare               0.7.5                 py37_1000    conda-forge
    pillow                    5.4.1           py37h9a613e6_1000    conda-forge
    pip                       19.0.3                   py37_0    conda-forge
    prometheus_client         0.6.0                      py_0    conda-forge
    prompt_toolkit            2.0.9                      py_0    conda-forge
    psutil                    5.6.1            py37hfa6e2cd_0    conda-forge
    pycparser                 2.19                     py37_1    conda-forge
    pyct                      0.4.6                      py_0    conda-forge
    pyct-core                 0.4.6                      py_0    conda-forge
    pygments                  2.3.1                      py_0    conda-forge
    pyopenssl                 19.0.0                   py37_0    conda-forge
    pyparsing                 2.3.1                      py_0    conda-forge
    pyqt                      5.6.0           py37h764d66f_1008    conda-forge
    pyrsistent                0.14.11          py37hfa6e2cd_0    conda-forge
    pysocks                   1.6.8                 py37_1002    conda-forge
    python                    3.7.1             h9460c21_1003    conda-forge
    python-dateutil           2.8.0                      py_0    conda-forge
    python-snappy             0.5.4            py37hd25c944_0    conda-forge
    pytz                      2018.9                     py_0    conda-forge
    pyviz_comms               0.7.1                      py_0    conda-forge
    pywinpty                  0.5.5                 py37_1000    conda-forge
    pyyaml                    5.1              py37hfa6e2cd_0    conda-forge
    pyzmq                     18.0.1           py37he418aac_0    conda-forge
    qt                        5.6.2                h2639256_8    conda-forge
    qtconsole                 4.4.3                      py_0    conda-forge
    requests                  2.21.0                py37_1000    conda-forge
    ruamel                    1.0                      py37_0    conda-forge
    ruamel.yaml               0.15.89          py37hfa6e2cd_1    conda-forge
    send2trash                1.5.0                      py_0    conda-forge
    setuptools                40.8.0                   py37_0    conda-forge
    sip                       4.18.1          py37h6538335_1000    conda-forge
    six                       1.12.0                py37_1000    conda-forge
    snappy                    1.1.7             h6538335_1002    conda-forge
    sortedcontainers          2.1.0                      py_0    conda-forge
    sqlite                    3.26.0            hfa6e2cd_1001    conda-forge
    tblib                     1.3.2                      py_1    conda-forge
    terminado                 0.8.1                 py37_1001    conda-forge
    testpath                  0.3.1                    py37_1    conda-forge
    tk                        8.6.9             hfa6e2cd_1000    conda-forge
    toolz                     0.9.0                      py_1    conda-forge
    tornado                   5.1.1           py37hfa6e2cd_1000    conda-forge
    traitlets                 4.3.2                 py37_1000    conda-forge
    urllib3                   1.24.1                py37_1000    conda-forge
    vc                        14                            0    conda-forge
    vs2015_runtime            14.0.25420                    0    conda-forge
    wcwidth                   0.1.7                      py_1    conda-forge
    webencodings              0.5.1                      py_1    conda-forge
    wheel                     0.33.1                   py37_0    conda-forge
    widgetsnbextension        3.4.2                 py37_1000    conda-forge
    win_inet_pton             1.1.0                    py37_0    conda-forge
    wincertstore              0.2                   py37_1002    conda-forge
    winpty                    0.4.3                         4    conda-forge
    yaml                      0.1.7             hfa6e2cd_1001    conda-forge
    zeromq                    4.2.5             he025d50_1006    conda-forge
    zict                      0.1.4                      py_0    conda-forge
    zlib                      1.2.11            h2fa13f4_1004    conda-forge
    
  • Param classes defined in external file and inheritance

    Param classes defined in external file and inheritance

    I have a use case for panel that's difficult to describe without a demo so I'm attaching two files. The notebook walks through my issue.

    user_guide.zip

    I'd be interested to hear any thoughts on how I can improve this approach.

  • Add String pane to support any representable object

    Add String pane to support any representable object

    @jlstevens suggested we add support for a string-based representation for any Python object as a Pane. About 20 minutes after his suggestion, I already realized that I needed that, so here it is.

    Adding the Repr class is the only change; the other diffs are just to reorganize the other classes to be in a more readable order.

    Questions:

    • [x] What range are the priority values meant to have? I chose 10 for this one to be higher than HTML's current value of 1 and as an indication that this class is really a last resort, but we could instead keep them all in [0.0,1.0] as is typical for Parameter precedences. Up to @philippjfr.
    • [ ] Should we have an (optional?) character limit on the representation, to be useful for objects whose representation might be many pages of text?
    • [x] Should we escape the values in some way, or let HTML be interpreted as HTML if there is any HTML in the representation?
  • MaterialTemplate, BootstrapTemplate, GoldenTemplate not working - GET 404 when requesting bundled assets

    MaterialTemplate, BootstrapTemplate, GoldenTemplate not working - GET 404 when requesting bundled assets

    I have installed the latest version of the Panel Master Branch and reinstalled my conda environment following the developer guide. I get an error during the installation https://github.com/holoviz/panel/issues/1652. But I believe Panel, Bokeh etc. is still installed and I can run what I need. I have also successfully run panel build panel.

    If I replace VanillaTemplate with MaterialTemplate in the file panel\tests\template\test_vanilla_manual.py I get

    image

    $ python -m panel serve 'panel\tests\template\test_vanilla_manual.py' --dev
    2020-10-20 08:30:40,156 Starting Bokeh server version 2.2.2 (running on Tornado 6.0.4)
    2020-10-20 08:30:40,158 User authentication hooks NOT provided (default user enabled)
    2020-10-20 08:30:40,161 Bokeh app running at: http://localhost:5006/test_vanilla_manual
    2020-10-20 08:30:40,161 Starting Bokeh server with process id: 26420
    2020-10-20 08:30:55,676 W-1005 (FIXED_SIZING_MODE): 'fixed' sizing mode requires width and height to be set: Button(id='1340', ...)
    2020-10-20 08:30:55,676 W-1005 (FIXED_SIZING_MODE): 'fixed' sizing mode requires width and height to be set: Button(id='1342', ...)
    2020-10-20 08:30:55,677 W-1005 (FIXED_SIZING_MODE): 'fixed' sizing mode requires width and height to be set: Button(id='1344', ...)
    2020-10-20 08:30:55,782 404 GET /static/extensions/panel/bundled/materialtemplate/material.css (::1) 1.96ms
    2020-10-20 08:30:55,784 404 GET /static/extensions/panel/bundled/materialtemplate/[email protected]/dist/material-components-web.min.css (::1) 2.04ms
    2020-10-20 08:30:55,784 404 GET /static/extensions/panel/bundled/materialtemplate/[email protected]/dist/material-components-web.min.js (::1) 2.04ms
    2020-10-20 08:30:56,006 404 GET /static/extensions/panel/bundled/materialtemplate/default.css (::1) 223.31ms
    2020-10-20 08:30:56,106 WebSocket connection opened
    2020-10-20 08:30:56,107 ServerConnection created
    2020-10-20 08:36:30,527 W-1005 (FIXED_SIZING_MODE): 'fixed' sizing mode requires width and height to be set: Button(id='2185', ...)
    2020-10-20 08:36:30,528 W-1005 (FIXED_SIZING_MODE): 'fixed' sizing mode requires width and height to be set: Button(id='2187', ...)
    2020-10-20 08:36:30,528 W-1005 (FIXED_SIZING_MODE): 'fixed' sizing mode requires width and height to be set: Button(id='2189', ...)
    2020-10-20 08:36:30,559 404 GET /static/extensions/panel/bundled/materialtemplate/material.css (::1) 1.00ms
    2020-10-20 08:36:30,561 404 GET /static/extensions/panel/bundled/materialtemplate/default.css (::1) 1.00ms
    2020-10-20 08:36:30,563 404 GET /static/extensions/panel/bundled/materialtemplate/[email protected]/dist/material-components-web.min.css (::1) 1.00ms
    2020-10-20 08:36:30,566 404 GET /static/extensions/panel/bundled/materialtemplate/[email protected]/dist/material-components-web.min.js (::1) 1.00ms
    2020-10-20 08:36:30,758 WebSocket connection opened
    2020-10-20 08:36:30,758 ServerConnection created
    
  • nbconvert pn.pane.ipywidget.IPyLeaflet missing html output

    nbconvert pn.pane.ipywidget.IPyLeaflet missing html output

    for a custom plotting class with the following method:

         def _ipython_display_(self):
             pn.extension(sizing_mode='stretch_width')
             display(pn.pane.ipywidget.IPyLeaflet(self._map))
    

    where self._map is a ipyleaflet.Map instance, everything look fine in jupyter-lab, but when using nbconvert --to html, it results in missing output and the following warning:

    /nbconvert/filters/widgetsdatatypefilter.py:72: UserWarning: Your element with mimetype(s) dict_keys([]) is not able to be represented.
    

    this seems to be a panel bug somewhere, as the following does seem to work fine:

         def _ipython_display_(self):
            display(self._map)
    

    interestingly, for another custom plotting class the following method does result in output, though after given the same warning.

        def _ipython_display_(self):
            pn.extension(sizing_mode='stretch_width')
            display(pn.pane.VTK(self._renderwindow, width=self.size[0], height=self.size[1]))
    
  • Toggle / button icons

    Toggle / button icons

    Is it possible to have icons that act like pn.widgets.Toggle or pn.widgets.Button, but rather than a clunky checkbox or a button, it can simply be an icon (https://fonts.google.com/icons?selected=Material+Icons)

  • Cannot load static assets when panel convert pyiodide

    Cannot load static assets when panel convert pyiodide

    from PIL import Image
    
    import panel as pn
    
    def expand2square(pil_img, background_color):
        width, height = pil_img.size
        if width == height:
            return pil_img
        elif width > height:
            result = Image.new(pil_img.mode, (width, width), background_color)
            result.paste(pil_img, (0, (width - height) // 2))
            return result
        else:
            result = Image.new(pil_img.mode, (height, height), background_color)
            result.paste(pil_img, ((height - width) // 2, 0))
            return result
    
    img_in = Image.open("nintendo-7794.png")
    img_out = expand2square(img_in, background_color="black")
    
    png = pn.pane.PNG(img_out, sizing_mode="scale_both", max_width=100)
    png.servable()
    

    panel convert test.py --requirements pillow --to pyodide-worker --out test

    FileNotFoundError: [Errno 44] No such file or directory: 'nintendo-7794.png' even though panel serve test.py works; I also included the static file in the output directory test/

  • AzureV2 authentication does not successfully save access_token as a secure cookie when encryption is enabled

    AzureV2 authentication does not successfully save access_token as a secure cookie when encryption is enabled

    ALL software version info

    panel == 0.14.1 python == 3.9.13 bokeh == 2.4.3

    Description of expected behavior and the observed behavior

    If I set up oauth using the AzureV2 provider and enable encryption, setting the access_token cookie fails as the token size is larger than the 4096 bytes max limit. The access_token I get back from azure is ~2,200 bytes. After encrypting it, it becomes ~3,100 and then after tornado is done signing and b64 encoding it, it jumps to ~4,300 bytes. At this point, it just silently fails to set the cookie, and future calls to pn.state.access_token return None as they should.

    This is a non-issue when using the Azure (V1) provider and is also a non-issue on either if you disable encryption.

    Complete, minimal, self-contained example code that reproduces the issue

    panel_app.py

    import panel as pn
    print(pn.state.access_token)
    

    run using all the appropriate panel cli args to enable authentication.

    Screenshots or screencasts of the bug in action

    image

    Proposed solution

    I tried to look up any documentation about expected max length for the access_token and couldn't find anything helpful, and a couple of links suggesting that there is no max length. My current workaround is to break up the token into it's header/paylod/signature and encrypt and store each separately. The modifications are--

    Add a specific _on_auth() to the AzureAdV2LoginHandler class

        def _on_auth(self, id_token, access_token):
            decoded = decode_id_token(id_token)
            user_key = config.oauth_jwt_user or self._USER_KEY
            if user_key in decoded:
                user = decoded[user_key]
            else:
                log.error("%s token payload did not contain expected %r.",
                          type(self).__name__, user_key)
                raise HTTPError(400, "OAuth token payload missing user information")
            self.set_secure_cookie('user', user, expires_days=config.oauth_expiry)
            if state.encryption:
                header,payload,sig = access_token.split('.')
                header = state.encryption.encrypt(header.encode('utf-8'))
                payload = state.encryption.encrypt(payload.encode('utf-8'))
                sig = state.encryption.encrypt(sig.encode('utf-8'))
                
                self.set_secure_cookie('access_token_header', header, expires_days=config.oauth_expiry)
                self.set_secure_cookie('access_token_payload', payload, expires_days=config.oauth_expiry)
                self.set_secure_cookie('access_token_sig', sig, expires_days=config.oauth_expiry)
    
                id_token = state.encryption.encrypt(id_token.encode('utf-8'))
                self.set_secure_cookie('id_token', id_token, expires_days=config.oauth_expiry)
                return user
    
            
            self.set_secure_cookie('access_token', access_token, expires_days=config.oauth_expiry)
            self.set_secure_cookie('id_token', id_token, expires_days=config.oauth_expiry)
            return user
    

    and modify the access_token property in _state to--

       @property
        def access_token(self) -> str | None:
            from ..config import config
            from tornado.web import decode_signed_value
    
            access_token = self.cookies.get('access_token')
            access_token_header = self.cookies.get('access_token_header')
            access_token_payload = self.cookies.get('access_token_payload')
            access_token_sig = self.cookies.get('access_token_sig')
            if (access_token is None and access_token_header is None):
                return None
    
            if access_token_header is not None:
                access_token_header = decode_signed_value(config.cookie_secret, 'access_token_header', access_token_header)
                access_token_payload = decode_signed_value(config.cookie_secret, 'access_token_payload', access_token_payload)
                access_token_sig = decode_signed_value(config.cookie_secret, 'access_token_sig', access_token_sig)
                access_token_header = self.encryption.decrypt(access_token_header).decode('utf-8')
                access_token_payload = self.encryption.decrypt(access_token_payload).decode('utf-8')
                access_token_sig = self.encryption.decrypt(access_token_sig).decode('utf-8')
                return access_token_header + '.' + access_token_payload + '.' + access_token_sig
    
            access_token = decode_signed_value(config.cookie_secret, 'access_token', access_token)
            if self.encryption is None:
                return access_token.decode('utf-8')
            return self.encryption.decrypt(access_token).decode('utf-8')
    

    code seems fairly clunky, so lmk if anyone has any suggestions on making it more concise, or if there is any other way that you can think of getting around this. Happy to submit a PR if you're good with the mods above.

    Thanks!

  • Matplotlib pane seems to not care about dpi with Matplotlib 3.6.2

    Matplotlib pane seems to not care about dpi with Matplotlib 3.6.2

    ALL software version info

    • panel: 0.14.1
    • matplotlib: 3.6.2
    • notebook: 6.5.2

    Description of expected behavior and the observed behavior

    Recently I have upgraded from Matplotlib 3.5.3 to 3.6.2 and I've noticed a weird behavior when using Matplotlib pane: it doesn't seem to apply dpi anymore.

    This is a screenshot produced with the code below and Matplotlib 3.5.3: note that everything is crisp. If I open the picture on a new browser window I can see it has this size: 1280x960

    Screenshot 2022-11-29 at 09-03-56 Untitled22 - Jupyter Notebook

    This is a screenshot produced with the same code and Matplotlib 3.6.2: the picture is blurry. The actual picture size is 640x480.

    Screenshot 2022-11-29 at 09-00-58 Untitled22 - Jupyter Notebook

    Complete, minimal, self-contained example code that reproduces the issue

    import numpy as np
    import matplotlib
    from matplotlib.figure import Figure
    from matplotlib import cm
    import panel as pn
    pn.extension()
    
    print(matplotlib.__version__)
    # 3.6.2
    print(pn.__version__)
    # 0.14.1
    
    Y, X = np.mgrid[-3:3:100j, -3:3:100j]
    U = -1 - X**2 + Y
    V = 1 + X - Y**2
    speed = np.sqrt(U*U + V*V)
    
    fig0 = Figure()
    ax0 = fig0.subplots()
    strm = ax0.streamplot(X, Y, U, V, color=U, linewidth=2, cmap=cm.autumn)
    fig0.colorbar(strm.lines)
    
    mpl_pane = pn.pane.Matplotlib(fig0, width=1200, dpi=200)
    mpl_pane
    

    Stack traceback and/or browser JavaScript console output

    Screenshots or screencasts of the bug in action

A Django app that creates automatic web UIs for Python scripts.
A Django app that creates automatic web UIs for Python scripts.

Wooey is a simple web interface to run command line Python scripts. Think of it as an easy way to get your scripts up on the web for routine data anal

Nov 29, 2022
Django app that enables staff to log in as other users using their own credentials.
Django app that enables staff to log in as other users using their own credentials.

Impostor Impostor is a Django application which allows staff members to login as a different user by using their own username and password. Login Logg

Nov 26, 2022
A Django app for easily adding object tools in the Django admin

Django Object Actions If you've ever tried making admin object tools you may have thought, "why can't this be as easy as making Django Admin Actions?"

Nov 28, 2022
Freqtrade is a free and open source crypto trading bot written in Python
Freqtrade is a free and open source crypto trading bot written in Python

Freqtrade is a free and open source crypto trading bot written in Python. It is designed to support all major exchanges and be controlled via Telegram. It contains backtesting, plotting and money management tools as well as strategy optimization by machine learning.

Nov 30, 2022
PyMMO is a Python-based MMO game framework using sockets and PyGame.
PyMMO is a Python-based MMO game framework using sockets and PyGame.

PyMMO is a Python framework/template of a MMO game built using PyGame on top of Python's built-in socket module.

Nov 27, 2022
Django application and library for importing and exporting data with admin integration.
Django application and library for importing and exporting data with admin integration.

django-import-export django-import-export is a Django application and library for importing and exporting data with included admin integration. Featur

Dec 5, 2022
Collection of admin fields and decorators to help to create computed or custom fields more friendly and easy way
Collection of admin fields and decorators to help to create computed or custom fields more friendly and easy way

django-admin-easy Collection of admin fields, decorators and mixin to help to create computed or custom fields more friendly and easy way Installation

Oct 11, 2022
BitcartCC is a platform for merchants, users and developers which offers easy setup and use.
BitcartCC is a platform for merchants, users and developers which offers easy setup and use.

BitcartCC is a platform for merchants, users and developers which offers easy setup and use.

Dec 4, 2022
Python books free to read online or download
Python books free to read online or download

Python books free to read online or download

Nov 27, 2022
Python code for "Machine learning: a probabilistic perspective" (2nd edition)
Python code for

Python code for "Machine learning: a probabilistic perspective" (2nd edition)

Nov 30, 2022
A python application for manipulating pandas data frames from the comfort of your web browser
A python application for manipulating pandas data frames from the comfort of your web browser

A python application for manipulating pandas data frames from the comfort of your web browser. Data flows are represented as a Directed Acyclic Graph, and nodes can be ran individually as the user sees fit.

Oct 27, 2022
A modern Python package manager with PEP 582 support.
A modern Python package manager with PEP 582 support.

A modern Python package manager with PEP 582 support.

Dec 4, 2022
Python Crypto Bot

Python Crypto Bot

Nov 28, 2022
Ajenti Core and stock plugins
Ajenti Core and stock plugins

Ajenti is a Linux & BSD modular server admin panel. Ajenti 2 provides a new interface and a better architecture, developed with Python3 and AngularJS.

Dec 5, 2022
Simple and extensible administrative interface framework for Flask

Flask-Admin The project was recently moved into its own organization. Please update your references to [email protected]:flask-admin/flask-admin.git. Int

Nov 30, 2022
Real-time monitor and web admin for Celery distributed task queue

Flower Flower is a web based tool for monitoring and administrating Celery clusters. Features Real-time monitoring using Celery Events Task progress a

Dec 5, 2022
Simple and extensible administrative interface framework for Flask

Flask-Admin The project was recently moved into its own organization. Please update your references to [email protected]:flask-admin/flask-admin.git. Int

Feb 7, 2021
FastAPI Admin Dashboard based on FastAPI and Tortoise ORM.
FastAPI Admin Dashboard based on FastAPI and Tortoise ORM.

FastAPI ADMIN 中文文档 Introduction FastAPI-Admin is a admin dashboard based on fastapi and tortoise-orm. FastAPI-Admin provide crud feature out-of-the-bo

Nov 30, 2022
Nginx UI allows you to access and modify the nginx configurations files without cli.
Nginx UI allows you to access and modify the nginx configurations files without cli.

nginx ui Table of Contents nginx ui Introduction Setup Example Docker UI Authentication Configure the auth file Configure nginx Introduction We use ng

Nov 30, 2022