From 9177a2e8a7b7ce687726d8cce5e836c2b040c4ca Mon Sep 17 00:00:00 2001 From: Vinta Chen Date: Wed, 21 Oct 2026 22:44:16 +0800 Subject: [PATCH] fix: link full project names in intro picks that matched only part Nine picks, such as "OpenAI Agents SDK", "MCP Python SDK", and "Jupyter Notebook", linked only part of the name or nothing, because the README lists those projects under their PyPI or repo names. The punctuation-guard test used "The Algorithms - Python", which now matches its alias in full, so it uses a made-up name instead. Co-Authored-By: Claude --- website/build.py | 11 ++++++++++- website/tests/test_build.py | 6 +++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/website/build.py b/website/build.py index a99df5af..5078421c 100755 --- a/website/build.py +++ b/website/build.py @@ -47,23 +47,32 @@ PICK_ALIASES = { "Cacheops": "django-cacheops", "Chroma": "chromadb", "Coverage.py": "coverage", + "Django AI Skills": "django-ai-plugins", + "Django ORM": "django.db.models", "Faiss": "faiss-cpu", "gRPC": "grpcio", + "Google Cloud client libraries": "google-cloud-python", "Grappelli": "django-grappelli", "Hydra": "hydra-core", "Ibis": "ibis-framework", + "Jupyter Notebook": "notebook", "Material for MkDocs": "mkdocs-material", + "MCP Python SDK": "mcp", "Odoo Community": "odoo", "Odoo Enterprise": "odoo", "Odoo Online": "odoo", + "OpenAI Agents SDK": "openai-agents", "OpenCV": "opencv-python", "Playwright": "playwright-python", "PyAV": "av", + "Python-Markdown": "markdown", "python-oracledb": "oracledb", "Ray Core": "ray", + "redis-py": "redis", "Sherlock": "sherlock-project", "Silk": "django-silk", "Surprise": "scikit-surprise", + "The Algorithms - Python": "thealgorithms", "Unfold": "django-unfold", "Vega-Altair": "altair", } @@ -309,7 +318,7 @@ def link_pick_names(pick: str, slugs_by_key: dict[str, str]) -> str: start, end = words[i].start(), words[j - 1].end() span = pick[start:end] slug = slugs_by_key.get(entry_name_key(span)) - # Code spans and dangling punctuation like "The Algorithms -" stay outside links + # Code spans and dangling punctuation like "Django -" stay outside links if slug and span[0].isalnum() and span[-1].isalnum() and "," not in span and "`" not in span: parts.append(f"{pick[pos:start]}[{span}](#entry-{slug})") pos, i = end, j diff --git a/website/tests/test_build.py b/website/tests/test_build.py index 4453ac44..e567c84b 100644 --- a/website/tests/test_build.py +++ b/website/tests/test_build.py @@ -1686,12 +1686,12 @@ class TestLoadCategoryIntro: def test_links_picks_to_entry_rows(self, tmp_path): path = tmp_path / "widgets.md" path.write_text( - "Use w1.\n\nHow to choose:\n\n- Small apps: Django Ninja, or `uv tool` on uv\n- Big apps: Django\n- Old apps: The Algorithms - Python\n\nSee [w1](https://w1.example).\n", encoding="utf-8" + "Use w1.\n\nHow to choose:\n\n- Small apps: Django Ninja, or `uv tool` on uv\n- Big apps: Django\n- Old apps: Django - LTS releases\n\nSee [w1](https://w1.example).\n", encoding="utf-8" ) - intro_html, guide_html, _, _ = load_category_intro(path, ["django-ninja", "Django", "uv", "TheAlgorithms"]) + intro_html, guide_html, _, _ = load_category_intro(path, ["django-ninja", "Django", "uv"]) assert '
  • Small apps: Django Ninja, or uv tool on uv
  • ' in intro_html assert '
  • Big apps: Django
  • ' in intro_html - assert '
  • Old apps: The Algorithms - Python
  • ' in intro_html + assert '
  • Old apps: Django - LTS releases
  • ' in intro_html assert 'w1' in guide_html def test_links_pick_aliases_to_entry_rows(self, tmp_path):