Read the Docsでは現在(2022年10月)ではPython3.7を用いてドキュメントのコンパイルが行われており、プロジェクトがPython3.7に対応していない場合はコンパイル時にエラーが生じて内容がうまく表示されない場合があります。(例えばPython3.8 以上で導入された機能を用いている場合など。)
Read the Docsでコンパイル時のPythonのバージョンを変更するには.readthedocs.yaml
を用意します。
ミニマル設定
version: 2 python: version: 3.8 install: - requirements: requirements.txt
を.readthedocs.yaml
としてレポジトリのルートに置けばok. 上記はPython3.8を用いてコンパイルする場合の設定ファイル。
参考
より詳細な設定をするなら
Readthedocs公式ドキュメントから.readthedocs.yaml
のサンプルを抜粋。OSから設定ファイルの指定まで行えます。
# .readthedocs.yaml # Read the Docs configuration file # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details # Required version: 2 # Set the version of Python and other tools you might need build: os: ubuntu-20.04 tools: python: "3.9" # You can also specify other tool versions: # nodejs: "16" # rust: "1.55" # golang: "1.17" # Build documentation in the docs/ directory with Sphinx sphinx: configuration: docs/conf.py # If using Sphinx, optionally build your docs in additional formats such as PDF # formats: # - pdf # Optionally declare the Python requirements required to build your docs python: install: - requirements: docs/requirements.txt