Skip to content

Commit

Permalink
add note for requests and bash
Browse files Browse the repository at this point in the history
  • Loading branch information
Saransh Chopra committed Sep 10, 2024
1 parent 86d48b3 commit 411c94e
Show file tree
Hide file tree
Showing 24 changed files with 82 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Build the JupyterLite site
run: |
find . -type d -name .pytest_cache -o -name .ruff_cache -o -name .doctrees | xargs rm -rf
mkdir content
mkdir contents
mkdir _site/jupyter-lite
find ch*/ -type f -name '*.ipynb' ! -name '*.nbconvert.ipynb' -exec rsync -R {} contents/ \;
jupyter lite build --contents contents --output-dir _site/jupyter-lite
Expand Down
5 changes: 5 additions & 0 deletions ch00git/01Intro.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@
# %% [markdown]
# Commands you can type will look like this, using the %%bash "magic" for the notebook.

# **NOTE:** using bash/git commands is not fully supported on jupyterlite yet (due to single
# thread/process restriction), and the cells below might error out on the browser
# (jupyterlite) version of this notebook


# %% attributes={"classes": [" Bash"], "id": ""} jupyter={"outputs_hidden": false} language="bash"
# echo some output

Expand Down
5 changes: 5 additions & 0 deletions ch00git/02Solo.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
# %% [markdown]
# ## Solo work with Git

# %% [markdown]
# **NOTE:** using bash/git commands is not fully supported on jupyterlite yet (due to single
# thread/process restriction), and the cells below might error out on the browser
# (jupyterlite) version of this notebook

# %% [markdown]
# So, we're in our git working directory:

Expand Down
5 changes: 5 additions & 0 deletions ch00git/03Mistakes.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
# %% [markdown]
# ## Fixing mistakes

# %% [markdown]
# **NOTE:** using bash/git commands is not fully supported on jupyterlite yet (due to single
# thread/process restriction), and the cells below might error out on the browser
# (jupyterlite) version of this notebook

# %% [markdown]
# We're still in our git working directory:

Expand Down
5 changes: 5 additions & 0 deletions ch00git/04Publishing.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
# %% [markdown]
# ## Publishing

# %% [markdown]
# **NOTE:** using bash/git commands is not fully supported on jupyterlite yet (due to single
# thread/process restriction), and the cells below might error out on the browser
# (jupyterlite) version of this notebook

# %% [markdown]
# We're still in our working directory:

Expand Down
7 changes: 6 additions & 1 deletion ch00git/05Collaboration.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@

# %% [markdown]
# ## Collaboration
#

# %% [markdown]
# **NOTE:** using bash/git commands is not fully supported on jupyterlite yet (due to single
# thread/process restriction), and the cells below might error out on the browser
# (jupyterlite) version of this notebook
#
# ### Form a team

# %% [markdown]
Expand Down
6 changes: 5 additions & 1 deletion ch00git/10Branches.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@

# %% [markdown]
# ## Branches
#
#
# **NOTE:** using bash/git commands is not fully supported on jupyterlite yet (due to single
# thread/process restriction), and the cells below might error out on the browser
# (jupyterlite) version of this notebook
#
# Branches are incredibly important to why `git` is cool and powerful.
#
# They are an easy and cheap way of making a second version of your software, which you work on in parallel,
Expand Down
5 changes: 5 additions & 0 deletions ch00git/11Miscellany.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
# %% [markdown]
# ## Git Stash

# %% [markdown]
# **NOTE:** using bash/git commands is not fully supported on jupyterlite yet (due to single
# thread/process restriction), and the cells below might error out on the browser
# (jupyterlite) version of this notebook

# %% [markdown]
# Before you can `git pull`, you need to have committed any changes you have made. If you find you want to pull, but you're not ready to commit, you have to temporarily "put aside" your uncommitted changes.
# For this, you can use the `git stash` command, like in the following example:
Expand Down
6 changes: 5 additions & 1 deletion ch00git/12Remotes.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@

# %% [markdown]
# ## Working with multiple remotes
#
#
# **NOTE:** using bash/git commands is not fully supported on jupyterlite yet (due to single
# thread/process restriction), and the cells below might error out on the browser
# (jupyterlite) version of this notebook
#
# ### Distributed versus centralised
#
# Older version control systems (cvs, svn) were "centralised"; the history was kept only on a server,
Expand Down
6 changes: 5 additions & 1 deletion ch00git/14Bisect.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@

# %% [markdown]
# ## Debugging With Git Bisect
#
#
# **NOTE:** using bash/git commands is not fully supported on jupyterlite yet (due to single
# thread/process restriction), and the cells below might error out on the browser
# (jupyterlite) version of this notebook
#
# You can use
#
# ``` bash
Expand Down
1 change: 1 addition & 0 deletions ch01python/00pythons.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ def make_figure():
# `make_figure` function defined in the module.

# %%
# restart kernel on jupyterlite (browser) before running this
import draw_eight # Load the library
fig = draw_eight.make_figure()

Expand Down
3 changes: 3 additions & 0 deletions ch01python/010exemplar.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
# By combining them we can feel really powerful but doing minimum work ourselves. The python syntax to import someone else's library is "import".

# %%
# sending requests to the web is not fully supported on jupyterlite yet, and the
# cells below might error out on the browser (jupyterlite) version of this notebook

# install geopy if it is not already installed
%pip install geopy

Expand Down
2 changes: 2 additions & 0 deletions ch02data/061internet.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
# The Python [Requests](http://docs.python-requests.org/en/latest/) library can help us manipulate URLs and requesting the content associated with them. It is easier to use than the `urllib` library that is part of the standard library, and is included with Anaconda and Canopy. It sorts out escaping, parameter encoding, and so on for us.

# %%
# sending requests to the web is not fully supported on jupyterlite yet, and the
# cells below might error out on the browser (jupyterlite) version of this notebook
import requests

# %% [markdown]
Expand Down
2 changes: 2 additions & 0 deletions ch02data/063tabular.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
# We can request the CSV file text from the URL we used previously:

# %%
# sending requests to the web is not fully supported on jupyterlite yet, and the
# cells below might error out on the browser (jupyterlite) version of this notebook
import requests
# Request sunspots data from URL and extract response content as text
sunspots_csv_text = requests.get('http://www.sidc.be/silso/INFO/snmtotcsv.php').text
Expand Down
2 changes: 2 additions & 0 deletions ch02data/066QuakeExercise.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
# We can use the [`requests` Python library](https://docs.python-requests.org/en/latest/) to simplify constructing the appropriate query string to add to the <abbr title="Uniform Resource Locator">URL</abbr> and to deal with sending the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> request.

# %% jupyter={"outputs_hidden": false}
# sending requests to the web is not fully supported on jupyterlite yet, and the
# cells below might error out on the browser (jupyterlite) version of this notebook
import requests

# %% [markdown]
Expand Down
2 changes: 2 additions & 0 deletions ch02data/068QuakesSolution.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
# %% jupyter={"outputs_hidden": false}
import math

# sending requests to the web is not fully supported on jupyterlite yet, and the
# cells below might error out on the browser (jupyterlite) version of this notebook
import requests
import IPython
from IPython.display import Image
Expand Down
7 changes: 7 additions & 0 deletions ch02data/110Capstone.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@

# %%
# %%writefile greengraph/graph.py

# sending requests to the web is not fully supported on jupyterlite yet, and the
# cells below might error out on the browser (jupyterlite) version of this notebook

# install geopy if it is not already installed
%pip install geopy

Expand Down Expand Up @@ -90,6 +94,9 @@ def plot_green_between(self, steps):

import numpy as np
import imageio.v3 as iio

# sending requests to the web is not fully supported on jupyterlite yet, and the
# cells below might error out on the browser (jupyterlite) version of this notebook
import requests

class Map(object):
Expand Down
6 changes: 5 additions & 1 deletion ch03tests/03pytest.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@

# %% [markdown]
# ## Testing frameworks
#
#
# **NOTE:** using bash/git commands is not fully supported on jupyterlite yet (due to single
# thread/process restriction), and the cells below might error out on the browser
# (jupyterlite) version of this notebook
#
# ### Why use testing frameworks?

# %% [markdown]
Expand Down
2 changes: 2 additions & 0 deletions ch03tests/05Mocks.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@
# For example, consider the following code that downloads a map from the internet:

# %%
# sending requests to the web is not fully supported on jupyterlite yet, and the
# cells below might error out on the browser (jupyterlite) version of this notebook
import requests

def map_at(lat, long, satellite=False, zoom=12,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
# Now, close the Jupyter notebook if you have it open, and reopen it. Check your new library is installed with:

# %%
# sending requests to the web is not fully supported on jupyterlite yet, and the
# cells below might error out on the browser (jupyterlite) version of this notebook

# install geopy if it is not already installed
%pip install geopy

Expand Down
2 changes: 1 addition & 1 deletion ch04packaging/04documentation.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
#
# In writing Greeter, we used the [docstring conventions from NumPy](https://numpy.org/doc/stable/docs/howto_document.html).
# So we use the [`numpydoc`](https://numpydoc.readthedocs.io/en/latest/) sphinx extension to
# support these (Note: you will need to install this extension for the later examples to work).
# support these (**NOTE:** you will need to install this extension for the later examples to work).

# %% [markdown]
# ```python
Expand Down
2 changes: 2 additions & 0 deletions ch05construction/08objects.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def move(self, delta_t):
# Here's how we can use Python code to get an image back from YUML:

# %%
# sending requests to the web is not fully supported on jupyterlite yet, and the
# cells below might error out on the browser (jupyterlite) version of this notebook
import requests
from IPython.display import Image

Expand Down
3 changes: 3 additions & 0 deletions ch05construction/09patterns.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ def yuml(model):
from numpy.fft import rfft,fft,fftfreq
from scipy.interpolate import UnivariateSpline
from scipy.signal import lombscargle

# sending requests to the web is not fully supported on jupyterlite yet, and the
# cells below might error out on the browser (jupyterlite) version of this notebook
import requests


Expand Down

0 comments on commit 411c94e

Please sign in to comment.