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
9 changes: 8 additions & 1 deletion heart/checks/url_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ ENTRIES=(
# --- original three (Binder / wrong-owner / dead-branch) ---
'mybinder\.org|||mybinder.org URL (Binder is no longer supported — use Colab)'
'colab\.research\.google\.com/github/Jammy2211/|||Colab URL with Jammy2211 owner (use PyAutoLabs)'
'colab\.research\.google\.com/github/[^/]+/[^/]+/blob/release/|||Colab URL pinned to /blob/release/ (use a tagged version or /blob/main/)'
'colab\.research\.google\.com/github/[^/]+/[^/]+/blob/release/|||Colab URL pinned to /blob/release/ (use a date-tagged version)'

# --- Colab URL forms the release bumper cannot maintain ---
# bump_colab_urls.sh only rewrites date-tagged PyAutoLabs URLs, so an
# unpinned /blob/main/ Colab link silently drifts from the released code.
'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)'
# Chapter tutorials live in the HowTo repos; workspace-repo chapter paths are dead.
'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)'

# --- typo ---
'hhttps://|||hhttps:// typo (should be https://)'
Expand Down
44 changes: 44 additions & 0 deletions tests/test_url_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,47 @@ def test_ipynb_files_scanned(tmp_path):
result = run(tmp_path)
assert result.returncode == 1
assert "demo.ipynb" in result.stdout


def test_blob_main_colab_url_fails(tmp_path):
(tmp_path / "README.md").write_text(
"https://colab.research.google.com/github/PyAutoLabs/HowToLens/blob/main/notebooks/chapter_1_introduction/tutorial_1_grids_and_galaxies.ipynb"
)
result = run(tmp_path)
assert result.returncode == 1
assert "release bumper skips main" in result.stdout


def test_blob_main_non_notebook_repo_passes(tmp_path):
# /blob/main/ is only forbidden for the six notebook repos — other repos'
# Colab links (none exist today) are not the bumper's problem.
(tmp_path / "README.md").write_text(
"https://colab.research.google.com/github/PyAutoLabs/PyAutoFit/blob/main/example.ipynb"
)
result = run(tmp_path)
assert result.returncode == 0, result.stdout + result.stderr


def test_workspace_chapter_colab_url_fails(tmp_path):
(tmp_path / "README.md").write_text(
"https://colab.research.google.com/github/PyAutoLabs/autogalaxy_workspace/blob/2026.7.6.649/notebooks/chapter_1_introduction/tutorial_0_visualization.ipynb"
)
result = run(tmp_path)
assert result.returncode == 1
assert "chapters live in HowToFit/HowToGalaxy/HowToLens" in result.stdout


def test_howto_chapter_colab_url_passes(tmp_path):
(tmp_path / "README.md").write_text(
"https://colab.research.google.com/github/PyAutoLabs/HowToGalaxy/blob/2026.7.6.649/notebooks/chapter_1_introduction/tutorial_0_visualization.ipynb"
)
result = run(tmp_path)
assert result.returncode == 0, result.stdout + result.stderr


def test_workspace_non_chapter_notebook_passes(tmp_path):
(tmp_path / "README.md").write_text(
"https://colab.research.google.com/github/PyAutoLabs/autolens_workspace/blob/2026.7.6.649/notebooks/imaging/start_here.ipynb"
)
result = run(tmp_path)
assert result.returncode == 0, result.stdout + result.stderr
Loading