We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← Modules, Packaging and Tooling step 23 of 41
Find the Files Missing from a Wheel
The wheel in the article above left out templates/report.html, and the
tests never noticed. A check in CI can catch that before a release. It
compares the files in your package folder with the files in the wheel.
missing_from_wheel(wheel, ["mypkg/__init__.py", "mypkg/templates/report.html"])
# ["mypkg/templates/report.html"]
What to write
Fill in missing_from_wheel(wheel, package_files). wheel is an open
zipfile.ZipFile. package_files lists the files in your package folder as
paths relative to src/, such as mypkg/templates/report.html.
wheel.namelist()returns the path of every file in the wheel, written the same way.- Return each path in
package_filesthat is not in the wheel, sorted. - Skip compiled files. A compiled file is any path that ends in
.pyc, or any path that goes through a__pycache__folder. Python writes these when it runs your code, and they do not belong in a wheel. - A file that is only in the wheel, such as one under
mypkg-0.1.0.dist-info/, is not missing. Leave it out of the result.
What the driver reports
Keep build_wheel and solve as they are. solve writes a zip file in
memory from wheel_files, opens it with zipfile and calls your function.
The grader runs one file of code, so the driver writes the zip itself instead
of running a real build. A real wheel is the same kind of zip file.
solve returns:
missing: the list your function returned.complete:Truewhen nothing is missing.
Your code, saved here
Sign in to access your accepted solutions and saved draft history. You can keep reading the lesson without an account.
Sign in to your accountStuck?
Python reference solution
Sign in to track your attempts toward unlocking the reference solution.