Kirill N
Kirill N

Reputation: 40

pip group packages in requirements.txt

On local machive(development) and production server i have some changes in requirements.txt.

For example i want to ignore the psycopg2 for development, but use it for production.

I use pip freeze > requirements.txt, then manually add the needed one and then push it to server. Is there a way to do this like in gem bundle install? I mean like

bundle install --without production

or something like that for pip to don't do this every time manually.

Upvotes: 1

Views: 1092

Answers (1)

lapinkoira
lapinkoira

Reputation: 8988

You could have two separated pip files, dev_req.txt and prod_req.txt

In the prod_req.txt you can add '-r dev_req.txt' and when you install production requirements it will also install the dev requirements but when installing the dev requirements it wont install the production ones.

With fabric http://www.fabfile.org/ you can make a task for deploying and can have two profiles (pre and prod) and then depending on the role you are deploying it choose one or other pip requirement file.

Upvotes: 2

Related Questions