Description of Technical Debt
This is unsustainable, every time we make a change into the codebase by adding a new Python dependency, we have to also update requirements file and also Dockerfile. This is and will be source of problems. Besides, it's not common practice and it leads us to have different env on localhost, CI, CD, and dockerfile / production.
The solution is to:
- Split the current requirements.txt file into two:
requirements.txt (containing depenendies needed for production run of the application) and requirements-dev.txt (containing dependencies needed for CI and tests only - things like black, pytest, pylint etc)
- Install the
requirements.txt only from within the Dockerfile by verifying that the copy of this file exists on the docker image and that something like pip install -r requirements.txt is executed
- Also, make sure that
requirements.txt has dependencies with versions - to generate it, run command pip freeze
Impact of Technical Debt
- Slows down deployments
- Increases probability and frequency of bugs
- Adds unnecessary size to the Docker image by adding unnecessary dependencies
- Produces highly random / non-deterministic environment
Description of Technical Debt
This is unsustainable, every time we make a change into the codebase by adding a new Python dependency, we have to also update requirements file and also Dockerfile. This is and will be source of problems. Besides, it's not common practice and it leads us to have different env on localhost, CI, CD, and dockerfile / production.
The solution is to:
requirements.txt(containing depenendies needed for production run of the application) andrequirements-dev.txt(containing dependencies needed for CI and tests only - things like black, pytest, pylint etc)requirements.txtonly from within the Dockerfile by verifying that the copy of this file exists on the docker image and that something likepip install -r requirements.txtis executedrequirements.txthas dependencies with versions - to generate it, run commandpip freezeImpact of Technical Debt