====================
Publishing notebooks
====================

This topic provides guidance on previewing and publishing your Panel apps as working applications with a custom URL. This spins up an application on the Anaconda Notebooks infrastructure, which you can then share with others.

Previewing Panel apps
=====================

You can render a working preview of the Panel apps in your notebook by clicking the Panel |panel| icon at the top of your notebook. To create a valid Panel application, one or more of your outputs must be marked as ``.servable()``. See Troubleshooting below for further details.

.. note::

    Rendering a preview of Panel apps uses CPU seconds. 

Publishing Panel apps 
=====================

To publish the results of your Panel apps to a custom URL, complete the following steps:

#. Click the publish |publish| icon at the top of the notebook. The publication panel opens on the right.

    .. thumbnail:: /img/notebook_save_publish.png
       :align: center

#. Provide a title and detailed description.

    .. note::
        Your notebook's version is displayed within the form and automatically increments each time you save changes to or redeploy your notebook.

#. Optional: Click **Save** to produce an inactive (i.e. unpublished) app. To see your unpublished and published apps, click the publish |publish| icon in the left-hand navigation to open the **Apps** panel.
#. Click **Publish**. You are provided a randomly generated URL for your application, which can be shared with others. 

    .. note::
    
        The page will appear as a 502 Bad Gateway until the publication process is complete.

#. Click the publish |publish| icon in the left-hand navigation to open the **Apps** panel. Your application is now listed under **Active**.
#. View, unpublish, download, and more by clicking the actions |action| icon beside your app in the **Apps** panel.

    .. thumbnail:: /img/notebook_app_actions.png
       :align: center

Publishing limits
-----------------

The number of applications you can publish depends on your Anaconda subscription tier.

.. csv-table::
    :file: notebook-apps-capabilities.csv
    :widths: 40, 15, 15, 15, 15
    :header-rows: 1

.. note::
    \* Pro is a legacy tier no longer available for purchase.

Further Panel resources
=======================

Anaconda Notebooks allows you to deploy your data applications via Panel with just two clicks directly from your notebooks. Check out the following resources for a deeper dive into Panel:

* Familiarize yourself with Panel with the `getting started guide <https://panel.holoviz.org/getting_started/build_app.html>`_
* Discover how to use specific features in the `how-to guide <https://panel.holoviz.org/how_to/index.html>`_
* Learn about the different components and how to use them with the `component gallery <https://panel.holoviz.org/reference/index.html>`_
* Gain inspiration from the `app gallery <https://panel.holoviz.org/gallery/index.html>`_ 

Troubleshooting
===============

I published a Panel application, but the application is blank.
--------------------------------------------------------------

There are a couple of reasons your application may not be rendering:

#. To create a valid Panel application, one or more of your outputs must be marked as ``.servable()``. Take this minimal "Hello, World!" program, for example:

   .. code-block:: python

      import panel as pn
      pn.Row("Hello, World!").servable()

   If you added content to your application but there’s still nothing showing up, ensure that your notebook can be run from top to bottom. The easiest way to test this is to click **Kernel** in the menu bar, then select **Restart Kernel and Run All Cells..** from the dropdown.

#. Ensure you have selected the ``anaconda-panel-2023.05-py310`` kernel from the kernel selector in the top-right of your notebook.

   .. thumbnail:: /img/kernel_select.png
      :align: center

I published an application but it's stuck in a "publishing" state.
------------------------------------------------------------------

If your application is stuck in the "Your app is being published" state, check your notebook error logs. Address any issues raised and republish.

.. |publish| raw:: html

        <svg class="inline" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
    <g clip-path="url(#clip0_5939_137233)">
    <path d="M15.9212 0.381238C15.8859 0.165128 15.7192 0.0584452 15.4552 0.03805C14.7512 -0.0164678 14.0496 -0.0219588 13.3483 0.0862924C12.5513 0.209448 11.7818 0.423989 11.0381 0.73227C10.0384 1.14645 9.12451 1.70496 8.28047 2.38036C8.23183 2.41918 8.15378 2.4537 8.09691 2.44468C7.72392 2.38506 7.35406 2.3078 6.98145 2.24583C6.15427 2.10816 5.37612 2.25014 4.68739 2.73217C4.38186 2.94593 4.11986 3.22519 3.8508 3.48758C3.18482 4.13708 1.97562 5.33726 1.86384 5.44708L1.04646 6.37663C0.894284 6.55626 0.980179 6.81473 1.2512 6.86298L2.61924 7.0179C3.25659 7.07673 3.89433 7.13086 4.53207 7.18891C4.57404 7.19283 4.61483 7.21205 4.65837 7.22499C4.52697 7.57328 4.40186 7.90391 4.27753 8.23533C4.20614 8.42556 4.25399 8.5848 4.39754 8.72599C4.667 8.99074 4.93174 9.2598 5.19923 9.5265C5.90208 10.2286 6.60454 10.9306 7.30895 11.6311C7.42466 11.7464 7.56585 11.7853 7.7247 11.7307C7.81805 11.699 7.911 11.6649 8.00356 11.6299C8.26203 11.5319 8.52011 11.4331 8.79152 11.3295C8.80054 11.3942 8.80878 11.4389 8.8131 11.484C8.91115 12.5211 9.0092 13.5585 9.10647 14.5955C9.12294 14.7704 9.19119 14.9089 9.36298 14.9771C9.54183 15.0481 9.69636 14.9979 9.82619 14.8685L13.2114 11.4225C13.302 11.2738 13.3993 11.1385 13.4718 10.991C13.7507 10.4243 13.8703 9.82459 13.7821 9.19587C13.7232 8.77581 13.6338 8.36045 13.5695 7.94117C13.5581 7.86665 13.5828 7.76938 13.626 7.70702C13.8707 7.35364 14.1413 7.0179 14.3747 6.65785C14.9697 5.74046 15.4152 4.75168 15.6961 3.69427C15.8816 2.99574 15.9977 2.28387 15.9969 1.55749L16.0004 1.1994C15.9757 0.926416 15.9655 0.650689 15.9216 0.380846L15.9212 0.381238ZM14.4504 4.77953C13.8068 6.25936 12.8549 7.51013 11.6445 8.57185C11.097 9.05192 10.5067 9.47042 9.88423 9.84538C9.82462 9.88107 9.76304 9.91323 9.65949 9.97049C9.40102 9.69908 9.14256 9.41786 8.8735 9.14684C7.97376 8.24161 7.07245 7.33795 6.16565 6.43978C6.06367 6.33858 6.05387 6.26759 6.12525 6.14758C6.91125 4.83013 7.89767 3.69231 9.12491 2.76629C9.83403 2.23171 10.6016 1.80341 11.4174 1.45591C11.5849 1.38452 11.6888 1.39903 11.8226 1.53513C12.6399 2.36702 13.4663 3.18989 14.2951 4.0104C14.6355 4.3477 14.6406 4.34104 14.45 4.77914L14.4504 4.77953Z"/>
    <path d="M10.5989 3.94998C9.79207 3.94802 9.15198 4.5885 9.15198 5.39803C9.15198 6.21855 9.77442 6.84531 10.5898 6.84609C11.4017 6.84727 12.0402 6.21619 12.0465 5.40627C12.0524 4.61125 11.3974 3.95194 10.5989 3.94958V3.94998Z"/>
    <path d="M0.652285 15.316C0.509911 15.316 0.367929 15.2583 0.264385 15.145C0.0690617 14.9308 0.0839658 14.5986 0.298507 14.4033L4.3646 10.6933C4.57874 10.498 4.91095 10.5133 5.10627 10.7274C5.3016 10.9416 5.28669 11.2738 5.07215 11.4691L1.00606 15.1787C0.905263 15.2705 0.778578 15.316 0.652285 15.316Z"/>
    <path d="M3.67279 15.4646C3.53042 15.4646 3.38844 15.407 3.28489 15.2936C3.08957 15.0795 3.10447 14.7473 3.31902 14.5519L4.93965 13.0733C5.15379 12.878 5.486 12.8933 5.68132 13.1074C5.87665 13.3216 5.86174 13.6538 5.6472 13.8491L4.02657 15.3277C3.92577 15.4195 3.79909 15.465 3.67279 15.465V15.4646Z"/>
    <path d="M0.525087 12.7846C0.382714 12.7846 0.240732 12.727 0.137187 12.6136C-0.0581356 12.3995 -0.0432314 12.0673 0.17131 11.872L1.79194 10.3933C2.00609 10.198 2.3379 10.2133 2.53362 10.4274C2.72894 10.6416 2.71404 10.9738 2.4995 11.1691L0.878865 12.6478C0.778066 12.7395 0.651381 12.785 0.525087 12.785V12.7846Z"/>
    </g>
    <defs>
    <clipPath id="clip0_5939_137233">
    <rect width="16" height="15.4646"/>
    </clipPath>
    </defs>
    </svg>

.. |action| raw:: html

        <svg width="1em" height="1em" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
    <path d="M7.5 4C8.325 4 9 3.325 9 2.5C9 1.675 8.325 1 7.5 1C6.675 1 6 1.675 6 2.5C6 3.325 6.675 4 7.5 4Z"/>
    <path d="M7.5 6C6.675 6 6 6.675 6 7.5C6 8.325 6.675 9 7.5 9C8.325 9 9 8.325 9 7.5C9 6.675 8.325 6 7.5 6Z"/>
    <path d="M7.5 11C6.675 11 6 11.675 6 12.5C6 13.325 6.675 14 7.5 14C8.325 14 9 13.325 9 12.5C9 11.675 8.325 11 7.5 11Z"/>
    </svg>

.. |panel| image:: /img/icon/icon_panel.svg
            :width: 25 px 
