Notebooks
A notebook in DataCards is an interactive document environment consisting of a collection of cells - comparable to Jupyter notebook . Currently, DataCards supports Python notebooks, with each notebook being powered by its own Python kernel.
Creation of a Notebook
- Notebooks can be created indirectly via the Card Store by instantiating a card on the Deck. This will create in parallel a Notebook on the canvas of the logic view.
Accessing a Notebook
- To access a notebook, switch to the logic view, navigate on the canvas to the notebook, and click on it. The notebook will be opened.
- An alternative way for accessing a notebook is to click on the header of a card on the deck. This will open the underlying notebook.
- The notebook can be closed by clicking the close button in the top-right-hand corner of the notebook.
Moving a Notebook
- To move a notebook, switch to the logic view, navigate to the notebook, and drag it with the mouse.
- The notebook can be moved to a different position on the canvas.
Deleting a Notebook
- To delete a notebook, access the notebook and delete all of its cells.
- The notebook will be deleted, when it has no cells left and is closed.
Elements of a Notebook
- Each notebook consists of
- a menu bar
- at least one cell
- a runtime system information area,
- and some buttons to add more cells to the notebook.
The Menu Bar of a Notebook
-
The menu bar of a Notebook has buttons for (re)naming the notebook,executing the notebook, kernel management and a button to close the notebook.
-
The following actions can be performed:
- Restart: The notebook’s kernel is restarted
- Stop: The kernel is halted
- Kill: The kernel is terminated
- Clear Outputs: All outputs are cleared
- Rename: The notebook name can be changed
- Rename AI (Beta): The notebook name is suggested by AI based on its content
Cell Types
- There are currently two types of cells:
- Code Cells: For executable Python code
- Markdown Cells: For formatted text and documentation.
Cell Management
- Adding: New code or markdown cells can be inserted using the buttons below each cell
- Deleting: Via the trash icon in the cell’s menu bar
- Reordering: Using the up/down arrow icons in the cell’s menu bar
- Editing: Cells can be edited at any time
Special Cell Functions
- Code Highlighting: Syntax highlighting for better readability and error detection. Also, line numbers are shown.
- Code Completion: Automatic suggestions during input. This includes the completion of variable names und utility functions of the DataCards-SDK.
- Magic Commands: Python cells understand special magics that allow, for example, the installation of additional Python packages.
- Cell Menu Buttons: The menu bar of a cell has buttons for executing the cell in different modes, clearing the output of the cell, swop the cell with a neighboring cell,and removing the cell.
Code Execution
Cells can be executed in various ways:
- Single Cell: Via the play button in the cell’s menu bar
- Entire Notebook: Via the play button in the top right corner of the notebook
- Selective Execution:
- From the first cell to the selected cell
- From the selected cell to the last cell
Outputs and Cell status
- The results of code execution are displayed directly below the respective cell
- Error messages also appear in this location
Cell state
The current state of a cell is indicated by a colored dot in the top right corner:
- Gray (inactive): Cell has not yet been executed
- Gray (active): Cell is currently executing
- Green: Cell was executed successfully
- Red: Execution failed
Usage Notes
- DataCards never analyzes the code in the cells for content
- The system only evaluates the health status of the kernel, manages general code execution, and operates the SDK
- Once deleted, cells and their contents are irretrievably lost
Last updated on