From b596bf8a3983e1d20bafd4024bb29c65da3d6fb0 Mon Sep 17 00:00:00 2001 From: Saransh Chopra Date: Tue, 10 Sep 2024 14:29:35 +0100 Subject: [PATCH] add note for requests and bash --- .github/workflows/build_site.yml | 2 +- ch00git/01Intro.ipynb.py | 5 +++++ ch00git/02Solo.ipynb.py | 5 +++++ ch00git/03Mistakes.ipynb.py | 5 +++++ ch00git/04Publishing.ipynb.py | 5 +++++ ch00git/05Collaboration.ipynb.py | 7 ++++++- ch00git/10Branches.ipynb.py | 6 +++++- ch00git/11Miscellany.ipynb.py | 5 +++++ ch00git/12Remotes.ipynb.py | 6 +++++- ch00git/14Bisect.ipynb.py | 6 +++++- ch01python/00pythons.ipynb.py | 1 + ch01python/010exemplar.ipynb.py | 3 +++ ch02data/061internet.ipynb.py | 2 ++ ch02data/063tabular.ipynb.py | 2 ++ ch02data/066QuakeExercise.ipynb.py | 2 ++ ch02data/068QuakesSolution.ipynb.py | 2 ++ ch02data/110Capstone.ipynb.py | 7 +++++++ ch03tests/03pytest.ipynb.py | 6 +++++- ch03tests/05Mocks.ipynb.py | 2 ++ .../{01Libraries.ipynb.py => 010Libraries.ipynb.py} | 0 .../{010Installation.ipynb.py => 01Installation.ipynb.py} | 3 +++ ch04packaging/04documentation.ipynb.py | 2 +- ch05construction/08objects.ipynb.py | 2 ++ ch05construction/09patterns.ipynb.py | 3 +++ 24 files changed, 82 insertions(+), 7 deletions(-) rename ch04packaging/{01Libraries.ipynb.py => 010Libraries.ipynb.py} (100%) rename ch04packaging/{010Installation.ipynb.py => 01Installation.ipynb.py} (97%) diff --git a/.github/workflows/build_site.yml b/.github/workflows/build_site.yml index db280e1d..8974b722 100644 --- a/.github/workflows/build_site.yml +++ b/.github/workflows/build_site.yml @@ -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 diff --git a/ch00git/01Intro.ipynb.py b/ch00git/01Intro.ipynb.py index 9b4db13f..337faa62 100644 --- a/ch00git/01Intro.ipynb.py +++ b/ch00git/01Intro.ipynb.py @@ -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 diff --git a/ch00git/02Solo.ipynb.py b/ch00git/02Solo.ipynb.py index 3f04a89b..a0bec1f7 100644 --- a/ch00git/02Solo.ipynb.py +++ b/ch00git/02Solo.ipynb.py @@ -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: diff --git a/ch00git/03Mistakes.ipynb.py b/ch00git/03Mistakes.ipynb.py index d33fee0a..59821275 100644 --- a/ch00git/03Mistakes.ipynb.py +++ b/ch00git/03Mistakes.ipynb.py @@ -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: diff --git a/ch00git/04Publishing.ipynb.py b/ch00git/04Publishing.ipynb.py index b6e8933f..fe302500 100644 --- a/ch00git/04Publishing.ipynb.py +++ b/ch00git/04Publishing.ipynb.py @@ -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: diff --git a/ch00git/05Collaboration.ipynb.py b/ch00git/05Collaboration.ipynb.py index 5aa6220b..224c9ecf 100644 --- a/ch00git/05Collaboration.ipynb.py +++ b/ch00git/05Collaboration.ipynb.py @@ -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] diff --git a/ch00git/10Branches.ipynb.py b/ch00git/10Branches.ipynb.py index f0740ecf..b5604873 100644 --- a/ch00git/10Branches.ipynb.py +++ b/ch00git/10Branches.ipynb.py @@ -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, diff --git a/ch00git/11Miscellany.ipynb.py b/ch00git/11Miscellany.ipynb.py index ccfc324e..8805c68e 100644 --- a/ch00git/11Miscellany.ipynb.py +++ b/ch00git/11Miscellany.ipynb.py @@ -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: diff --git a/ch00git/12Remotes.ipynb.py b/ch00git/12Remotes.ipynb.py index bca1ca24..ce3f2b9d 100644 --- a/ch00git/12Remotes.ipynb.py +++ b/ch00git/12Remotes.ipynb.py @@ -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, diff --git a/ch00git/14Bisect.ipynb.py b/ch00git/14Bisect.ipynb.py index e1c8aa22..bace9a06 100644 --- a/ch00git/14Bisect.ipynb.py +++ b/ch00git/14Bisect.ipynb.py @@ -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 diff --git a/ch01python/00pythons.ipynb.py b/ch01python/00pythons.ipynb.py index 43365bf8..a9954322 100644 --- a/ch01python/00pythons.ipynb.py +++ b/ch01python/00pythons.ipynb.py @@ -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() diff --git a/ch01python/010exemplar.ipynb.py b/ch01python/010exemplar.ipynb.py index 27c4cbe1..2a1c6246 100644 --- a/ch01python/010exemplar.ipynb.py +++ b/ch01python/010exemplar.ipynb.py @@ -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 diff --git a/ch02data/061internet.ipynb.py b/ch02data/061internet.ipynb.py index f72ae481..948795fa 100644 --- a/ch02data/061internet.ipynb.py +++ b/ch02data/061internet.ipynb.py @@ -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] diff --git a/ch02data/063tabular.ipynb.py b/ch02data/063tabular.ipynb.py index fc74ad0a..4a31c7f6 100644 --- a/ch02data/063tabular.ipynb.py +++ b/ch02data/063tabular.ipynb.py @@ -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 diff --git a/ch02data/066QuakeExercise.ipynb.py b/ch02data/066QuakeExercise.ipynb.py index 473e92cd..bb1586ee 100644 --- a/ch02data/066QuakeExercise.ipynb.py +++ b/ch02data/066QuakeExercise.ipynb.py @@ -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 URL and to deal with sending the HTTP 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] diff --git a/ch02data/068QuakesSolution.ipynb.py b/ch02data/068QuakesSolution.ipynb.py index a6332da6..1046b174 100644 --- a/ch02data/068QuakesSolution.ipynb.py +++ b/ch02data/068QuakesSolution.ipynb.py @@ -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 diff --git a/ch02data/110Capstone.ipynb.py b/ch02data/110Capstone.ipynb.py index 45396f1c..6f175034 100644 --- a/ch02data/110Capstone.ipynb.py +++ b/ch02data/110Capstone.ipynb.py @@ -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 @@ -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): diff --git a/ch03tests/03pytest.ipynb.py b/ch03tests/03pytest.ipynb.py index 1a6373c2..72823ac1 100644 --- a/ch03tests/03pytest.ipynb.py +++ b/ch03tests/03pytest.ipynb.py @@ -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] diff --git a/ch03tests/05Mocks.ipynb.py b/ch03tests/05Mocks.ipynb.py index 87da8836..b77058f2 100644 --- a/ch03tests/05Mocks.ipynb.py +++ b/ch03tests/05Mocks.ipynb.py @@ -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, diff --git a/ch04packaging/01Libraries.ipynb.py b/ch04packaging/010Libraries.ipynb.py similarity index 100% rename from ch04packaging/01Libraries.ipynb.py rename to ch04packaging/010Libraries.ipynb.py diff --git a/ch04packaging/010Installation.ipynb.py b/ch04packaging/01Installation.ipynb.py similarity index 97% rename from ch04packaging/010Installation.ipynb.py rename to ch04packaging/01Installation.ipynb.py index db50e0f1..99ef7716 100644 --- a/ch04packaging/010Installation.ipynb.py +++ b/ch04packaging/01Installation.ipynb.py @@ -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 diff --git a/ch04packaging/04documentation.ipynb.py b/ch04packaging/04documentation.ipynb.py index 79cd092d..a57283d9 100644 --- a/ch04packaging/04documentation.ipynb.py +++ b/ch04packaging/04documentation.ipynb.py @@ -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 diff --git a/ch05construction/08objects.ipynb.py b/ch05construction/08objects.ipynb.py index 5c200c83..de598607 100644 --- a/ch05construction/08objects.ipynb.py +++ b/ch05construction/08objects.ipynb.py @@ -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 diff --git a/ch05construction/09patterns.ipynb.py b/ch05construction/09patterns.ipynb.py index 2e17ed50..f61ebc42 100644 --- a/ch05construction/09patterns.ipynb.py +++ b/ch05construction/09patterns.ipynb.py @@ -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