6

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 dependency
  • npm 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)?

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you very much, don't you think it needs too much manual work?
@AlexeySidash Nah, it's pretty easy and fast, at least to me :) I also deploy projects using fabric, so it's even faster - actually, just a command: fab deploy -R production. It connects to the production servers by ssh, does git pull from the corresponding branch (master) and restarts whatever's in charge on the server (like uwsgi).
Thanks for fabric. It looks nice!
0

There is a nice solution, it is quite new tool, called pipenv. Seems an analog of npm for python.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.