Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Directory Structure

The big picture

The following graph shows the contents of template_project root directory after executing pytask

Color legend:

The separation of inputs and outputs (one of our guiding principles) is visible at a glance:

The figures and tables live inside documents/ rather than bld/ because document tools (MyST and Slidev) expect assets to be near the source files. The public/ directory name is required by Slidev for static assets.

Viewing papers and presentations

The paper is built in both PDF and HTML formats. Use these commands to view outputs interactively with live reload:

pixi run view-paper   # View paper in browser (HTML with live reload)
pixi run view-pres    # View presentation in browser (Slidev with live reload)

For the project documentation (this site), use:

pixi run -e docs view-docs

The contents of src/template_project/ follow the steps of the analysis workflow, with subdirectories for data management, analysis, and final output generation.

All outputs from these steps are placed in the bld/ directory, organized by type:

Document build outputs (HTML site and PDF exports) go to _build/ at the project root.

Documents directory structure

The documents/ directory contains the source files for papers and presentations:

The configuration file myst.yml lives in the project root (not inside documents/) because Jupyter Book 2.0 expects it at the working directory where jupyter book build is run. This file defines project metadata, bibliography settings, and PDF export options.

The tasks in src/template_project/final/task_final_template.py generate figures and tables into documents/public/ and documents/tables/ respectively. These are then included in the paper and presentation using MyST Markdown directives (e.g., {figure} and {include}).

Zooming in

Lets go one step deeper and consider the root/src directory in more detail:

It is imperative that you do all the task handling inside the task_xxx.py-scripts, using the pathlib library. This ensures that your project can be used on different machines and it minimises the potential for cross-platform errors.

For running Python source code from pytask, simply include pathlib.Paths to the dependencies and similar path(s) for the special keyword produces as the default arguments to your function.

For running scripts in other languages, pass all required files (inputs, log files, outputs) as arguments to the @pytask.mark.[x]-decorator. You can then read them in. Check the sections on different programming languages for examples.