Skip to content

Commit 00294a0

Browse files
authored
Reduce Binder cold‑start times and stabilize builds (#8)
* Pin heavy geo deps in env.yaml (numpy, gdal, rasterio, rioxarray, geopandas, shapely, xarray) * Install package during build via pip in env.yml * Repo-level .condarc (conda-forge, channel_priority=strict, show_channel_urls) * Remove binder/postBuild and dev.pixi.toml (unused) * Edited (removed and added) Binder warmup workflow (push to main, weekly 03:00 UTC, manual)
1 parent 8643240 commit 00294a0

File tree

7 files changed

+54
-86
lines changed

7 files changed

+54
-86
lines changed

.condarc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
channels:
2+
- conda-forge
3+
channel_priority: strict
4+
show_channel_urls: true

.github/workflows/binder-cache.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Binder cache warmup
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
schedule:
7+
- cron: "0 3 * * 0" # weekly, Sunday 03:00 UTC
8+
workflow_dispatch:
9+
10+
jobs:
11+
warmup:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Trigger mybinder.org build
16+
run: |
17+
set -eux
18+
REF="${{ github.ref_name }}"
19+
if [ -z "$REF" ] || [ "$REF" = "refs/heads/" ]; then REF="main"; fi
20+
curl -LsS -o /dev/null -w "%{http_code}\n" \
21+
"https://mybinder.org/build/gh/${{ github.repository }}/$REF" || true

README.md

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,43 @@ Many thanks to banesullivan's [localtileserver](https://github.com/banesullivan/
1616
<img src="https://mybinder.org/badge_logo.svg" alt="Launch on Binder" height="28">
1717
</a>
1818

19-
What happens when you click the button (suggested to right click -> open in new tab):
20-
- A temporary, free session is launched on mybinder.org (a community, shared service) that builds a Docker image from this repo’s environment files.
21-
- First launch after a change can take several minutes while the image builds. Subsequent launches are faster (cached), but caches may be evicted at any time.
22-
- Sessions are ephemeral (typically 1–2 hours) and resources are limited. Your session will shut down if idle or when it times out.
19+
What happens when you click the button:
20+
- mybinder.org uses repo2docker to build a Docker image for this repo using binder/environment.yml and runtime.txt (Python 3.11 base)
21+
- The conda environment is solved/installed with mamba from conda-forge; during the build, pip installs this repo in editable mode (-e .)
22+
- The built image is cached by mybinder.org for the given Git ref; first builds can take several minutes, later builds are usually faster until the cache is evicted
23+
- Sessions are ephemeral and resource-limited; they time out when idle (~10 mins) or after a short lifetime
2324

2425
## Notes and expectations
2526

2627
- First launch: building can take several minutes; please be patient.
27-
- If you see Building or Pending, Binder is queuing your session or compiling the environment.
28+
- If you see "Building' or "Pending," Binder is queuing your session or compiling the environment.
2829
- If tiles don’t appear immediately after "Fetch & Display Data," wait a few seconds.
30+
- Don't sample large areas -- this will drop performace. Less than 30km2 is a good bet.
2931
- The app depends on external open data services; occasional slowdowns or gaps can occur.
3032

3133
## What you can do
3234

3335
- Pick a date range, draw an Area of Interest (blue) on the map, then click "Fetch & Display Data."
3436
- Toggle layers in the layer control:
3537
- RGB composite (Sentinel‑2) [lowest cloud coverage in date range is selected]
36-
- NDVI and a basic built-up index [lowest cloud coverage in date range is selected]
3738
- SAR backscatter (Sentinel‑1) [acquisition closest to Sentinel-2 image is selected]
39+
- Coopernicus 30-GLO DEM Multidirectional Hillshade
3840
- ESA WorldCover (classified land cover) [2021]
3941
- Draw a red Region of Interest (ROI) to sample statistics from visible layers.
4042

4143
## How it works (high level)
4244

43-
- You draw an area; the app searches a STAC catalog (Microsoft Planetary Computer) for relevant items.
44-
- It selects a recent, low‑cloud Sentinel‑2 scene and optionally a time‑aligned Sentinel‑1 scene.
45-
- On the fly, it computes quicklook products (RGB, NDVI, built‑up index), and prepares tiles from in‑memory COGs.
46-
- Tiles are served inside the session and displayed via ipyleaflet (no data leaves your browser other than tile requests to the Binder session)
45+
- You draw an area; the app searches the Microsoft Planetary Computer STAC API for relevant items
46+
- It selects a low‑cloud Sentinel‑2 scene and a time‑aligned Sentinel‑1 scene
47+
- It computes quicklook products:
48+
- Sentinel‑2 RGB
49+
- Sentinel‑1 VV/VH in decibels
50+
- Multidirectional hillshade from Copernicus GLO‑30
51+
- ESA WorldCover mapped to RGB colors
52+
- Rasters are written to in‑memory COGs and served by localtileserver running in your Binder session.
53+
- ipyleaflet requests tiles via Jupyter Server Proxy (e.g., /proxy/{port}); the browser only talks to the Binder pod, while the pod fetches data from the Planetary Computer.
54+
55+
> **_NOTE:_** All layers / STAC endpoints are oprtional
4756
4857
## Contributing
4958

@@ -56,4 +65,4 @@ What happens when you click the button (suggested to right click -> open in new
5665
- Conda/mamba: create an environment similar to binder/environment.yml, then `pip install -e .`
5766
- Or use your own stack and ensure GDAL/Rasterio/PROJ are consistent.
5867
- Run notebooks locally with JupyterLab or launch the Voila app:
59-
- `voila notebooks/app.ipynb
68+
- `voila notebooks/app.ipynb`

binder/environment.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@ dependencies:
88
- voila
99
- ipywidgets
1010
- ipyleaflet
11-
- numpy
11+
- numpy=2.3.*
1212
- pandas
13-
- xarray
14-
- geopandas
15-
- rioxarray
16-
- rasterio
17-
- shapely
13+
- xarray=2025.10.*
14+
- geopandas=1.1.*
15+
- rioxarray=0.19.*
16+
- rasterio=1.4.*
17+
- shapely=2.1.*
18+
- gdal=3.10.*
1819
- matplotlib
1920
- odc-stac
2021
- pystac-client
2122
- planetary-computer
2223
- localtileserver
2324
- jupyter-server-proxy
25+
- pip:
26+
- -e ..

binder/postBuild

Lines changed: 0 additions & 10 deletions
This file was deleted.

dev.pixi.toml

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)