diff --git a/.netlify/_redirects b/.netlify/_redirects
deleted file mode 100644
index 228bdc03..00000000
--- a/.netlify/_redirects
+++ /dev/null
@@ -1,71 +0,0 @@
-/0.1.0/doc/* https://docs.rs/pyo3/0.1.0/:splat
-/0.2.0/doc/* https://docs.rs/pyo3/0.2.0/:splat
-/0.2.1/doc/* https://docs.rs/pyo3/0.2.1/:splat
-/0.2.2/doc/* https://docs.rs/pyo3/0.2.2/:splat
-/pyo3-derive-backend-0.6.0/doc/* https://docs.rs/pyo3/pyo3-derive-backend-0.6.0/:splat
-/v0.10.0/doc/* https://docs.rs/pyo3/0.10.0/:splat
-/v0.10.1/doc/* https://docs.rs/pyo3/0.10.1/:splat
-/v0.11.0/doc/* https://docs.rs/pyo3/0.11.0/:splat
-/v0.11.1/doc/* https://docs.rs/pyo3/0.11.1/:splat
-/v0.12.0/doc/* https://docs.rs/pyo3/0.12.0/:splat
-/v0.12.1/doc/* https://docs.rs/pyo3/0.12.1/:splat
-/v0.12.2/doc/* https://docs.rs/pyo3/0.12.2/:splat
-/v0.12.3/doc/* https://docs.rs/pyo3/0.12.3/:splat
-/v0.12.4/doc/* https://docs.rs/pyo3/0.12.4/:splat
-/v0.13.0/doc/* https://docs.rs/pyo3/0.13.0/:splat
-/v0.13.1/doc/* https://docs.rs/pyo3/0.13.1/:splat
-/v0.13.2/doc/* https://docs.rs/pyo3/0.13.2/:splat
-/v0.14.0/doc/* https://docs.rs/pyo3/0.14.0/:splat
-/v0.14.1/doc/* https://docs.rs/pyo3/0.14.1/:splat
-/v0.14.2/doc/* https://docs.rs/pyo3/0.14.2/:splat
-/v0.14.3/doc/* https://docs.rs/pyo3/0.14.3/:splat
-/v0.14.4/doc/* https://docs.rs/pyo3/0.14.4/:splat
-/v0.14.5/doc/* https://docs.rs/pyo3/0.14.5/:splat
-/v0.15.0/doc/* https://docs.rs/pyo3/0.15.0/:splat
-/v0.15.1/doc/* https://docs.rs/pyo3/0.15.1/:splat
-/v0.15.2/doc/* https://docs.rs/pyo3/0.15.2/:splat
-/v0.16.0/doc/* https://docs.rs/pyo3/0.16.0/:splat
-/v0.16.1/doc/* https://docs.rs/pyo3/0.16.1/:splat
-/v0.16.2/doc/* https://docs.rs/pyo3/0.16.2/:splat
-/v0.16.3/doc/* https://docs.rs/pyo3/0.16.3/:splat
-/v0.16.4/doc/* https://docs.rs/pyo3/0.16.4/:splat
-/v0.16.5/doc/* https://docs.rs/pyo3/0.16.5/:splat
-/v0.16.6/doc/* https://docs.rs/pyo3/0.16.6/:splat
-/v0.17.0/doc/* https://docs.rs/pyo3/0.17.0/:splat
-/v0.17.1/doc/* https://docs.rs/pyo3/0.17.1/:splat
-/v0.17.2/doc/* https://docs.rs/pyo3/0.17.2/:splat
-/v0.17.3/doc/* https://docs.rs/pyo3/0.17.3/:splat
-/v0.2.3/doc/* https://docs.rs/pyo3/0.2.3/:splat
-/v0.2.4/doc/* https://docs.rs/pyo3/0.2.4/:splat
-/v0.2.5/doc/* https://docs.rs/pyo3/0.2.5/:splat
-/v0.2.6/doc/* https://docs.rs/pyo3/0.2.6/:splat
-/v0.2.7/doc/* https://docs.rs/pyo3/0.2.7/:splat
-/v0.3.0/doc/* https://docs.rs/pyo3/0.3.0/:splat
-/v0.3.1/doc/* https://docs.rs/pyo3/0.3.1/:splat
-/v0.3.2/doc/* https://docs.rs/pyo3/0.3.2/:splat
-/v0.4.0/doc/* https://docs.rs/pyo3/0.4.0/:splat
-/v0.4.1/doc/* https://docs.rs/pyo3/0.4.1/:splat
-/v0.5.0/doc/* https://docs.rs/pyo3/0.5.0/:splat
-/v0.5.0-alpha.2/doc/* https://docs.rs/pyo3/0.5.0-alpha.2/:splat
-/v0.5.0-alpha.3/doc/* https://docs.rs/pyo3/0.5.0-alpha.3/:splat
-/v0.5.1/doc/* https://docs.rs/pyo3/0.5.1/:splat
-/v0.5.2/doc/* https://docs.rs/pyo3/0.5.2/:splat
-/v0.5.3/doc/* https://docs.rs/pyo3/0.5.3/:splat
-/v0.5.4/doc/* https://docs.rs/pyo3/0.5.4/:splat
-/v0.6.0/doc/* https://docs.rs/pyo3/0.6.0/:splat
-/v0.6.0-alpha.1/doc/* https://docs.rs/pyo3/0.6.0-alpha.1/:splat
-/v0.6.0-alpha.2/doc/* https://docs.rs/pyo3/0.6.0-alpha.2/:splat
-/v0.6.0-alpha.3/doc/* https://docs.rs/pyo3/0.6.0-alpha.3/:splat
-/v0.6.0-alpha.4/doc/* https://docs.rs/pyo3/0.6.0-alpha.4/:splat
-/v0.7.0/doc/* https://docs.rs/pyo3/0.7.0/:splat
-/v0.7.0-alpha.1/doc/* https://docs.rs/pyo3/0.7.0-alpha.1/:splat
-/v0.8.0/doc/* https://docs.rs/pyo3/0.8.0/:splat
-/v0.8.1/doc/* https://docs.rs/pyo3/0.8.1/:splat
-/v0.8.2/doc/* https://docs.rs/pyo3/0.8.2/:splat
-/v0.8.3/doc/* https://docs.rs/pyo3/0.8.3/:splat
-/v0.8.4/doc/* https://docs.rs/pyo3/0.8.4/:splat
-/v0.8.5/doc/* https://docs.rs/pyo3/0.8.5/:splat
-/v0.9.0/doc/* https://docs.rs/pyo3/0.9.0/:splat
-/v0.9.0-alpha.1/doc/* https://docs.rs/pyo3/0.9.0-alpha.1/:splat
-/v0.9.1/doc/* https://docs.rs/pyo3/0.9.1/:splat
-/v0.9.2/doc/* https://docs.rs/pyo3/0.9.2/:splat
diff --git a/.netlify/build.sh b/.netlify/build.sh
index 737c2640..7ff52bb3 100755
--- a/.netlify/build.sh
+++ b/.netlify/build.sh
@@ -16,18 +16,20 @@ mv pyo3-gh-pages netlify_build
## Configure netlify _redirects file
-# TODO: have some better system to automatically generate this on build rather
-# than check this in to the repo
-cp .netlify/_redirects netlify_build/
+# Add redirect for each documented version
+for d in netlify_build/v*; do
+ version="${d/netlify_build\/v/}"
+ echo "/v$version/doc/* https://docs.rs/pyo3/$version/:splat" >> netlify_build/_redirects
+done
# Add latest redirect
echo "/latest/* /v${PYO3_VERSION}/:splat" >> netlify_build/_redirects
## Add landing page redirect
if [ "${CONTEXT}" == "deploy-preview" ]; then
- echo "" > netlify_build/index.html
+ echo "/ /main/" >> netlify_build/_redirects
else
- echo "" > netlify_build/index.html
+ echo "/ /v${PYO3_VERSION}/>" >> netlify_build/_redirects
fi
## Generate towncrier release notes
diff --git a/.netlify/create_redirects.py b/.netlify/create_redirects.py
deleted file mode 100755
index c4f5834c..00000000
--- a/.netlify/create_redirects.py
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env python
-"""Generates _redirects file for netlify.
-
-Run this and write output to .netlify/_redirects and check into
-the PyO3 repository.
-"""
-
-import subprocess
-
-
-def main() -> None:
- versions = subprocess.check_output(["git", "tag"], text=True).splitlines()
- for version in versions:
- version_without_v = version.lstrip("v")
- # redirect doc requests to docs.rs
- print(f"/{version}/doc/* https://docs.rs/pyo3/{version_without_v}/:splat")
-
-
-if __name__ == "__main__":
- main()
diff --git a/Releasing.md b/Releasing.md
index 8f7b39de..29abdd5f 100644
--- a/Releasing.md
+++ b/Releasing.md
@@ -13,9 +13,7 @@ Follow the process below to update all required pieces to bump the version. All
- `pre-script.rhai` templates for the examples.
- `[towncrier]` section in `pyproject.toml`.
- Places where you need to be a bit careful:
- - Add _new_ lines to the netlify `_redirects` file rather than replacing the existing ones.
- - Make sure not to modify the CHANGELOG during this step!
+ Make sure not to modify the CHANGELOG during this step!
2. Run `towncrier build` to generate the CHANGELOG. The version used by `towncrier` should automatically be correct because of the update to `pyproject.toml` in step 1.