Documentation
How to contribute to the docs repo
Local development
The TuringLang/docs repository uses Quarto. You can add a new page by creating a new .qmd file and including its filepath in the top-level _quarto.yml file, which defines the structure of the website. Generally, we prefer adding individual index.qmd files in new folders, as this leads to cleaner URLs.
When you create a new page, you can test it locally by running quarto render /path/to/mynewpage/index.qmd, and then launching a HTTP server from the folder containing the rendered HTML file (for example, using cd _site/path/to/mynewpage && python -m http.server).
Note that if you use quarto preview, this may take a very long time since Quarto will attempt to render the entire site! You can see the repository README for some information on how to get around this using the _freeze folder.
The docs environment
The docs repository is built from a single Manifest file, which contains a pinned version of Turing.jl. All notebooks are run with the same environment, which ensures consistency across the documentation site.
In general, you should not add new packages to this environment which depend on Turing (i.e., reverse dependencies of Turing), or packages that have Turing extensions. The reason for this is because such packages will have compatibility bounds on Turing. Thus, we will be unable to update the docs to use the newest Turing version, until and unless those packages also update their compatibility bounds.
Whenever a new version of Turing.jl is released, the Manifest file should ideally be updated (with a single ] up in the Julia REPL), and the new docs published. This process is not yet automated, though, so sometimes the version of Turing may fall behind the latest release. Usually for minor versions we make sure to update the docs as soon as practicable, but less so for patch versions.
GitHub CI
Each PR to the docs repository will trigger two GitHub Actions workflows:
The workflow that builds the documentation. If this workflow fails, it’s usually due to an error in the code, or some environment resolution issues.
TipIf you specifically want to demonstrate the presence of an error, you can add
#| error: trueto the top of the code block in question.The workflow that checks that the version of Turing is the newest possible version. If this workflow fails, it’s because the Manifest file contains an older version of Turing.
Note that the build-docs workflow utilises a lot of caching in order to speed up the build process (a full docs build can take 1.5 hours). However, this caching is dependent on the Manifest file not changing. Therefore, be aware that if you update the Manifest file, the next workflow run will require a full build!
If you are writing new docs that do not rely on a newer version of any dependency, it is often better to avoid updating the Manifest file, and instead just add the new docs. In this case, it’s fine to let the check-version CI workflow fail. You can add a Manifest update in a separate PR.