Skip to content

Commit 53cc642

Browse files
committed
more updates to Ep 1 for Colab/Broad
1 parent 8ce2a3b commit 53cc642

File tree

8 files changed

+61
-28
lines changed

8 files changed

+61
-28
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,6 @@ po/*~
5151

5252
# renv detritus
5353
renv/sandbox/
54+
55+
# files to hide
56+
hide/

episodes/fig/authorize_access.png

43.6 KB
Loading

episodes/fig/permit_access.png

71.3 KB
Loading

episodes/fig/run_access_test.png

64.9 KB
Loading

episodes/fig/success.png

146 KB
Loading

episodes/getting-started.md

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,33 @@ exercises: 5
2626
## Before we begin
2727

2828
### Open the collaborative doc for our workshop https://broad.io/cb-python-20240927
29-
You'll find all the links listed below in the collaborative doc.
29+
You'll find all the links listed below as clickable links in the collaborative doc.
3030

3131
If you haven't completed your workshop setup please visit https://broad.io/cb-python-setup
3232

33-
##### If you need help with setup, please put the <span style="color:fuchsia">pink post-it</span> on your computer and a TA will come help you.
33+
#### **If you need help** with setup, please put the <span style="color:fuchsia">pink post-it</span> on your computer and a TA will come help you.
3434

35-
If you've created your colab account, downloaded the workshop data files, uploaded it to your colab account's google drive AND successfully run the access test, please put the <span style="color:lime">green post-it</span> on your computer to indicate your setup is complete.
35+
If you're fully set up (ie created your colab account, downloaded the workshop data files, uploaded the files to your colab account's google drive AND successfully run the access test), please put the <span style="color:limegreen">green post-it</span> on your computer and feel free to browse today's lesson content. https:/broad.io/cb-python-20240927-lesson
3636

37-
To run the access test, visit https://broad.io/cb-python-access-test, 1. click "Copy to Drive" and, in YOUR COPY of `Python_workshop_data_access_test.ipynb` 2. click the ▶️ symbol on the left hand side of the cell.
38-
![](fig/run_access_test.png){alt='Click the ▶️ symbol'}
3937

40-
This is what success looks like:
41-
![](fig/success.png){alt=''}
38+
**To run the access test**
39+
1. visit https://broad.io/cb-python-access-test
40+
2. click "Copy to Drive" and create your own copy of `Python_workshop_data_access_test.ipynb`
41+
![](fig/run_access_test.png){alt='Click Copy to Drive'}
4242

43-
Feel free to browse today's lesson content https:/broad.io/cb-python-20240927-lesson
44-
![](fig/cb-python-lesson.png){alt='Workshop collaborative doc'}
43+
3. If you see this dialog box, click "Connect to Google Drive"
44+
![](fig/permit_access.png){alt='Click "Connect to Google Drive"'}
4545

46-
::::::::::::::::::::::::::::::::::::::::::
46+
1. Authorize access for the google account you're using for this workshop. There will be several prompts to grant access.
47+
![](fig/authorize_access.png){alt='Authorize access to your google account'}
48+
1. Once access has been granted, go back to the access test notebook, click the ▶️ symbol on the left hand side of the first code cell.
49+
You've successfully loaded data if you see a dataframe appear beneath the code cell
50+
![](fig/success.png){alt='the ▶️ symbol'}
51+
52+
If you see loaded data beneath the code cell, feel free to browse today's lesson content. https:/broad.io/cb-python-20240927-lesson
53+
54+
55+
::::::::::::::::::::::::::::::::::::::::::::::::::
4756

4857

4958
## Why Python?
@@ -58,11 +67,11 @@ This lesson works with a series of CSV files of circulation data from the Chicag
5867
If you haven't already done so, see [the setup instructions](../learners/setup.md) for details on preparing to use Google Colab for this workshop. The setup instructions also walk you through the steps you should follow to create an `lc-python` folder in your home directory, to download and unzip the dataset we'll be working with inside of that directory and then upload it to Google Drive so it will be accessible to Google Colab.
5968

6069
### Getting started with Jupyter Notebook
61-
To run Python, we are going to use Jupyter Notebooks via [Google Colab][https://colab.google/]. Jupyter notebooks are common tools for data science and visualization, and serve as a convenient environment for running Python code interactively where we can view and share the results of our Python code.
70+
To run Python, we are going to use Jupyter Notebooks via [Google Colab](https://colab.google/). Jupyter notebooks are common tools for data science and visualization, and serve as a convenient environment for running Python code interactively where we can view and share the results of our Python code.
6271

6372
::::::::::::::::::::::::::::::::::::::::: callout
6473
### Alternatives to Juypter
65-
There are other ways of editing, managing, and running Python code. Software developers often use an integrated development environment (IDE) like [PyCharm](https://www.jetbrains.com/pycharm/), [Spyder][spyder] or [Visual Studio Code (VS Code)](https://code.visualstudio.com/), to create and edit Python scripts. Others use text editors like Vim or Emacs to hand-code Python. After editing and saving Python scripts you can execute those programs within an IDE or directly on the command line.
74+
There are other ways of editing, managing, and running Python code. Software developers often use an integrated development environment (IDE) like [PyCharm](https://www.jetbrains.com/pycharm/), [Spyder](https://www.spyder-ide.org) or [Visual Studio Code (VS Code)](https://code.visualstudio.com/), to create and edit Python scripts. Others use text editors like Vim or Emacs to hand-code Python. After editing and saving Python scripts you can execute those programs within an IDE or directly on the command line.
6675
::::::::::::::::::::::::::::::::::::::::::::::::::
6776

6877
Jupyter notebooks let us execute and view the results of our Python code immediately within the notebook. JupyterLab has several other handy features:
@@ -74,14 +83,14 @@ Jupyter notebooks let us execute and view the results of our Python code immedia
7483
to better explore your data and visualize the results of your analysis.
7584
- Each notebook contains one or more cells that contain code, text, or images.
7685

77-
## Google colab
86+
## Google Colab
7887

79-
Google colab is a web-based computational notebook hosted in the cloud by Google.
88+
Google Colab is a web-based computational notebook hosted in the cloud by Google.
8089
Much like a lab notebook where a wet-lab experimentalist might have both the
8190
experimental protocol and notes on the specific experiment, a Jupyter notebook
8291
allows you to have code and notes in the same notebook.
8392

84-
Visit https://colab.research.google.com/ and click on `Examples` or, if you're already in colab, `File -> Open notebook`. Then in the resulting window, click on `Examples`.
93+
Visit https://colab.research.google.com/ and click on `Examples` or, if you're already in Colab, `File -> Open notebook`. Then in the resulting window, click on `Examples`.
8594

8695
Google offers many example notebooks:
8796

@@ -90,7 +99,7 @@ Google offers many example notebooks:
9099
Google offers a basic colab experience for free. Hosted runtime machines consume computing resources which will be [shut down](https://research.google.com/colaboratory/faq.html#resource-limits) if you're not active in the notebook. If you see an "Are you still there?" window during this workshop, complete the prompt so your colab notebooks stays active.
91100

92101
<div>
93-
<img src="fig/are_you_still_there.png" width="400"/>
102+
<img src="fig/are_you_still_there.png" alt="Are you still there prompt" width="400"/>
94103
</div>
95104

96105
If you see `Connect` or `Reconnect`, you've been disconnected from a hosted runtime and you'll need to reconnect. Any work you did in the notebook is likely to be stale and you'll need to `Runtime -> Run all` (Ctrl+F9).
@@ -163,9 +172,21 @@ You can move cells around in your notebook by using the arrow icons in the float
163172

164173
:::::::::::::::::::::::::::::::::::::::::: spoiler
165174

166-
## Note on keyboard shortcuts for Mac
175+
## Note on Colab keyboard shortcuts
176+
177+
Colab keyboard shortcuts use CMD ⌘ (on a Mac) or CTRL (on Windows) key together with the m key to activate a keyboard shortcut.
178+
179+
CMD/CTRL M + h show a list of keyboard shortcut options
180+
CMD/CTRL M + a insert code cell above
181+
CMD/CTRL M + b insert code cell below
182+
CMD/CTRL M + m convert cell to markdown cell
183+
CMD/CTRL M + y convert cell to code cell
184+
:::::::::::::::::::::::::::::::::::::::::: spoiler
185+
186+
## About keyboard shortcuts for Mac
187+
In Colab, Macs can use Ctrl+F9 OR ⌘+F9. In other Jupyter notebook environments, Ctrl+F9 may not be an option for Mac. For the rest of this workshop, we'll use indicate Ctrl+\<keystroke\> for simplicity. Mac users should keep in mind that using Command (⌘) in lieu of Ctrl is an option.
188+
::::::::::::::::::::::::::::::::::::::::::::::::::
167189

168-
In colab, Macs can use Ctrl+F9 OR ⌘+F9. In other Jupyter notebook environments, Ctrl+F9 may not be an option for Mac. For the rest of this workshop, we'll use indicate Ctrl+\<keystroke\> for simplicity. Mac users should keep in mind that using Command (⌘) in lieu of Ctrl is an option.
169190
::::::::::::::::::::::::::::::::::::::::::::::::::
170191

171192
::::::::::::::::::::::::::::::::::::::::: callout
@@ -176,18 +197,10 @@ Instructors: Since the lesson is focused on Python we don't include any Markdown
176197

177198
:::::::::::::::::::::::::::::::::::::::::::::::::
178199

179-
You can add text to a Juypter notebook by selecting a cell, and changing the dropdown above the notebook from `Code` to `Markdown`. Markdown is a lightweight language for formatting text. This feature allows you to annotate your code, add headers, and write documentation to help explain the code. While we won't cover Markdown in this lesson, there are many helpful online guides out there:
200+
You can add text to a Juypter notebook by selecting a cell, and changing the cell from `Code` to `Markdown`. In Colab, select the cell, then use the keyboard shortcut CMD/CTRL M + y. Markdown is a lightweight language for formatting text. This feature allows you to annotate your code, add headers, and write documentation to help explain the code. While we won't cover Markdown in this lesson, there are many helpful online guides out there:
180201
- [Markdown for Jupyter Cheatsheet (IBM)](https://www.ibm.com/docs/en/watson-studio-local/1.2.3?topic=notebooks-markdown-jupyter-cheatsheet)
181202
- [Markdown Guide (Matt Cone)](https://www.markdownguide.org/)
182203

183-
![Changing a cell from Code to Markdown](../episodes/fig/0_jupyter_markdown_dd.png){alt='screenshot of the Jupyter notebook dropdown to change a cell to Markdown'}
184-
185-
You can also use "hotkeys"" to change Jupyter cells from Code to Markdown and back:
186-
187-
- Click on the code cell that you want to convert to a Markdown cell.
188-
- Press the <kbd>Esc</kbd> key to enter command mode.
189-
- Press the <kbd>M</kbd> key to convert the cell to Markdown.
190-
- Press the <kbd>y</kbd> key to convert the cell back to Code.
191204
::::::::::::::::::::::::::::::::::::::::::::::::::
192205

193206

index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ site: sandpaper::sandpaper_site
66
## First adaptation of Python Intro for Libraries to Broad Computing Basics: Sept 1, 2024
77
The Python Intro for Libraries lesson currently uses a dataset of library usage data and uses Google Colab instead of JupyterLab. If you were familiar with the original version of the lesson and are planning to teach it again, please give yourself time to review the lesson for changes made to "Broadify" the content.
88

9-
In future, this lesson may be adapted to use a more genomic-oriented dataset.
9+
In future, this lesson may be adapted to use a more genomics-oriented dataset.
1010

1111
:::::::::::::::::::::::::::::::::::::::::::::::::
1212

learners/setup.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,23 @@ We will need to import our own resources into Colab, such as our simulated data.
2323

2424
You should see a `lc-python` folder in "My Drive", with a subfolder called `data`.
2525

26+
## Run the access test
27+
1. Visit https://broad.io/cb-python-access-test
28+
1. Click "Copy to Drive" and create your own copy of `Python_workshop_data_access_test.ipynb`
29+
![](fig/run_access_test.png){alt='Click Copy to Drive'}
30+
31+
1. If you see this dialog box, click "Connect to Google Drive"
32+
![](fig/permit_access.png){alt='Click "Connect to Google Drive"'}
33+
34+
1. Authorize access for the google account you're using for this workshop. There will be several prompts to grant access.
35+
![](fig/authorize_access.png){alt='Authorize access to your google account'}
36+
1. Once access has been granted, go back to the access test notebook, click the ▶️ symbol on the left hand side of the first code cell.
37+
38+
![](fig/success.png){alt='the ▶️ symbol'}
39+
You've successfully loaded data if you see a dataframe appear beneath the code cell.
40+
41+
If you need help with setup, we'll have office hours on Fri. Sept. 20 from 12:00 - 1:00pm in Tahiti Conference Room, 105B Room #301 and on Fri. Sept. 27 from 1:00 - 2:00pm in Madagascar Conference Room, 105B, Room #504.
42+
2643

2744
:::::::::::::::::::::::::::::::::::::::::: spoiler
2845

0 commit comments

Comments
 (0)