Interview Prep/Python for DevOps/Environments, imports & packaging errors

Your package installs fine, but at runtime `FileNotFoundError: .../site-packages/cloudaudit/templates/report.html`.

IntermediateTroubleshootingEnvironments, imports & packaging errors
Answer

Likely causes → Non-Python files are not included in the wheel; it works in editable/dev mode because files are read from the source tree.

Diagnose →

python -m build && unzip -l dist/*.whl | grep templates

Fix → Include package data ([tool.setuptools.package-data] cloudaudit = ["templates/*.html"], or include-package-data = true with MANIFEST.in), and read files with importlib.resources.files("cloudaudit") / "templates/report.html" instead of paths relative to __file__.

Prevent → Test the built wheel in CI (src layout plus installing the wheel, not -e).

All Python for DevOps questions Roadmap: Python for automation

More on Environments, imports & packaging errors