Assignment 4: Project templates#
Introduction#
In this assignment, you convert the code of your previous assignment into the structure of the project templates.
To avoid disappointments, here are a few rules for all tasks:
All previous comments about git, docstrings, side-effects, file-paths and generated files under version control remain valid for this assignment.
Before you submit, it is a good idea to remove the
bld
folder once and make sure that the project runs through.You have to work in the environment that is created by the project templates. If you need libraries that are not in the environment, you need to add them to the environment file and re-create the environment (
mamba env update -f environment.yml
). Do not simply pip install things. If the project does not run in an environment created from your environment file, we will deduct points. Add the packages manually, do not use pip install and then export an environment file.
The deadline is January 8, 11:59 pm
Task 1#
Check that your system satisfies the necessary prerequisites for the templates. Note that with the possible exception of LaTeX, this should be the case. Also make sure to be in a folder without spaces.
Create your exercise repository by following this link
Accept the assignment, create the repository, and clone it to your computer.
Task 2#
This task should only be done by one group member!
Follow the steps outlined in the project template documentation on how to customise the template for your project. For this task, only work on the task “First step: Rename the project”.
Once you’ve done this, commit your changes and push them.
Task 3#
Now all team members should pull the changes. Do not move on to Task 4 unless all team members have successfully run the project.
Go to the Running the project section of the documentation and follow the instructions.
For now, ignore everything related to pre-commit hooks. We will see them next session.
This means to skip the step pre-commit install
. If you have accidentally done it, use
pre-commit uninstall
.
If you previously had issues with kaleido, you will have to repeat the workaround in the new environment. If you have issues due to LaTeX, make sure you have a modern distribution installed and that your installation paths are valid.
Importantly:
Do not change and/or commit any other files during this step.
Do not continue with any other task until the entire project can be built without errors for all members of your group.
Task 4#
From here onwards, you are back in the normal Git workflow.
Follow the instructions in the documentation on how to customise the template for your project.
Task 5#
Read the section on Porting an existing project of the documentation, but do not follow the instructions yet. Apply the strategy when working on the next tasks.
Task 6#
Transfer all code from your data management assignment (assignment 2) to your project and convert the structure such that pytask runs everything that needs to be run.
Task 7#
Transfer all code from your Monte Carlo assignment (assignment 3, including the tests) to your project and convert the structure such that pytask runs everything that needs to be run.
Task 8#
Make sure that paths to the most used directories are only defined once in the config file. They should be imported from there whenever they are needed.
Make sure to specify all dependencies and products of your tasks. It is possible to have pytask projects that run without error but still have missing dependencies. This could then produce errors when they are run on larger or faster machines. It also means that you may make wrong assumptions about what code a set of results is based on. E.g., an intermediate step might not be executed even though it should be because pytask does not know about a dependency which has changed.
Task 9#
Make sure that all long-running tasks (e.g. the Monte Carlo simulation) are separated from other tasks that depend on them (e.g. plotting).