You want a reusable CI pipeline for 15 Python tool repos. What goes in it?
IntermediateScenarioTesting, CI/CD, packaging & services
Answer
Situation read → Standardize quality gates once.
What I'd do →
- A reusable GitHub Actions workflow (
workflow_call) with inputs for Python version and package path. - Steps: checkout,
actions/setup-pythonwith pip cache (orastral-sh/setup-uv), install from lock,ruff check,ruff format --check,mypy,pytest --cov,pip-audit, build wheel. - Build and scan the Docker image (Trivy) where applicable; push on main with SHA tags.
- Pin actions by SHA; least-privilege
permissions:.
Why → One pipeline definition means consistent gates and one place to fix things.
Interview tip → Mention pinning third-party actions by commit SHA.
More on Testing, CI/CD, packaging & services
You join a team whose Python automation repo has no tests. Where do you start?BeginnerYour pytest suite takes 12 minutes. How do you speed it up?IntermediateA test passes locally but fails in CI only when run with the rest of the suite. What do you suspect?IntermediateYour Python Docker image is 1.1 GB. How do you shrink it?IntermediateYou want to distribute an internal CLI to 200 engineers. What are your options?IntermediateA Flask app runs with `app.run()` in production and falls over under load. What do you change?Beginner