Publish a notebook
Last updated
Last updated
Publishing a notebook is only possible for certification practical exams and competitions.
To publish a notebook:
Open your workbook.
Click the Publish button in the left-hand sidebar.
Select the notebook file you want to publish.
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.
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.
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.
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.
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.
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.
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.