Python productivity for Zynq (Pynq) Documentation, Release 2.0
PYNQ is written in Python, which is the default kernel for Jupyter Notebook, and the only kernel installed for Jupyter
Notebook in the PYNQ distribution.
Kernels communicate with the notebook web application and web browser using a JSON over ZeroMQ/WebSockets
message protocol that is described here. Most users don’t need to know about these details, but its important to
understand that kernels run on Zynq, while the web browser serves up an interface to that kernel.
2.2.3 Notebook Documents
Notebook documents contain the inputs and outputs of an interactive session as well as narrative text that accom-
panies the code but is not meant for execution. Rich output generated by running code, including HTML, images,
video, and plots, is embedded in the notebook, which makes it a complete and self-contained record of a computation.
When you run the notebook web application on your computer, notebook documents are just files on your local
filesystem with a .ipynb extension. This allows you to use familiar workflows for organizing your notebooks into
folders and sharing them with others.
Notebooks consist of a linear sequence of cells. There are four basic cell types:
• Code cells: Input and output of live code that is run in the kernel
• Markdown cells: Narrative text with embedded LaTeX equations
• Heading cells: Deprecated. Headings are supported in Markdown cells
• Raw cells: Unformatted text that is included, without modification, when notebooks are converted to different
formats using nbconvert
Internally, notebook documents are JSON data with binary values base64 encoded. This allows them to be read and
manipulated programmatically by any programming language. Because JSON is a text format, notebook documents
are version control friendly.
Notebooks can be exported to different static formats including HTML, reStructeredText, LaTeX, PDF, and slide
shows (reveal.js) using Jupyter’s nbconvert utility. Some of documentation for Pynq, including this page, was
written in a Notebook and converted to html for hosting on the project’s documentation website.
Furthermore, any notebook document available from a public URL or on GitHub can be shared via nbviewer. This
service loads the notebook document from the URL and renders it as a static web page. The resulting web page may
thus be shared with others without their needing to install the Jupyter Notebook.
GitHub also renders notebooks, so any Notebook added to GitHub can be viewed as intended.
2.2.4 Notebook Basics
The Notebook dashboard
The Notebook server runs on the ARM® processor of the PYNQ-Z1. You can open the notebook dashboard by
navigating to pynq:9090 when your board is connected to the network. The dashboard serves as a home page for
notebooks. Its main purpose is to display the notebooks and files in the current directory. For example, here is a
screenshot of the dashboard page for an example directory:
The top of the notebook list displays clickable breadcrumbs of the current directory. By clicking on these breadcrumbs
or on sub-directories in the notebook list, you can navigate your filesystem.
To create a new notebook, click on the “New” button at the top of the list and select a kernel from the dropdown (as
seen below).
Notebooks and files can be uploaded to the current directory by dragging a notebook file onto the notebook list or by
the “click here” text above the list.
2.2. Jupyter Notebooks 15