Reputation: 441
Now I'm taking part in node.js project and i like "node way" of dependecy management.
I'll provide some examples for those who haven't worked with npm
npm install package_name --save
- installs package_name
as production dependencynpm install package name --save-dev
- install package_name
as development dependecy.All deps are stored in package.json
file, which is indexed by version control system. When i clone repo, i just type npm install
in terminal and it installs everything.
As far as i know, pip freeze
is able to do it, but:
On production server I can type npm install --production
and all my build tools, testing frameworks, etc. are not installed. Just production deps.
So, the question is:
How do you split production and development dependecies with pip(or other tool)?
Upvotes: 6
Views: 1287
Reputation: 441
There is a nice solution, it is quite new tool, called pipenv. Seems an analog of npm for python.
Upvotes: 0
Reputation: 5442
I would create two virtualenvs (venv for Python 3) with a separate requirements.txt
file for each, like requirements-production.txt
and requirements-develop.txt
, but that looks a bit strange to me.
Personally, I usually use git's branches to separate production/development code. Most of the development goes in the develop
branch, there's a single requirements.txt
(which can change over time, for sure). When everything's alright and/or the development cycle has ended, I just merge it with the master
branch. Haven't had a need to test different versions of dependencies simultaneously.
Upvotes: 4