Note that you can also accomplish the same with pip using the tilde operator in your requirements.txt (e.g. Django~=4.0), and Constraints Files [1] for the subdependencies.
A multistage build is still recommended as building your dependencies might need gcc or other tools.
A multistage build is still recommended as building your dependencies might need gcc or other tools.
[1] https://pip.pypa.io/en/stable/user_guide/#constraints-files