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: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 aCoop 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:
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 aCoop client object and passing it the parameters to be modified.
Here we update the description of a notebook that we have already posted:
Coop client object:
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 aCoop client object and passing the notebook’s uuid. You can also use the to_file() method to save the notebook to a file:
