Publish a notebook

Publishing a notebook is only possible for certification practical exams and competitions.

Publish a notebook

To publish a notebook:

  1. Open your workbook.

  2. Click the Publish button in the left-hand sidebar.

  3. Select the notebook file you want to publish.

  4. Click Publish.

There are two publishing 'modes':

  • By default, your notebook will be run from top to bottom before publishing. This ensures full reproducibility, i.e. all cells run without error and the outputs are the result of executing the notebook in order.

  • If you're not worried about reproducibility (you just want to fix some typos or styles, for example), you can switch the "run notebook from top to bottom" toggle off before clicking Publish. A snapshot of your current notebook is taken and turned into a publication quasi-instantly.

Viewing your published notebook

If publishing was successful, your published notebook will become available through a unique link that you can visit by clicking "Open live publication" (shown above). This is also how others will see your published notebook.

Who can see my published notebook?

To determine who can view your publication, the permissions on your workbook are followed.

  • If your workbook is private to you and shared with no-one, only you can see this published notebook.

  • If your workbook is only shared with specific people, only those people will be able to view your published notebook.

  • If your group workbook is shared with an entire group, only the members in that group will be able to view the published notebook.

  • If your workbook is public, your published notebook can be viewed by anyone.

Hiding cells in a published notebook

When you publish, by default all the cells of your notebook will be included. If you would like to hide certain cells (such as package installs or pieces of code that are not relevant to your readers), you can follow the steps in Hiding and showing cells.

Resolving errors

If an error was encountered in your code while rerunning your notebook, publishing will fail. In the Publishing pane, you can click View errors to see exactly what went wrong so you can correct your notebook and try again.

Special care is needed when both of the below are true:

  • Your notebook uses additional packages on top of the packages that are available in DataLab by default.

  • You're publishing with the 'Run notebook from top to bottom' option enabled.

In this case, you should make sure to install these additional packages at the top of your notebook.

This is necessary because publishing happens in a brand-new session, that no longer has your additional packages available. If you do the installs at the top of the notebook, these installs happen again as the first step, after which the rest of the notebook is executed.

Read Working with packagesto learn more about how to install and use additional packages in your notebook.

One publication per workbook

For every workbook, you can only create a single publication. It is currently not possible to publish two notebooks from the same workbook. If you have more than one notebook in your workbook, you'll be able to select which notebook you want to publish.

Updating a published workbook

If you made changes to your notebook after publishing, these changes are not automatically reflected in the published notebook. For the changes to ripple through to your publication, open up the publish pane again and hit the "Update" button. The published notebook URL as well as its sharing settings are preserved.

Last updated