In-class exercise#
The in-class exercise is distributed via a GitHub Classroom repository. To get access to your group’s git repository, you can follow this link.
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.
Accept the assignment and clone the repository to your computer.
Note
Using the Github Classroom link substitutes for the step Installing the template
In task 7, you will need to follow that step.
Task 2#
This task should only be done by one group member!
Follow the steps outlined in the Customising the template for your needs, Section “Renaming the project”.
Once you’ve done this, commit your changes and push them.
Task 3#
Now all team members (except for the one who did the previous task) can clone the exercise repository and run the project.
Go to the Running the project section of the documentation and follow the instructions.
Note
For now, ignore everything related to pre-commit hooks. We will see them next session.
This means that you should not type pre-commit install.
If you have accidentally done it, use pre-commit uninstall.
If you have issues due to LaTeX, make sure you have a modern distribution installed and that your installation paths are valid.
Note
Important!!!
Do not change and/or commit any 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#
This task should only be done by one group member!
Follow the instructions in the documentation on how to customise the template for your project.
Once you’ve done this, commit your changes and push them. Make sure that all team members pull the changes.
Task 5#
The goal is to learn about an important pitfall when automating builds.
Run the project at least once if you have not done so in the previous step.
Open the file
task_data_management_template.pyin the data management subfolder. Change the name of the generated file fromstats4schools_smoking.pickletodata_cleaned.pickle(in the argument to theproduceskeyword).Run the project again. It will pass.
Now delete the entire
bldfolder and run the project again. You should get an error. Discuss why this happened.Describe other situations in which this problem can occur.
Task 6#
Set a breakpoint before the line sr = sr.replace(replace_mapping) inside the function
_clean_highest_qualification in stats4schools_smoking_template.py. Use the debugger
to investigate the following questions and answer them in your readme file:
Do we need to include any other categories in
replace_mapping?Why or why not?
Why is
ordered_qualificationslonger thanreplace_mapping?
Make sure you have read the section on setting breakpoints in task files
Task 7 (Bonus)#
Do this at home in case time does not allow you to do it in class.
Go through the setup of the project templates again, adding a new repository to your own GitHub account in the process.
Remove the template files and add all files from last week’s pytask exercise.
Replace all path definitions by proper path handling with a config file.
Make sure that pytask runs through.