Skip to content

Commit a07ea45

Browse files
committed
feat: script to check all examples in doc/python.
- Updates `pyproject.toml` to install packages previously listed in `doc/requirements.txt`. - Removes `doc/requirements.txt`. - Run `python bin/check-all-md.py doc/python/*.md` to re-run all examples.
1 parent 20c60ef commit a07ea45

File tree

4 files changed

+984
-135
lines changed

4 files changed

+984
-135
lines changed

bin/check-all-md.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from pathlib import Path
2+
import os
3+
import re
4+
import sys
5+
6+
PAT = re.compile(r"^```python\n(.+?)\n```", re.MULTILINE | re.DOTALL)
7+
TMP_FILE = "tmp.py"
8+
9+
for filename in sys.argv[1:]:
10+
content = Path(filename).read_text()
11+
blocks = PAT.findall(content)
12+
for i, b in enumerate(blocks):
13+
Path(TMP_FILE).write_text(b.strip())
14+
sys.stdout.write(f"\n{'=' * 40}\n{filename}: {i}\n")
15+
sys.stdout.flush()
16+
sys.stdout.write(f"{'-' * 40}\n")
17+
sys.stdout.flush()
18+
os.system(f"python {TMP_FILE} > /dev/null")

doc/requirements.txt

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

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,13 @@ dev_optional = [
6363
"plotly[kaleido]",
6464
"anywidget",
6565
"colorcet",
66+
"dash_bio",
67+
"datashader",
6668
# fiona>1.9.6 is not compatible with geopandas<1; geopandas>=1 is not compatible with python 3.8
6769
"fiona<=1.9.6;python_version<='3.8'",
6870
"geopandas",
71+
"google",
72+
"igraph",
6973
"inflect",
7074
"numpy",
7175
"orjson",
@@ -74,15 +78,19 @@ dev_optional = [
7478
"pillow",
7579
"plotly-geo",
7680
"polars[timezone]",
81+
"pooch",
7782
"pyarrow",
7883
"pydoclint",
7984
"pyshp",
8085
"pytz",
8186
"scikit-image",
87+
"scikit-learn",
8288
"scipy",
8389
"shapely",
8490
"statsmodels",
91+
"umap",
8592
"vaex;python_version<='3.9'",
93+
"wget",
8694
"xarray"
8795
]
8896
dev = [

0 commit comments

Comments
 (0)