Skip to main content

Special note for Colab users

If you are using EDSL in a Colab notebook, please see special instructions on posting Colab notebooks to Expected Parrot (Colab Notebooks).

Creating a Notebook object

There are three ways to create a Notebook object:

1. From a .ipynb file

Pass the path to your .ipynb file to the constructor:
Note:You first need to save your notebook in order to pass the path<filename> argument to the constructor.

2. From a .py script

Call the from_script() method on the constructor and pass it the path to your .py script:

3. From data

For this method, your data must be a Python dict that conforms to the official Jupyter notebook format. Learn more about the format here.

4. From self

To create a Notebook for a notebook that you are currently working in:
Warning:For now, this method only works if you are using the VS Code IDE.

Uploading a notebook to Expected Parrot

A notebook can be posted to Expected Parrot in the same ways as other EDSL objects: by calling the push() method on the object or calling the create method on a Coop client object and passing it the notebook. Here we create a Notebook object and use the push() method to post it to Expected Parrot. You can optionally pass a description, a convenient alias URL and a visibility setting (public, private or unlisted by default) to the push() method:
These can also be modified at Expected Parrot later on. We can see that the notebook has been posted publicly with a description and an alias URL (you can retrieve and refer to the object by either the UUID or URL):
Here we alternatively use the Coop client object to post the notebook:
Note:(Note that we cannot reuse the alias unless we delete the object.) This will return a message with information about the object that was posted, and you will be able to view your notebook at Expected Parrot: Content.

Updating a notebook on Expected Parrot

A notebook can be updated on Expected Parrot in the same ways as other EDSL objects: by calling the patch() method on the object or calling the update method on a Coop client object and passing it the parameters to be modified. Here we update the description of a notebook that we have already posted:
Here we alternatively use the Coop client object:
Here we update the contents of the notebook itself by passing the value argument:

Saving a notebook to file

You can access notebooks that other users have posted publicly at Expected Parrot Content page. Notebooks can be copied and downloaded the same way as other EDSL objects: by calling the pull() method on the Notebook constructor or the get method on a Coop client object and passing the notebook’s uuid. You can also use the to_file() method to save the notebook to a file:
This allows you to edit and run the notebook on your local machine.

Deleting a notebook from Expected Parrot

A notebook can be deleted from the platform in the same ways as other EDSL objects: by calling the delete() method on the constructor and passing it the uuid of the notebook to be deleted. You can also delete a notebook manually from your Expected Parrot account. Here we delete a notebook using the Notebook object: