Skip to content

Commit 29ec29c

Browse files
committed
remove coding_env_ variables
Now can be the same across schools.
1 parent 45ca0b9 commit 29ec29c

File tree

16 files changed

+30
-98
lines changed

16 files changed

+30
-98
lines changed

_toc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ chapters:
1919
title: "{{lms_name}}"
2020
- url: "{{discussions_url}}"
2121
title: Ed Discussions
22-
- url: "{{coding_env_url}}"
23-
title: "{{coding_env_name}}"
22+
- url: https://colab.research.google.com
23+
title: Google Colab
2424
- file: lectures
2525
sections:
2626
- file: lecture_0

assignments.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ To edit/execute a Homework/lecture notebook:
1111
1. Open the page for the Homework/Lecture on this site.
1212
- For example: [Homework 0](hw_0.ipynb)
1313
1. Click the launch button (🚀) at the top.
14-
1. You should now see the notebook in {{coding_env_name}}.
14+
1. You should now see the notebook in Google Colab.
1515
1. Make sure you're using your school Google account. [How to switch.](https://support.google.com/accounts/answer/1721977)
1616
1. Click `Copy to Drive`.
1717

@@ -40,7 +40,7 @@ You'll create your own notebook.
4040
- **[Don't repeat yourself (DRY).](https://dzone.com/articles/is-your-code-dry-or-wet)** If you find yourself copying and pasting code within your file(s), there's probably a better way to do it.
4141
- **Avoid [hard-coding](https://www.quora.com/What-does-hard-coded-something-mean-in-computer-programming-context) values.** Don't rely on things like row numbers or column order being stable, in case the dataset were to be updated.
4242

43-
### Jupyter / {{coding_env_name}}
43+
### Jupyter / Google Colab
4444

4545
- Keep each cell to only a few lines of code.
4646
- Allows/encourages you to output intermediate results, ensuring that everything is working as expected.
@@ -62,7 +62,7 @@ You'll create your own notebook.
6262
- The URL should be of the format `https://colab.research.google.com/drive/<long identifier>`. If it's `https://colab.research.google.com/github/...`, click `Copy to Drive`.
6363
1. Paste your notebook URL in the {{lms_name}} Assignment.
6464

65-
Engaging with comments left in {{coding_env_name}} is more than welcome.
65+
Engaging with comments left in Google Colab is more than welcome.
6666

6767
### Notes
6868

@@ -96,7 +96,7 @@ Engaging with comments left in {{coding_env_name}} is more than welcome.
9696

9797
### {{coding_env_kernel_name|title}} and memory issues
9898

99-
The {{coding_env_kernel_name}} is [the place where Python is installed and the code is actually executing](https://docs.jupyter.org/en/stable/projects/kernels.html#kernels), in the cloud somewhere. If your {{coding_env_kernel_name}} is repeatedly crashing, you're probably running out of memory.
99+
The runtime is [the place where Python is installed and the code is actually executing](https://docs.jupyter.org/en/stable/projects/kernels.html#kernels), in the cloud somewhere. If your runtime is repeatedly crashing, you're probably running out of memory.
100100

101101
- Make sure you aren't loading data you don't need.
102102
- If loading a new dataset, [make it smaller](assignments/open_ended.md#reducing-data-size)

assignments/open_ended.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ Probably not realistic to make visualizations that are as fancy as these ones ma
6565

6666
## Storing data
6767

68-
To work with uploaded files in {{coding_env_name}}, you have two options.
68+
To work with uploaded files in Google Colab, you have two options.
6969

7070
### Direct upload
7171

7272
_Fewer steps, but your file(s) will disappear when your session ends._
7373

74-
<img src="../extras/img/colab_upload_direct.png" height=261 alt="Steps to get data into {{coding_env_name}} directly"/>
74+
<img src="../extras/img/colab_upload_direct.png" height=261 alt="Steps to get data into Google Colab directly"/>
7575

76-
1. In the {{coding_env_name}} sidebar, click the `Files` icon (A).
76+
1. In the Google Colab sidebar, click the `Files` icon (A).
7777
1. Click the upload button (B).
7878
1. Select your file.
7979
1. You'll use `read_csv("MY_FILENAME.csv")` in your code.
@@ -82,21 +82,21 @@ _Fewer steps, but your file(s) will disappear when your session ends._
8282

8383
_More steps, but your file(s) are preserved between sessions._
8484

85-
![Steps to get data into {{coding_env_name}} via Drive](../extras/img/colab_upload_drive.png)
85+
![Steps to get data into Google Colab via Drive](../extras/img/colab_upload_drive.png)
8686

8787
1. Upload the file(s) somewhere in [Drive](https://drive.google.com/drive/my-drive).
88-
1. In the {{coding_env_name}} sidebar, click the `Files` icon (A).
88+
1. In the Google Colab sidebar, click the `Files` icon (A).
8989
1. Click the `Mount Drive` icon (B).
9090
- You may need to run the code it injects to authorize it (C).
91-
- Think of this as attaching your Drive to your {{coding_env_name}} instance, as if you were plugging in a USB flash drive.
91+
- Think of this as attaching your Drive to your Google Colab instance, as if you were plugging in a USB flash drive.
9292
1. Navigate to the file (D).
9393
- You may need to click into `content`, then `drive`.
9494
1. Next to the filename, click the three dots.
9595
1. Click `Copy path` (E).
9696
- The value should be something like `/content/drive/My Drive/...`.
9797
1. Use this path with `read_csv()` (F).
9898

99-
{{coding_env_name}} cannot access the file on your local machine; in other words, the path shouldn't start with `C:\\` or anything like that. [More info about file paths.](https://www.codecademy.com/resources/docs/general/file-paths)
99+
Google Colab cannot access the file on your local machine; in other words, the path shouldn't start with `C:\\` or anything like that. [More info about file paths.](https://www.codecademy.com/resources/docs/general/file-paths)
100100

101101
## Reducing data size
102102

extras/lib/school.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ class SchoolText:
2323
lms_notification_settings_url: str
2424
grading_docs: str
2525
grading_extension_docs: str
26-
coding_env_name: str
27-
coding_env_origin: str
28-
coding_env_kernel_name: str
2926
assistant_name: str
3027
assistant_responsibilities: str
3128
wait_list: str
@@ -62,9 +59,6 @@ class SchoolText:
6259
lms_notification_settings_url="https://edstem.org/us/settings/notifications",
6360
grading_docs="https://community.canvaslms.com/t5/Instructor-Guide/How-do-I-use-SpeedGrader/ta-p/757",
6461
grading_extension_docs="https://community.canvaslms.com/t5/Instructor-Guide/How-do-I-assign-an-assignment-to-an-individual-student/ta-p/717#assign_to_student_only",
65-
coding_env_name="Google Colab",
66-
coding_env_origin="https://colab.research.google.com",
67-
coding_env_kernel_name="runtime",
6862
assistant_name="Reader",
6963
assistant_responsibilities="https://docs.google.com/document/d/1NiS1uPM_0OB7dXHP1D90P-XikXj6gwWRUsf0V_dEoUI/edit#heading=h.7f7yn4ehwnkz",
7064
wait_list="https://www.registrar.columbia.edu/content/wait-lists-ssol",
@@ -110,9 +104,6 @@ class SchoolText:
110104
lms_notification_settings_url="https://brightspace.nyu.edu/d2l/Notifications/Settings?ou=477758",
111105
grading_docs="https://guides.gradescope.com/hc/en-us/articles/22066635961357-Grading-a-Programming-Assignment#h_01HH372CKNNR01EAMQ1VS6BB7M",
112106
grading_extension_docs="https://guides.gradescope.com/hc/en-us/articles/22251762857997-Extending-assignment-release-dates-due-dates-and-time-limits",
113-
coding_env_name="Google Colab",
114-
coding_env_origin="https://colab.research.google.com",
115-
coding_env_kernel_name="runtime",
116107
assistant_name="grader",
117108
assistant_responsibilities="https://docs.google.com/document/d/1dX2MDc5Fhby8GyeKLF4rrI0RZrJAmF1LHGV2SdFIkAE/edit#heading=h.7f7yn4ehwnkz",
118109
wait_list="https://www.nyu.edu/students/student-information-and-resources/registration-records-and-graduation/albert-help/training/students/registration/waitlists.html",
@@ -166,7 +157,6 @@ class SchoolText:
166157
"hannahkates/nyu-python-public-policy",
167158
"https://community.canvaslms.com/t5/canvas-basics-guide/what-are-grading-schemes/ta-p/41",
168159
"name: install conda packages", # CI
169-
"nbgrader",
170160
"nyu's quantitative analysis guide",
171161
"python coding for public policy assignments",
172162
"secondary", # matches "conda"

extras/lib/school_template.py

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import re
22
import dataclasses
3-
from urllib.parse import urlencode
43
from jinja2 import Environment, StrictUndefined
54
from nbconvert.preprocessors import Preprocessor
65
from nbformat import NotebookNode
@@ -16,30 +15,9 @@
1615
)
1716

1817

19-
def nbgitpuller_url(origin: str):
20-
"""https://nbgitpuller.readthedocs.io/en/latest/topic/url-options.html"""
21-
22-
query = urlencode(
23-
{
24-
"repo": "https://github.com/afeld/python-public-policy",
25-
"urlpath": "tree/python-public-policy/",
26-
"branch": "nyu",
27-
}
28-
)
29-
return f"{origin}/hub/user-redirect/git-pull?{query}"
30-
31-
3218
def get_vars(school_id: str):
3319
school_text = SCHOOL_TEXT[school_id]
34-
local_vars = dataclasses.asdict(school_text)
35-
36-
origin = local_vars["coding_env_origin"]
37-
if school_id == "nyu":
38-
local_vars["coding_env_url"] = nbgitpuller_url(origin)
39-
else:
40-
local_vars["coding_env_url"] = origin
41-
42-
return local_vars
20+
return dataclasses.asdict(school_text)
4321

4422

4523
def render_template(source: str, school_id: str):

extras/lib/test_school_template.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
from urllib.parse import parse_qs, urlparse
2-
31
from nbformat.v4 import new_markdown_cell
42
import pytest
53

64
from .school import SCHOOL_TEXT
75
from .school_template import (
86
confirm_other_schools_not_included,
97
render_cell,
10-
get_vars,
11-
render_template,
128
)
139

1410

@@ -29,35 +25,3 @@ def test_other_school():
2925
confirm_other_schools_not_included("Something something Columbia", "columbia")
3026
with pytest.raises(AssertionError):
3127
confirm_other_schools_not_included("Something something NYU", "columbia")
32-
33-
34-
def test_render_template():
35-
rendered = render_template("{{coding_env_url}}", "nyu")
36-
37-
assert "&amp;" not in rendered, "Query separators shouldn't be encoded"
38-
39-
url = urlparse(rendered)
40-
query = parse_qs(url.query)
41-
assert query == {
42-
"repo": ["https://github.com/afeld/python-public-policy"],
43-
"urlpath": ["tree/python-public-policy/"],
44-
"branch": ["nyu"],
45-
}, "Should contain the nbgitpuller URL"
46-
47-
48-
def test_coding_env_origin_columbia():
49-
vars = get_vars("columbia")
50-
assert vars["coding_env_url"] == vars["coding_env_origin"], (
51-
"There should be no change"
52-
)
53-
54-
55-
def test_coding_env_origin_nyu():
56-
vars = get_vars("nyu")
57-
assert vars["coding_env_origin"].endswith(".rcnyu.org")
58-
59-
60-
def test_coding_env_origin_render():
61-
rendered = render_template("{{coding_env_origin}}", "nyu")
62-
assert rendered.startswith("https://padmgp-4506")
63-
assert rendered.endswith(".rcnyu.org")

final_project/resources.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Seee also: [open-ended assignment information](../assignments/open_ended.md)
77
To count the number of lines of code in a notebook:
88

99
1. Download the notebook as a Python file.
10-
1. With the notebook open in {{coding_env_name}}, go to `File`->`Download`->`Download .py`.
10+
1. With the notebook open in Google Colab, go to `File`->`Download`->`Download .py`.
1111
1. Upload the Python file to Google Colab ([directly, not to Google Drive](../assignments/open_ended.md#storing-data)).
1212
1. Click the `Files` icon in the sidebar.
1313
1. Click the `Upload to session storage` button.

hw_0.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
" - Grading\n",
3030
" - Submission Comment\n",
3131
"- Adjust notebook settings\n",
32-
" 1. [Open this notebook in {{coding_env_name}}.](https://python-public-policy.afeld.me/en/{{school_slug}}/assignments.html#getting-started)\n",
32+
" 1. [Open this notebook in Google Colab.](https://python-public-policy.afeld.me/en/{{school_slug}}/assignments.html#getting-started)\n",
3333
" 1. In the menu bar, click `Tools`.\n",
3434
" 1. Click `Settings`.\n",
3535
" 1. Click `Editor`.\n",
3636
" 1. Check the box for `Show line numbers`.\n",
3737
" 1. Click `AI Assistance`.\n",
3838
" 1. Recommended: Disable \"Show AI-powered inline completions\".\n",
3939
" - [It's ok to use generative AI](https://python-public-policy.afeld.me/en/{{school_slug}}/syllabus.html#academic-integrity), but when you're new to coding, you will learn more if you write the code yourself.\n",
40-
"- Share your {{coding_env_name}} folder\n",
40+
"- Share your Google Colab folder\n",
4141
" 1. Open [Google Drive](https://drive.google.com/)\n",
4242
" 1. If you are signed into multiple Google accounts, [switch](https://support.google.com/accounts/answer/1721977) to your Columbia one.\n",
4343
" 1. [Share the `Colab Notebooks` folder](https://support.google.com/drive/answer/7166529) with [the instructor{% if id == \"columbia\" %} and {{assistant_name}}{% endif %}](https://python-public-policy.afeld.me/en/{{school_slug}}/syllabus.html#instructor-information) as a `Commenter`\n",
@@ -194,7 +194,7 @@
194194
"\n",
195195
"[Kaggle](https://www.kaggle.com/) is a data science platform that has various [tutorials](https://www.kaggle.com/learn/overview) and [competitions](https://www.kaggle.com/competitions), which you may want to go back to later. You are welcome to create a Kaggle account to save your progress, but it's not required.\n",
196196
"\n",
197-
"Kaggle, like {{coding_env_name}}, is built around Jupyter notebooks. They are not _exactly_ the same, but will feel similar. Do the following Kaggle tutorial. You do not need to turn this in.\n",
197+
"Kaggle, like Google Colab, is built around Jupyter notebooks. They are not _exactly_ the same, but will feel similar. Do the following Kaggle tutorial. You do not need to turn this in.\n",
198198
"\n",
199199
"- [Creating, Reading, and Writing with Pandas](https://www.kaggle.com/residentmario/creating-reading-and-writing)\n",
200200
"\n",

index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Produced and taught by [Aidan Feldman](https://api.afeld.me/). Largely based on
2222
- [Ed]({{discussions_url}}), which is used for:
2323
- Accouncements
2424
- Discussions
25-
- [{{coding_env_name}}]({{coding_env_url}}), where work will be completed
25+
- [Google Colab](https://colab.research.google.com), where work will be completed
2626

2727
## Why this class?
2828

joining_late.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ If you're not officially [registered](registration.md) for the course but want t
2424
- Look through the [important links](index.md#important-links), including [past lectures](syllabus.md#schedule).
2525
- [Recording](https://columbiauniversity.zoom.us/rec/play/dBBFt7QTwZTfETvu0_VQzqT_pt6K0-4PvrRJF0fDUVH8yKoIHP9WOCl8hGRSyIu3HEiKxPQ2woCwDQ-I.OGynUNH57slJqZki) of [Lecture 0](lecture_0.ipynb)
2626
- You won't be able to access [{{submission_tool_name}}]({{submission_tool_url}}) or the [Ed Discussions]({{discussions_url}}).
27-
- [Complete the Assignment(s) in {{coding_env_name}} as normal](assignments.md), waiting until you are registered to [submit](assignments.md#submission) them.
27+
- [Complete the Assignment(s) in Google Colab as normal](assignments.md), waiting until you are registered to [submit](assignments.md#submission) them.
2828

2929
## Once you join
3030

0 commit comments

Comments
 (0)