Skip to content

Commit 0f01099

Browse files
authored
Merge pull request #44 from PyAutoLabs/feature/colab-maturity
feat: url_check forbids unpinned blob/main and workspace chapter Colab URLs
2 parents 904e921 + c86ed7f commit 0f01099

2 files changed

Lines changed: 52 additions & 1 deletion

File tree

heart/checks/url_check.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ ENTRIES=(
2222
# --- original three (Binder / wrong-owner / dead-branch) ---
2323
'mybinder\.org|||mybinder.org URL (Binder is no longer supported — use Colab)'
2424
'colab\.research\.google\.com/github/Jammy2211/|||Colab URL with Jammy2211 owner (use PyAutoLabs)'
25-
'colab\.research\.google\.com/github/[^/]+/[^/]+/blob/release/|||Colab URL pinned to /blob/release/ (use a tagged version or /blob/main/)'
25+
'colab\.research\.google\.com/github/[^/]+/[^/]+/blob/release/|||Colab URL pinned to /blob/release/ (use a date-tagged version)'
26+
27+
# --- Colab URL forms the release bumper cannot maintain ---
28+
# bump_colab_urls.sh only rewrites date-tagged PyAutoLabs URLs, so an
29+
# unpinned /blob/main/ Colab link silently drifts from the released code.
30+
'colab\.research\.google\.com/github/PyAutoLabs/(autofit_workspace|autogalaxy_workspace|autolens_workspace|HowToFit|HowToGalaxy|HowToLens)/blob/main/|||Colab URL pinned to /blob/main/ (use a date-tagged version — the release bumper skips main)'
31+
# Chapter tutorials live in the HowTo repos; workspace-repo chapter paths are dead.
32+
'colab\.research\.google\.com/github/PyAutoLabs/(autofit|autogalaxy|autolens)_workspace/blob/[^/]+/notebooks/chapter_|||Colab URL to notebooks/chapter_* in a workspace repo (chapters live in HowToFit/HowToGalaxy/HowToLens)'
2633

2734
# --- typo ---
2835
'hhttps://|||hhttps:// typo (should be https://)'

tests/test_url_check.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,47 @@ def test_ipynb_files_scanned(tmp_path):
7979
result = run(tmp_path)
8080
assert result.returncode == 1
8181
assert "demo.ipynb" in result.stdout
82+
83+
84+
def test_blob_main_colab_url_fails(tmp_path):
85+
(tmp_path / "README.md").write_text(
86+
"https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_1_introduction/tutorial_1_grids_and_galaxies.ipynb"
87+
)
88+
result = run(tmp_path)
89+
assert result.returncode == 1
90+
assert "release bumper skips main" in result.stdout
91+
92+
93+
def test_blob_main_non_notebook_repo_passes(tmp_path):
94+
# /blob/main/ is only forbidden for the six notebook repos — other repos'
95+
# Colab links (none exist today) are not the bumper's problem.
96+
(tmp_path / "README.md").write_text(
97+
"https://colab.research.google.com/github/PyAutoLabs/PyAutoFit/blob/main/example.ipynb"
98+
)
99+
result = run(tmp_path)
100+
assert result.returncode == 0, result.stdout + result.stderr
101+
102+
103+
def test_workspace_chapter_colab_url_fails(tmp_path):
104+
(tmp_path / "README.md").write_text(
105+
"https://colab.research.google.com/github/PyAutoLabs/autogalaxy_workspace/blob/2026.7.6.649/notebooks/chapter_1_introduction/tutorial_0_visualization.ipynb"
106+
)
107+
result = run(tmp_path)
108+
assert result.returncode == 1
109+
assert "chapters live in HowToFit/HowToGalaxy/HowToLens" in result.stdout
110+
111+
112+
def test_howto_chapter_colab_url_passes(tmp_path):
113+
(tmp_path / "README.md").write_text(
114+
"https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.7.6.649/notebooks/chapter_1_introduction/tutorial_0_visualization.ipynb"
115+
)
116+
result = run(tmp_path)
117+
assert result.returncode == 0, result.stdout + result.stderr
118+
119+
120+
def test_workspace_non_chapter_notebook_passes(tmp_path):
121+
(tmp_path / "README.md").write_text(
122+
"https://colab.research.google.com/github/PyAutoLabs/autolens_workspace/blob/2026.7.6.649/notebooks/imaging/start_here.ipynb"
123+
)
124+
result = run(tmp_path)
125+
assert result.returncode == 0, result.stdout + result.stderr

0 commit comments

Comments
 (0)