1. header() provides relevant context.

  2. publish() prepares a notebook for sharing it with someone else.

from nbproject import header, publish, meta

header(parent=["z14KWQKD4bwE", "jhvyoIrxoeSz"])  # Initializes & displays metadata.
time_init2022-07-18 12:32
time_run2024-05-20 09:45
parentz14KWQKD4bwE jhvyoIrxoeSz
pypackagenbproject==0.10.3 pandas==2.2.2


  • Passing parent to header() is optional. You can use it to point viewers to upstream notebooks or to build pipelines.

  • You can also pass pypackage to header() to track secondary dependencies.

import pandas  # Any imported package is automatically tracked.

Once you’re happy with the present version of your notebook:

publish()  # Sets version, checks consecutiveness & title, writes current pypackages with versions.
✅ cell execution numbers increase consecutively
💡 Set notebook version to 0 & wrote pypackages.


If you’re a developer and want to build on top of nbproject, the API offers: