mumbleapi
mumbleapi copied to clipboard
Setup pip-tools to manage dependencies
Problem
- As the project grows we may add in more number of dependencies which are hard to upgrade/downgrade and also hard to upgrade/downgrade their dependencies as well if we directly update the
requirements.txt
file.
Solution
- To use
pip-compile
to generate therequirements.txt
file, since it'll take care of the indirect dependencies used by a particular package and upgrade/downgrade to the compatible version as well. - This will also helps us to break down and dev and prod dependencies.
Package
https://pypi.org/project/pip-tools/
What do that "break down dev and prod dependencies mean exactly" ?
What do that "break down dev and prod dependencies mean exactly" ?
Imagine you have dependencies that is only used for development purposes and not exactly for production. Let's take package.json
for example, there contains both dependencies
and dev-dependencies
separately.
all of the dependencies in Django are used for dev and production I guess! can you define which dependencies are used for dev and prod in this project?
I don't exactly know what dependencies are used for dev and prod in this project. But for eg. take django-debug-toolbar
package, this is not currently added in this project. This package is only used for dev purpose and not on the prod side. So this can package must be added on the dev-dependencies.
Likewise all the packages can be split.
Heroku requires requirements.txt
to grab all dependencies for build process and then run app .
pip-compile
will automatically generate the .txt
file. The thing is that we won't be editing the .txt
file directly. We'll edit the requirements.in
file and run pip-compile
which will then spit out the requirements.txt
file.
Then the requirements.txt
file can be used by Heroku.