Skip to the page

Python in production · Scenario

A deploy breaks because a dependency of a dependency changed

The interviewer asks

Nothing changed in our code, but this morning's deploy of a Python service failed: the new container crashes on start with an ImportError from a library we don't even use directly. Yesterday's build was fine. What happened, and how do you fix it properly?

Then

Follow-ups the interviewer asks next

  1. What do you do in the first 15 minutes?
  2. How do you find which package changed?
  3. Why did "nothing changed" still break?
  4. You pin that one package and pip now fails with ResolutionImpossible. Why?
  5. How do lock files work with pip-tools, Poetry and uv?
  6. How do you still get security updates without surprises?
  7. Have you had a build break like this?

The answer

What a strong answer covers

  • First: redeploy yesterday's image (images are immutable; that's why you keep them).
  • Find it: diff pip freeze (or uv pip list) between the two images.
  • Cause: requirements.txt lists only direct dependencies with open ranges, so every build resolves fresh and picked up a new major version of a transitive package.
  • The twist: a direct dependency also released a version that needs the new major, so one pin conflicts. Lock everything, not one package.
  • Lock files with exact versions and hashes: pip-tools (pip-compile --generate-hashes), Poetry (poetry.lock), uv (uv.lock; uv sync --locked fails if the lock is out of date). PEP 751 defines a standard pylock.toml; uv can export it and pip has experimental support.
  • Applications lock; libraries declare ranges.
  • Updates: Dependabot or Renovate pull requests tested in CI; build once and promote the same image.

The red pen

Common traps

Avoid:pip install --upgrade everything; deleting the upper bounds to "fix" the conflict.

Practise this out loud

Say your answer out loud to an AI interviewer that follows up, and get a score for it.

Practise by voice

Practise questions like this out loud

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview