#
generate_solutions.py
Hi everyone! I wanted to share a finding with you regarding our ongoing update of the base images for our labs (including updating pandas, numpy, matplotlib, and other packages). We've encountered an issue related to the activity solution files, particularly with Matplotlib, though it could apply to other files as well.
For instance:
If we create a solution image using Matplotlib version 3.9.0 and later update the lab with the latest version, 3.10.0, we face a problem. When comparing the solution image we created (with version 3.9.0) to a user’s solution image (which uses version 3.10.0), the images will look identical, but the user won't pass the assertion due to version differences.
#
Possible Solution:
We’re considering generating dynamic solution files. Each time we push changes to the project on GitHub, the solution files will be automatically regenerated. This way, the solution files will always match the latest version of the packages in the lab.
Here’s what we have done in this repo: https://github.com/datawars-io-content/lab-843g8gf-plotting-basics-hotel-rating-trip-types
New
generate_solutions.py
file:
We have added a new file in thenotebooks/
directory calledgenerate_solutions.py
. This file contains all the code from theSolution.ipynb
notebook and generates the activity solution files. The code must contain same activity solution file names that are used inenglish.md
.Dockerfile Update:
In thenotebooks/
directory, We have updated the Dockerfile to include:
RUN [ -f generate_solutions.py ] && python generate_solutions.py
This ensures that new solution files are created every time we push an update to the GitHub repo.