How to use pip freeze >> require.txt with multiple environments

I would like to understand how to use pipwith several environments, I have a universal flack web project where my production environment needs pip installation

pip install flask psycop2 Flask-SQLAlchemy

In my dev & test environment, these and some additional materials are needed

pip install flask psycop2 Flask-SQLAlchemy factory-boy flake8 WebTest 

I know that I can start pip freeze >> requirements/dev.txtand then make a file with a name prod.txtin the same folder cut and copy all the general requirements in it and add it -r prod.txtto mine dev.txtso that it also sets the requirements for prod.

My question is how to use the freezeze package to install a specific require.txt file during its installation, let it say the following I need flake8-debuggerit, obviously, I need to go to dev.txt to do this without constantly freezing one file and pasting package?

Should I just go and add flake8-debuggerno version before dev.txtand run, pip install -r requirements/dev.txtor is this a more elegant workflow for this?

+4
source share
1 answer

It turns out that this will never be fixed in the requirements.txt system, but the answer is here.

https://github.com/pypa/pipfile

Pipfile ruby ​​Gemfile npm package.json

Pipfile

: .

Pipfile - ( !) Python (, -). .txt, $pip install -r.

, pip, API ( Pipfile) .

, - Pipfile.lock. . .txt , , . .

requirements.txt :

Python Python. (, ). . Pipfile.lock Pipfile

. , .

source('https://pypi.org/', verify_ssl=True)

package('requests')
package('Django', '==1.6')
package('pinax', git='git://github.com/pinax/pinax.git', ref='1.4', editable=True)
dev_package('nose')
+2

Source: https://habr.com/ru/post/1660339/


All Articles