mumbleapi icon indicating copy to clipboard operation
mumbleapi copied to clipboard

Setup pip-tools to manage dependencies

Open M-krishna opened this issue 3 years ago • 6 comments

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 the requirements.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/

M-krishna avatar May 19 '21 14:05 M-krishna

What do that "break down dev and prod dependencies mean exactly" ?

PraveenMalethia avatar May 22 '21 15:05 PraveenMalethia

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.

M-krishna avatar May 23 '21 12:05 M-krishna

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?

PraveenMalethia avatar May 28 '21 07:05 PraveenMalethia

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.

M-krishna avatar May 29 '21 11:05 M-krishna

Heroku requires requirements.txt to grab all dependencies for build process and then run app .

PraveenMalethia avatar Jun 02 '21 12:06 PraveenMalethia

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.

M-krishna avatar Jun 02 '21 13:06 M-krishna