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>

<ol>
<li>activate virtualenv</li>
<li>go to you project root directory</li>
<li><p>get all the packages along with dependencies in requirements.txt</p>

<pre><code>pip freeze &gt; requirements.txt
</code></pre></li>
<li><p>you dont have to worry anything else apart from making sure next person installs the requirements recursively by following command</p>

<pre><code>pip install -r requirements.txt
</code></pre></li>
</ol>

python pip virtualenv requirements.txt