Managing contents of requirements.txt for a Python virtual environment
<p>So I am creating a brand new Flask app from scratch.As all good developers do,my first step was to create a virtual environment.</p>

<p>The first thing I install in the virtual environment is Flask==0.11.1.Flask installs its following dependencies:</p>

<blockquote>
  <ul>
  <li>click==6.6</li>
  <li>itsdangerous==0.24</li>
  <li>Jinja2==2.8</li>
  <li>MarkupSafe==0.23</li>
  <li>Werkzeug==0.11.11</li>
  <li>wheel==0.24.0</li>
  </ul>
</blockquote>

<p>Now,I create a <strong>requirements.txt</strong> to ensure everyone cloning the repository has the same version of the libraries.However, my dilemma is this:</p>

<ul>
<li>Do I mention each of the Flask dependencies in the <strong>requirements.txt</strong> along with the version numbers 
 OR</li>
<li>Do I just mention the exact Flask version number in the <strong>requirements.txt</strong> and hope that when they do a <strong>pip install requirements.txt</strong>, Flask will take care of the dependency management and they will download the right versions of the dependent libraries</li>
</ul>

<p>Both approaches are valid and work. But there is a little difference. When you enter all the dependencies in the <code>requirements.txt</code> you will be able to pin the versions of them. If you leave them out, there might be a later update and if Flask has something like <code>Werkzeug&gt;=0.11</code> in it's dependencies, you will get a newer version of Werkzeug installed.</p>

<p>So it comes down to updates vs. defined environment. Whatever suits you better.</p>

python pip virtualenv requirements.txt