Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,8 @@ jobs:
env:
SKIP: no-commit-to-branch

# test notebooks in parallel across 3 jobs with GNU parallel
- name: Test notebooks
run: |
cd ./notebooks
mkdir -p data images
uv run python -c "import osmnx; print(osmnx.__version__)"
uv run jupyter nbconvert --to python *.ipynb
parallel -j3 --line-buffer --tag 'uv run ipython {}' ::: *.py
run: cd notebooks && bash run_notebooks.sh

# allow notebooks test runs to fail, but still save partial cache. this
# saves after ordinary failures but not if job is canceled or times out.
Expand Down
29 changes: 29 additions & 0 deletions notebooks/run_notebooks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
set -euo pipefail

export MPLBACKEND="Agg"
CACHE_DIR="./cache"
CACHE_READY_FILE="${CACHE_DIR}/.cache_ready"

# test notebooks serially until the cache is ready, then in parallel
WORKERS=1
if [[ -f "$CACHE_READY_FILE" ]]; then
WORKERS=4
fi

# convert the notebooks to .py files to execute them
uv run jupyter nbconvert --to python *.ipynb
uv run python -c "import osmnx; print(osmnx.__version__)"
mkdir -p data images "$CACHE_DIR"

echo "Running notebooks with ${WORKERS} process(es)."
if (( WORKERS == 1 )); then
for filename in *.py; do
uv run ipython "$filename"
done
else
printf '%s\n' *.py | xargs -n1 -P4 uv run ipython
fi

# mark the cache ready after each fully successful run
touch "$CACHE_READY_FILE"
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ requires-python = ">=3.11"
version = "2.1.0" # match pinned version above

[project.optional-dependencies]
all = ["folium", "jupyterlab", "mapclassify", "igraph"]
examples = ["folium", "jupyterlab", "mapclassify", "igraph"]

[dependency-groups]
dev = ["nbdime", "prek"]
dev = ["ipython", "nbconvert", "nbdime", "prek"]

[tool.ruff]
cache-dir = "~/.cache/prek/ruff"
line-length = 100

[tool.ruff.lint]
extend-select = ["A", "B", "E", "F", "I", "UP", "W"]
extend-select = ["A", "B", "E", "F", "I", "RUF200", "UP", "W"]

[tool.ruff.lint.pycodestyle]
max-line-length = 110 # line length + 10% since it isn't a hard upper bound
54 changes: 29 additions & 25 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.