Fix Sphinx build failure in Read the Docs due to myst-parser version incompatibility #689
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Read the Docs build was failing with a
ModuleNotFoundError: No module named 'myst_parser'error. This occurred because Read the Docs automatically upgrades Sphinx to version 8.2.3, but the project'smyst-parser 3.0.1only supports Sphinx versions>=6,<8, creating a version incompatibility.Root Cause
Read the Docs runs these automatic steps during build:
This upgrades Sphinx to 8.2.3, but
myst-parser 3.0.1has the dependency constraintsphinx >=6,<8, making it incompatible with Sphinx 8.x.Solution
Modified
.readthedocs.yamlto use custom build commands instead of the automatic Sphinx installation. This ensures Poetry manages all dependencies with compatible versions:Before:
After:
poetry run sphinx-build -T -b html -d _build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/htmlChanges
The key change is replacing the
sphinx:configuration section withbuild.commandsthat give full control over the build process:This ensures that Poetry's dependency resolution maintains version compatibility between all documentation tools.
Testing
Fixes #688.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
docs.micropython.org/home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/python /home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/sphinx-build -T -b html -d _build/doctrees -D language=en docs test_output/html(dns block)docs.python.org/home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/python /home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/sphinx-build -T -b html -d docs/_build/doctrees -D language=en docs docs/_build/html(dns block)/home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/python /home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/sphinx-build -T -b html -d _build/doctrees -D language=en docs test_output/html(dns block)/home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/python /home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/sphinx-build -T -b html -d _build/doctrees -D language=en docs final_test/html(dns block)https://api.github.com/repositories/15337142/tags/home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/python /home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/sphinx-build -T -b html -d docs/_build/doctrees -D language=en docs docs/_build/html(http block)/home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/python /home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/sphinx-build -T -b html -d _build/doctrees -D language=en docs test_build/html(http block)/home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/python /home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/pytest tests/rst/test_constants.py -v(http block)micropython-stubs.readthedocs.io/home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/python /home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/sphinx-build -T -b html -d docs/_build/doctrees -D language=en docs docs/_build/html(dns block)/home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/python /home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/sphinx-build -T -b html -d _build/doctrees -D language=en docs test_build/html(dns block)/home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/python /home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/sphinx-build -T -b html -d _build/doctrees -D language=en docs test_output/html(dns block)www.sphinx-doc.org/home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/python /home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/sphinx-build -T -b html -d _build/doctrees -D language=en docs test_output/html(dns block)/home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/python /home/REDACTED/work/micropython-stubber/micropython-stubber/.venv/bin/sphinx-build -T -b html -d _build/doctrees -D language=en docs final_test/html(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.