Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update conf.py, sphinx context injection deprecated in ReadTheDocs #383

Merged
merged 3 commits into from
Oct 3, 2024
Merged
Changes from 2 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
8 changes: 8 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@

# -- Options for HTML output -------------------------------------------

# Set canonical URL from the Read the Docs Domain
html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "")
Comment on lines +123 to +124
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Should I change this line to not use an empty string as the default, but instead show image.dask.org, like this?
html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "image.dask.org")

After reading this doc page, it sounds like RTD checks the domains listed in the RTD settings, which is just image.dask.org (as seen below)

Screenshot 2024-09-24 at 9 35 39 PM

Then passes it in as the environment variable READTHEDOCS_CANONICAL_URL, which we pick up on the code line above

While we could change the fallback default, it is sounds like

  1. Sounds like RTD does the right for us
  2. Having a default that smokes out any issues (like empty string does) is useful
  3. DRY

Think for these reasons having the setting in one place should work for us and keep maintenance straightforward

Though do appreciate this question and the exercise of thinking through it was helpful


html_context = {}
# Tell Jinja2 templates the build is running on Read the Docs
if os.environ.get("READTHEDOCS", "") == "True":
html_context["READTHEDOCS"] = True
GenevieveBuckley marked this conversation as resolved.
Show resolved Hide resolved
jakirkham marked this conversation as resolved.
Show resolved Hide resolved

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'dask_sphinx_theme'
Expand Down