-
Notifications
You must be signed in to change notification settings - Fork 138
Description
I received an e-mail from readthedocs announcing the deprecation of Sphinx context injection at build time for all the projects. The deprecation date is set on Monday, October 7th, 2024. After this date, Read the Docs won't install the readthedocs-sphinx-ext
extension and won't manipulate the project's conf.py
file.
More details on their blog post on the deprecation.
Details from the e-mail:
Are my projects affected?
You have at least one project with a canonical custom domain defined. After the deprecation date, Read the Docs will stop defining html_baseurl Sphinx configuration, which means that you will need to define it by yourself to keep the canonical custom domain properly configured.
We found the following projects where you are a maintainer are impacted by this change:
How I can update my projects?
You can use the following Python snippet as a guide to update your conf.py file. The snippet uses the READTHEDOCS_CANONICAL_URL environment variable to define html_baseurl and injects READTHEDOCS variable into the html_context to keep the previous behavior:
import os # Set canonical URL from the Read the Docs Domain html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "") # Tell Jinja2 templates the build is running on Read the Docs if os.environ.get("READTHEDOCS", "") == "True": html_context["READTHEDOCS"] = True