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_run2023-11-15 06:02
parentz14KWQKD4bwE jhvyoIrxoeSz
pypackagenbproject==0.9.2 pandas==2.1.3


  • 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: