You must run the same Python automation on 40 servers that have Python 3.6, 3.9 and 3.12. What do you do?
IntermediateScenarioAutomation scripting & CLI design
Answer
Situation read → Python 3.6 is long end-of-life, and the modern boto3/requests versions no longer support it.
What I'd do →
- Do not depend on the system Python at all. Options: run the tool in a container, ship a self-contained venv built with the right version (
uv python install 3.12+ venv), or use a single-file zipapp built withshiv/pextargeting a known interpreter. - If agentless remote execution is the real need, use Ansible or SSM Run Command and keep the Python on the control side.
- Open a ticket to upgrade the 3.6 hosts; they are also missing security fixes.
Why → Writing to the lowest common denominator freezes you on dead versions and unsupported libraries.
Interview tip → Say "the OS Python belongs to the OS"; ship your own runtime.
More on Automation scripting & CLI design
Your team has a 300-line Bash script that parses JSON with `jq`, loops over AWS accounts and retries with `sleep`. It breaks every month. Do you rewrite it in Python?BeginnerA colleague's script deletes files older than 30 days from `/var/log/app`. You are asked to review it before it goes into cron. What do you look for?IntermediateYou need a script that ops engineers run from laptops and that CI runs nightly. How do you design its interface?IntermediateA script reads a 15 GB access log to count 5xx errors per endpoint, and the box runs out of memory. How do you fix it?BeginnerA cron job that runs a Python script fails silently. Nobody noticed for two weeks. How do you make sure that never happens again?IntermediateProduct wants a Slack notification whenever a deploy finishes. You have 30 minutes. What do you build?Beginner