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

Build: do not set sphinx_rtd_theme theme automatically #10638

Merged
merged 1 commit into from
Aug 17, 2023

Conversation

humitos
Copy link
Member

@humitos humitos commented Aug 16, 2023

We are not installing sphinx-rtd-theme automatically on new projects. However, we are setting sphinx_rtd_theme automatically on their docs/conf.py.

This PR removes that magic to auto-set the theme and leave the theme to what the user has defined.

We are not installing `sphinx-rtd-theme` automatically on new projects.
However, we are setting `sphinx_rtd_theme` automatically on their
`docs/conf.py`.

This PR removes that magic to auto-set the theme and leave the theme to what
the user has defined.
@ericholscher
Copy link
Member

There's a bunch of stuff in the conf.py override it seems like we can remove (definitelly the "websupport2" stuff, and the source suffix), that won't effect much.

This actually will change the default theme for users without a theme set, but hopefully most users now are defining an html_theme, since Sphinx defaults to one defined, so this won't impact many users.

@humitos humitos merged commit 2066e34 into main Aug 17, 2023
2 checks passed
@humitos humitos deleted the humitos/do-not-set-our-theme-automatically branch August 17, 2023 13:19
humitos added a commit that referenced this pull request Aug 17, 2023
We are not using this anymore.

Related #10638
@humitos
Copy link
Member Author

humitos commented Aug 17, 2023

There's a bunch of stuff in the conf.py override it seems like we can remove (definitelly the "websupport2" stuff, and the source suffix), that won't effect much.

I opened a PR to remove websupport2 at #10646. We cannot remove the source_suffix for now because it's being used in our readthedocs-sphinx-ext at https://github.com/rtfd/readthedocs-sphinx-ext/blob/7c60d1646c12ac0b83d61abfbdd5bcd77d324124/readthedocs_ext/readthedocs.py#L155

However, I'm 👍🏼 on review all the context we are creating all around this and gradually migrate it to the new addons. That way, we will moving forward to the new implementation and figure it out what are the things we may be missing there.

humitos added a commit that referenced this pull request Aug 17, 2023
* Build: drop `websupport2` support from `conf.py` template

We are not using this anymore.

Related #10638

* JS assets: remove `websupport2-bundle.js`
humitos added a commit that referenced this pull request Aug 22, 2023
humitos added a commit that referenced this pull request Aug 22, 2023
humitos added a commit that referenced this pull request Aug 22, 2023
@jpmckinney
Copy link

This is causing build errors

Running Sphinx v7.2.2

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/pelican-frontend/envs/latest/lib/python3.11/site-packages/sphinx/config.py", line 358, in eval_config_file
    exec(code, namespace)  # NoQA: S102
    ^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/pelican-frontend/checkouts/latest/docs/conf.py", line 138, in <module>
    'using_theme': using_rtd_theme,
                   ^^^^^^^^^^^^^^^
NameError: name 'using_rtd_theme' is not defined

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/pelican-frontend/envs/latest/lib/python3.11/site-packages/sphinx/cmd/build.py", line 293, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/pelican-frontend/envs/latest/lib/python3.11/site-packages/sphinx/application.py", line 211, in __init__
    self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/pelican-frontend/envs/latest/lib/python3.11/site-packages/sphinx/config.py", line 181, in read
    namespace = eval_config_file(filename, tags)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/pelican-frontend/envs/latest/lib/python3.11/site-packages/sphinx/config.py", line 371, in eval_config_file
    raise ConfigError(msg % traceback.format_exc()) from exc
sphinx.errors.ConfigError: There is a programmable error in your configuration file:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/pelican-frontend/envs/latest/lib/python3.11/site-packages/sphinx/config.py", line 358, in eval_config_file
    exec(code, namespace)  # NoQA: S102
    ^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/pelican-frontend/checkouts/latest/docs/conf.py", line 138, in <module>
    'using_theme': using_rtd_theme,
                   ^^^^^^^^^^^^^^^
NameError: name 'using_rtd_theme' is not defined


Configuration error:
There is a programmable error in your configuration file:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/pelican-frontend/envs/latest/lib/python3.11/site-packages/sphinx/config.py", line 358, in eval_config_file
    exec(code, namespace)  # NoQA: S102
    ^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/pelican-frontend/checkouts/latest/docs/conf.py", line 138, in <module>
    'using_theme': using_rtd_theme,
                   ^^^^^^^^^^^^^^^
NameError: name 'using_rtd_theme' is not defined

@humitos
Copy link
Member Author

humitos commented Aug 22, 2023

@jpmckinney Thanks. Yeah, we saw that and we just fixed it in #10653. We are doing a re-deploy now to solve this issue.

humitos added a commit that referenced this pull request Aug 22, 2023
@bdarnell
Copy link

This actually will change the default theme for users without a theme set, but hopefully most users now are defining an html_theme, since Sphinx defaults to one defined, so this won't impact many users.

FWIW I somehow ended up with logic to set html_theme only if the build is not happening on RTD, so this broke my build. I can't remember why I did it that way but judging by the comment there was something weird about the way sphinx_rtd_theme was installed (or not) that prevented it from being imported.

https://github.com/tornadoweb/tornado/blob/a19263454ae62523fa586959b83bc0903c021697/docs/conf.py#L87-L96

bdarnell added a commit to bdarnell/tornado that referenced this pull request Aug 23, 2023
The old magic for sphinx_rtd_theme has been removed; now we should
handle the theme in the same way we do for local builds.
bdarnell added a commit to tornadoweb/tornado that referenced this pull request Aug 23, 2023
mgautierfr added a commit to kiwix/libkiwix that referenced this pull request Aug 24, 2023
Lat version of read the doc do not set a html_theme for us.
So we have to always set it.

See readthedocs/readthedocs.org#10638
mgautierfr added a commit to kiwix/libkiwix that referenced this pull request Aug 24, 2023
Lat version of read the doc do not set a html_theme for us.
So we have to always set it.

See readthedocs/readthedocs.org#10638
@st-bender
Copy link

Hi,
Yeah, I was wondering if my builds were the only ones failing.
Please put at least a default theme back, to avoid having a lot of builds failing.

st-bender added a commit to st-bender/pyeppaurora that referenced this pull request Aug 25, 2023
RTD removed the default html theme for builds, making those without
`html_theme` set fail. Previously we set the theme only when building
locally as rtd would set it for us otherwise. Sets `html_theme`
regardless of that, hopefully fixing the builds on rtd.

Ref: readthedocs/readthedocs.org#10638

[skip ci]
st-bender added a commit to st-bender/pynrlmsise00 that referenced this pull request Sep 14, 2023
Sets `html_theme` when building on rtd since the default theme was
recently removed from the build infrastructure and builds now fail
without `html_theme` set.

Ref: readthedocs/readthedocs.org#10638

[skip ci]
clrpackages pushed a commit to clearlinux-pkgs/pypi-tornado that referenced this pull request Dec 5, 2023
…ion 6.4

Ben Darnell (60):
      Bump main branch version number to 6.4.dev1
      test: Streamline test configurations
      ioloop: Deprecate add_callback_from_signal
      ci: Enable manual dispatch for build workflow
      setup: Include tox.ini in sdist
      websocket: Add warning if client connection isn't closed cleanly
      web: Fix an open redirect in StaticFileHandler
      Version 6.3.2
      gen: Hold strong references to all asyncio.Tasks
      ci: Disable Python 3.12 in CI
      asyncio: Manage the selector thread with an async generator
      asyncio: Modernize type annotations
      asyncio_test: Use inequality when checking thread leaks
      asyncio_test: Remove obsolete py3.4 compatibility
      ci: Re-enable python 3.12
      build: Upgrade tox to support python 3.12
      *: Adapt to deprecation of datetime utc methods
      test: Add test for open redirect fixed in 6.3.2
      auth: Deprecate unused client_secret parameter
      auth: Deprecate TwitterMixin
      demos: Add a demo app for google auth
      auth: Update facebook scope
      auth: Use a setting for facebook redirect url
      auth: Copy google mixin comment to top-of-file
      auth: Fix doctests
      asyncio: Remove atexit hook
      autoreload: Support the ability to run a directory instead of a module
      autoreload: Switch to a real option parser
      autoreload_test: Reduce repetition
      autoreload: Support directories in CLI wrapper
      autoreload: Add --until-success flag
      autoreload: Remove some code for compatibility with py3.3
      autoreload: Remove some code for MacOS 10.5 compatibility
      autoreload: Modernize type annotations
      build: Move linters to python 3.11
      build: Upgrade pip-tools
      lint: Update mypy
      ioloop: Annotate run_in_executor returning Future, not Awaitable
      web_test: Fix open redirect test on windows
      http1connection: Make content-length parsing more strict
      httpserver_test: Add ExpectLog to fix CI
      Release notes for 6.3.3
      httpclient_test: Increase test_destructor_log timeout
      test: Refactor circlerefs script into a test
      ioloop,concurrent: Fix reference cycles
      test: Fix circlerefs test on python 3.10 and before
      test: Skip circlerefs test on pypy
      docs: Fix build after readthedocs/readthedocs.org#10638
      escape: Use the standard library where possible
      escape: Remove noqa: F811 tags from overloads
      docs: Release notes for 6.4.0
      Set version number to 6.4b1
      ci: Add windows to the main test config
      docs: Update intersphinx references for python 3.12
      *: Lint on the newest version of python too.
      Revert "asyncio: Remove atexit hook"
      test: Close the thread pool in run_on_executor test
      web,demos: Remove more uses of deprecated datetime utc methods
      iostream_test: Test check_hostname functionality.
      iostream_test: Don't require server-side log on windows

Chengzzzi (1):
      Fix WebSocketClientConnection parameter

Min RK (2):
      separate SelectorThread into its own object
      Make AddThreadEventLoop.close()  idempotent

Shinichi Hemmi (1):
      Fix syntax error in docstring

dependabot[bot] (5):
      build(deps): bump requests from 2.28.2 to 2.31.0
      build(deps): bump pygments from 2.14.0 to 2.15.0
      build(deps): bump certifi from 2022.12.7 to 2023.7.22
      build(deps): bump urllib3 from 1.26.14 to 1.26.17
      build(deps): bump urllib3 from 1.26.17 to 1.26.18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing sphinx_rtd_theme required by default when appending docs/conf.py
6 participants