You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: notebooks/notebooksReadme.md
+38-6Lines changed: 38 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,9 @@
2
2
3
3
## Overview
4
4
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:
6
6
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."
8
8
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.
9
9
3. Rearrange code and Markdown cells aribitrarily for verification, experimentation, or pure curiosity.
10
10
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
27
27
28
28
## Setting up your environment variables
29
29
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.
31
31
32
32
### Using Colab
33
33
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.
35
35
36
36
1. Open [Colaboratory](https://colab.research.google.com/) in your browser.
37
37
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
52
52
|:--:|:--:|
53
53
|*First time*|*When `vars.env` exists*|
54
54
55
-
8. In a new cell, paste in the following code block, and replace YOUR_API_KEY_HEREwith 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:
@@ -125,10 +125,30 @@ Colab will open the notebook and you can get started!
125
125
126
126
### Using Colab
127
127
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 isas follows:
128
129
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.
129
141
130
142
### Using VS Code
131
143
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
+
132
152
## Creating new cells in a notebook
133
153
134
154
### Using Colab
@@ -161,6 +181,18 @@ If you receive a warning, review the warning, then click `Run Anyway`:
0 commit comments