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

Course build performance: take advantage of the Sphinx incremental build #25

Closed
Tracked by #7
markkuriekkinen opened this issue Sep 9, 2022 · 1 comment · Fixed by apluslms/a-plus-rst-tools#156
Assignees
Labels
enhancement New feature or request

Comments

@markkuriekkinen
Copy link
Collaborator

Sphinx by default builds only (RST) files that have been changed since the last build. Sphinx checks the timestamps (modification time) on the RST files and in the build cache directory _build/doctrees.

In a-plus-rst-tools, we use a command that breaks the incremental build: make touchrst html. touchrst is defined in the course Makefile and it touches all RST files in the course directory (touch sets the timestamp of the file to the current time). This is needed because Sphinx does not see changes in the course YAML files such as exercise config.yaml. If the RST file using some config.yaml is not touched, then the new build would exclude the changes in the config.yaml file and the new configuration would not be deployed at all.

Improve the course build time by taking advantage of the Sphinx incremental build. Do not touch all RST files at the start of the build. Gitmanager or the course Makefile could touch only those RST files that are needed to include the changes in the YAML files. New updates to YAML files should be somehow detected so that the corresponding RST files may be included in the build.

  • YAML file changes could be detected from the new git commits that have been pulled. Inspect the changes in the git commits to detect the updated files.
  • Alternatively, YAML file changes could be detected simply from the file timestamps. Which way performs better?
  • RST files could be touched to include them in the new incremental Sphinx build.
  • Instead of touching, the RST files to be built could also be supplied to the sphinx-build command as parameters. Sphinx-build is called in the course Makefile.

https://www.sphinx-doc.org/en/master/man/sphinx-build.html

By default, everything that is outdated is built. Output only for selected files can be built by specifying individual filenames.

Related to apluslms/a-plus-rst-tools#89

@lainets
Copy link
Contributor

lainets commented Feb 28, 2023

apluslms/a-plus-rst-tools#156 adds this support. However, it should be noted that the build output directory needs to be specified in the exclude_patterns field of the meta file, otherwise the git clean command will remove the files and the build will be done from scratch.

markkuriekkinen pushed a commit to apluslms/a-plus-rst-tools that referenced this issue Mar 1, 2023
Enables incremental Sphinx builds: an rst file is rebuilt
if a referenced yaml file has changed.

This should remove the need to use "make touchrst" in
A+ course builds because changes in exercise config.yaml files
should be detected even if no rst file has been changed.

Fixes apluslms/gitmanager#25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants