How do you keep dependencies up to date without breaking things?
IntermediateConceptEnvironments, dependencies & packaging
Answer
- Commit a lock file; never float in production.
- Let Dependabot or Renovate open PRs for updates, grouped (for example all
boto3/botocore/boto3-stubstogether, since they release almost daily). - CI runs tests on every update PR.
- Run
pip-audit(or Trivy/OSV-Scanner) on the lock file to catch known CVEs. pip list --outdatedfor a quick local view.
More on Environments, dependencies & packaging
What is a virtual environment and why do we always use one?BeginnerWhat does `error: externally-managed-environment` mean?Beginner`requirements.txt` vs `pyproject.toml`: what goes where?IntermediateWhy is `pip freeze > requirements.txt` not a great lock strategy?IntermediateWhat do version specifiers like `~=`, `==`, `>=,<` mean?BeginnerWhat are `pipx` and `uv`, and when do you use them?Intermediate