Python Developer Interview Question

How do you decide what to pin and how do you keep dependencies current?

What the interviewer is probing, how to structure your answer, and a spoken example you can adapt.

Quick answer

Pin exactly in the lock file, and keep the declared ranges in pyproject relatively permissive. That gives reproducible installs without freezing you out of upgrades. Automate updates with a bot that opens small pull requests, let CI decide whether they are safe, and treat security advisories as their own track that jumps the queue rather than waiting for the next batch.

Why interviewers ask this

Dependency policy reveals whether you have maintained something for longer than a quarter. The interviewer is probing for the reproducibility versus staleness trade, because both extremes hurt: unpinned builds that break overnight, or a frozen tree nobody dares touch until a critical advisory forces a painful jump across four major versions. Automation and test coverage are what make the answer credible.

How to structure your answer

  • Separate declared ranges from locked versions.
  • Explain why both extremes cause outages.
  • Describe the automated upgrade cadence.
  • Give security advisories their own faster path.

Example answer

Spoken example, first person

Two different jobs, so two different answers. The lock file pins exact versions and hashes, and that is what CI and production install, so builds are reproducible and yesterday green pipeline means something. The declared constraints in pyproject stay loose, usually just a lower bound plus an upper bound on the next major, so upgrades are possible without editing every line. Keeping current is the harder half. We run an automated bot that opens one pull request per dependency on a weekly schedule, and because they are small and the suite is decent, most merge on green without a human thinking hard. Major version bumps get read properly. Security advisories bypass the cadence entirely, and pip-audit runs in CI so a known vulnerable transitive dependency fails the build rather than sitting unnoticed. The failure mode I have lived through is the opposite, a service frozen for two years, then a critical Django advisory forcing four major versions in one weekend.

Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.

See how it works

Follow-up questions to expect

  • How do you handle a bot pull request that breaks the suite?
  • Do you pin transitive dependencies too?
  • How do you evaluate whether to adopt a new dependency at all?

Related python developer questions

Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.

Predict my questions

Rehearse the hard questions before they are asked

Practise with a live copilot, then walk in ready. A $29 Session Pass gets you through the interview with no subscription and no lock-in.

Get GhostPilot