Skip to content

Commit c359b45

Browse files
Added dependency and cell toggle info.
1 parent 4b624c9 commit c359b45

1 file changed

Lines changed: 38 additions & 6 deletions

File tree

notebooks/notebooksReadme.md

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
## Overview
44

5-
Jupyter notebooks are documents that take coding in Python (and potentially other languages) to a whole new level. They are technically just fancy JSON files, but with a Jupyter notebook and a compatible IDE, you can:
5+
Jupyter notebooks are documents that take coding in Python (and potentially other languages) to a whole new level. They are technically just fancy JSON files with a `.ipynb` extension, but with a Jupyter notebook and a compatible IDE, you can:
66

7-
1. Write, run and re-run code in a block-by-block basis, while keeping all variables in an active, interactive kernel space. Those blocks are called "cells."
7+
1. Write, run and re-run code in a block-by-block basis, while keeping all variables in an active and *interactive* kernel space. Those blocks are called "cells."
88
2. Combine executable code, rich text, HTML, and even images in a single document, going way beyond standard Python comments and inserting HTML- or Markdown-formatted documentation inline with code in a way that never interferes with the operation of your code.
99
3. Rearrange code and Markdown cells aribitrarily for verification, experimentation, or pure curiosity.
1010
4. Much more, if you are willing to learn!
@@ -27,11 +27,11 @@ Regardless of how you choose to create them, notebooks are stored as `.ipnyb` fi
2727

2828
## Setting up your environment variables
2929

30-
Any use of the API requires the use of an _API key_ (also called _API token_) for authentication. Technically, you could include your API token in plaintext in your notebooks or Python scripts, but that would be like storing your password in plaintext, and make it risky to share or publish your work. A more secure approach is to store your API key in your local environment variables. The Meraki SDK will automatically check your `env` for the appropriate variable and use it if it exists.
30+
Any use of the API requires the use of an _API key_ (also called _API token_) for authentication. Technically, you could include your API key in plaintext in your notebooks or Python scripts, but that would be like storing your password in plaintext, and make it risky to share or publish your work. A more secure approach is to store your API key in your local environment variables. The Meraki SDK will automatically check your `env` for the appropriate variable and use it if it exists.
3131

3232
### Using Colab
3333

34-
To simulate environment variables in Colab, we'll use the `colab-env` module. To set it up, you'll need a (free) Google account. `colab-env` creates a file called `vars.env` in your Google Drive to store the variables, and we'll use Python to add variables to it.
34+
To simulate environment variables in Colab, we'll use the `colab-env` package. To set it up, you'll need a (free) Google account. `colab-env` creates a file called `vars.env` in your Google Drive to store the variables, and we'll use Python to add variables to it.
3535

3636
1. Open [Colaboratory](https://colab.research.google.com/) in your browser.
3737
2. Sign in with a Google account if prompted.
@@ -52,7 +52,7 @@ To simulate environment variables in Colab, we'll use the `colab-env` module. To
5252
|:--:|:--:|
5353
| *First time* | *When `vars.env` exists* |
5454

55-
8. In a new cell, paste in the following code block, and replace YOUR_API_KEY_HERE with your actual API key:
55+
8. In a new cell, paste in the following code block, and replace `YOUR_API_KEY_HERE` with your actual API key:
5656

5757
```python
5858
colab_env.envvar_handler.add_env(envname="MERAKI_DASHBOARD_API_KEY",envval="YOUR_API_KEY_HERE")
@@ -125,10 +125,30 @@ Colab will open the notebook and you can get started!
125125

126126
### Using Colab
127127

128+
Unlike local Python environments, Colab environments are not persistent. Therefore, whenever we expect to use a third-party package in Colab, we need to install it first using `pip`. The syntax is as follows:
128129

130+
```python
131+
%pip install PACKAGE_NAME
132+
```
133+
134+
For example, to install the Meraki SDK (replace `1.0.0b15` with whatever version you plan to use):
135+
136+
```python
137+
%pip install meraki==1.0.0b15
138+
```
139+
140+
If necessary, create a new code cell at the top of the notebook, paste in that code, and run it before working with the rest of your notebook.
129141

130142
### Using VS Code
131143

144+
At a terminal, run:
145+
146+
```shell
147+
pip install meraki==1.0.0b15
148+
```
149+
150+
Other packages can be installed the same way using the relevant package name. Try it with `tablib`!
151+
132152
## Creating new cells in a notebook
133153

134154
### Using Colab
@@ -161,6 +181,18 @@ If you receive a warning, review the warning, then click `Run Anyway`:
161181

162182
![Colab notebook authorship warning](/.github/images/colab-notebook-warning-run-cell-Annotation_2020-08-05_143410.png)
163183

164-
## Changing a cell's mode from code to text formatting (typically Markdown)
184+
## Toggling a cell's mode between code and text
165185

166186
### Using Colab
187+
188+
#### Convert code to text
189+
190+
Select the cell, then hold `Ctrl` or `⌘` and type `MM`.
191+
192+
#### Convert text to code
193+
194+
Select the cell, then hold `Ctrl` or `⌘` and type `MY`.
195+
196+
### Using VS Code
197+
198+
Select the cell, then at the top of the cell click either `M` to convert to text, or `{}` to convert to code.

0 commit comments

Comments
 (0)