Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Contruyendo el manual con Sphinx

Esta página explica como crear una copia local del manual de Godot usando el motor de documentos Sphinx. Esto te permite tener archivos locales HTML y crear la documentación como un archivo PDF, EPUB, o LaTeX, por ejemplo.

Before you get started, make sure that you have:

Nota

Python 3 should come with the pip3 command. You may need to write python3 -m pip (Unix) or py -m pip (Windows) instead of pip3. If both approaches fail, make sure that you have pip3 installed.

  1. (Optional) Set up a virtual environment. Virtual environments prevent potential conflicts between the Python packages in requirements.txt and other Python packages that are installed on your system.

    1. Crea el entorno virtual:

      py -m venv godot-docs-venv
      
    2. Activa el entorno virtual:

      godot-docs-venv\Scripts\activate.bat
      
    3. (Optional) Update pre-installed packages:

      py -m pip install --upgrade pip setuptools
      
  2. Clona el repositorio de documentación:

    git clone https://github.com/godotengine/godot-docs.git
    
  3. Change directory into the docs repo:

    cd godot-docs
    
  4. Instala los paquetes requeridos:

    pip3 install -r requirements.txt
    
  5. Compila la documentación:

    make html
    

    Nota

    On Windows, that command will run make.bat instead of GNU Make (or an alternative).

    Alternativamente, puedes construir la documentación ejecutando el programa sphinx-build manualmente:

    sphinx-build -b html ./ _build/html
    

The compilation will take some time as the classes/ folder contains hundreds of files. See Hints for performance.

Luego puedes explorar la documentación abriendo _build/html/index.html en tu navegador web.

Dealing with errors

Si encuentras errores, puedes probar el siguiente comando:

make SPHINXBUILD=~/.local/bin/sphinx-build html

If you get a MemoryError or EOFError, you can remove the classes/ folder and run make again. This will drop the class references from the final HTML documentation but will keep the rest intact.

Importante

Si eliminas la carpeta classes/, no uses git add . cuando trabajes en una solicitud de extracción (pull request), ya que toda la carpeta classes/ será eliminada cuando realices el commit. Consulta #3157 para más detalles al respecto.

Hints for performance

RAM usage

La construcción de la documentación requiere al menos 8 GB de RAM para ejecutarse sin intercambio de disco, lo que ralentiza el proceso. Si tienes al menos 16 GB de RAM, puedes acelerar la compilación ejecutando:

set SPHINXOPTS=-j2 && make html

You can use -j auto to use all available CPU threads, but this can use a lot of RAM if you have a lot of CPU threads. For instance, on a system with 32 CPU threads, -j auto (which corresponds to -j 32 here) can require 20+ GB of RAM for Sphinx alone.

Specifying a list of files

You can specify a list of files to build, which can greatly speed up compilation:

make FILELIST='classes/class_node.rst classes/class_resource.rst' html