How to import Python dependancies in Serverless v1.0
<p>Language: Python
Framework: <a href="https://serverless.com" rel="nofollow">Serverless</a> v1.0</p>

<p>Typically I would run <code>pip freeze &gt; requirements.txt</code> in the project root</p>

<p>How can I get these dependancies packaged into every deploy?</p>

<ol>
<li><p>create <code>requirements.txt</code></p>

<p>pip freeze > requirements.txt</p></li>
<li><p>create a folder with all the dependencies:  </p>

<p>pip install -t vendored -r requirements.txt</p></li>
</ol>

<p>Note that in order to use these dependencies in the code you'll need to add the following:</p>

<pre><code>import os
import sys
here = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(here, "./vendored")) 
</code></pre>

<p>See <a href="http://stackoverflow.com/a/36944792/1111215">http://stackoverflow.com/a/36944792/1111215</a> for another example.</p>

python serverless-framework