> ## Documentation Index
> Fetch the complete documentation index at: https://docs.expectedparrot.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Notebooks and scripts

> Share a notebook or script as supporting material for a study.

A `Notebook` wraps an `.ipynb` file or Python script so it can be stored and shared through Expected Parrot. Reading or uploading a notebook does not execute its cells or verify its findings. Save the study objects and completed data separately with [Saving objects](https://docs.expectedparrot.com/en/latest/guides/saving_objects.md).

## Read a saved file

```python theme={null}
from edsl import Notebook

notebook = Notebook(path="study.ipynb")
```

Replace the path with a saved file. For a Python script, use `Notebook.from_script("study.py")`. For Colab, first [download the notebook](https://docs.expectedparrot.com/en/latest/colab_notebooks.md).

For an object constructed from a notebook path, `notebook.reload()` rereads the saved file after edits. `notebook.has_outputs()` reports whether any code cells contain outputs. `Notebook.from_current_script()` wraps the currently executing Python script; use it from a script file rather than a notebook cell.

To construct an object directly from notebook-format data:

```python theme={null}
from edsl import Notebook

notebook = Notebook(data={
    "nbformat": 4,
    "nbformat_minor": 4,
    "metadata": {},
    "cells": [{
        "cell_type": "markdown",
        "metadata": {},
        "source": "# Study notes",
    }],
})
```

The example above contains only a Markdown cell and requires no credentials. Construction may format Python code when linting is enabled; inspect the resulting notebook before sharing.

## Upload and retrieve

Review code, outputs, and embedded data before uploading. With Expected Parrot authentication configured:

```python theme={null}
info = notebook.push(
    description="Supporting notebook for the study",
    visibility="private",
)
notebook_uuid = info["uuid"]
```

Use the returned identifier to retrieve that object, subject to its access permissions:

```python theme={null}
downloaded = Notebook.pull(notebook_uuid)
downloaded.to_file("downloaded-study.ipynb")
```

These operations contact Expected Parrot; `to_file()` writes the downloaded notebook locally. For sharing permissions and metadata updates, use [Expected Parrot objects](https://docs.expectedparrot.com/en/latest/coop.md) and the [CLI Guide](https://docs.expectedparrot.com/en/latest/cli.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.