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

CI: Pin to sphinx>=6.2 for docs build on Python 3.13 #3667

Merged
merged 3 commits into from
Dec 3, 2024
Merged

Conversation

weiji14
Copy link
Member

@weiji14 weiji14 commented Dec 2, 2024

Description of proposed changes

Fix ModuleNotFoundError: No module named 'imghdr' on Python 3.13. Xref sphinx-doc/sphinx#10440 (comment)

Full traceback from https://readthedocs.org/projects/pygmt-dev/builds/26462203/ in #3490:

sphinx-autogen -i -t _templates -o api/generated api/*.rst
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/pygmt-dev/conda/3490/bin/sphinx-autogen", line 6, in <module>
    from sphinx.ext.autosummary.generate import main
  File "/home/docs/checkouts/readthedocs.org/user_builds/pygmt-dev/conda/3490/lib/python3.13/site-packages/sphinx/ext/autosummary/__init__.py", line 88, in <module>
    from sphinx.writers.html import HTMLTranslator
  File "/home/docs/checkouts/readthedocs.org/user_builds/pygmt-dev/conda/3490/lib/python3.13/site-packages/sphinx/writers/html.py", line 21, in <module>
    from sphinx.util.images import get_image_size
  File "/home/docs/checkouts/readthedocs.org/user_builds/pygmt-dev/conda/3490/lib/python3.13/site-packages/sphinx/util/images.py", line 4, in <module>
    import imghdr
ModuleNotFoundError: No module named 'imghdr'
make: *** [Makefile:29: api] Error 1

Helps with #3490

Preview:

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.
  • Use underscores (not hyphens) in names of Python files and directories.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash command is:

  • /format: automatically format and lint the code

Fix `ModuleNotFoundError: No module named 'imghdr'` on Python 3.13. Xref sphinx-doc/sphinx#10440 (comment)
@weiji14 weiji14 added the maintenance Boring but important stuff for the core devs label Dec 2, 2024
@weiji14 weiji14 added this to the 0.14.0 milestone Dec 2, 2024
@weiji14 weiji14 self-assigned this Dec 2, 2024
@seisman
Copy link
Member

seisman commented Dec 3, 2024

I'm a little surprise to see that the CI is still using sphinx 5.x even though the latest version is sphinx 8.x.

@weiji14 weiji14 marked this pull request as ready for review December 3, 2024 04:37
@seisman
Copy link
Member

seisman commented Dec 3, 2024

We also need to update the needs_sphinx key in doc/conf.py.

needs_sphinx = "1.8"

@weiji14 weiji14 merged commit 848f5fd into main Dec 3, 2024
10 checks passed
@weiji14 weiji14 deleted the sphinx-6.2 branch December 3, 2024 04:58
seisman pushed a commit that referenced this pull request Dec 3, 2024
Fix `ModuleNotFoundError: No module named 'imghdr'` on Python 3.13. Xref sphinx-doc/sphinx#10440 (comment)

* Set needs_sphinx to 6.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants