DSPy: The framework for programming—not prompting—language models
Python
fix: preserve versioned docs trailing slashes (#10448)
Isaac Miller2a4c92160273
diff --git a/docs/scripts/publish_versioned_docs.py b/docs/scripts/publish_versioned_docs.pyindex 48a4abf5a..2b0a4f820 100644--- a/docs/scripts/publish_versioned_docs.py+++ b/docs/scripts/publish_versioned_docs.py@@ -22,7 +22,18 @@ HOST_CONFIG = ("framework": None,"buildCommand": "true","outputDirectory": ".",- "trailingSlash": True,+ "redirects": [+ {+ "source": "/:version(\\d+\\.\\d+(?:\\.\\d+(?:(?:a|b|rc)\\d+)?)?)",+ "destination": "/:version/",+ "permanent": True,+ },+ {+ "source": "/:path((?:.*/)?[^./]+)",+ "destination": "/:path/",+ "permanent": True,+ },+ ],"headers": [{"source": "/(.*).md",diff --git a/tests/docs/test_versioned_docs.py b/tests/docs/test_versioned_docs.pyindex be299674c..d78d24d5b 100644--- a/tests/docs/test_versioned_docs.py+++ b/tests/docs/test_versioned_docs.py@@ -214,6 +214,19 @@ def test_mike_current_is_mutable_and_default(tmp_path):assert host_config["framework"] is Noneassert host_config["buildCommand"] == "true"assert host_config["outputDirectory"] == "."+ assert host_config["redirects"] == [+ {+ "source": r"/:version(\d+\.\d+(?:\.\d+(?:(?:a|b|rc)\d+)?)?)",+ "destination": "/:version/",+ "permanent": True,+ },+ {+ "source": "/:path((?:.*/)?[^./]+)",+ "destination": "/:path/",+ "permanent": True,+ },+ ]+ assert "trailingSlash" not in host_configproduction_inventory = subprocess.run(["git", "cat-file", "-e", "master:versions.json"], cwd=repository, capture_output=True)