title: Include template files in poetry project
body: <p>I have a command line python app using poetry, that I would like to ship with a couple of jinja2 template files. As of know I have them in a <code>template</code> directory. How would I go about shipping those templates with the app and how do I make sure that the app knows where the templates are located?</p>
  <p>Here's my (naive) attempt at using pkgutil to accomplish this:</p>
  <p>directory structure:</p>
  <pre><code>.
  ├── app.py
  ├── LICENSE
  ├── poetry.lock
  ├── pyproject.toml
  └── templates
      └── message.en_US.jinja2
  </code></pre>
  <p>app.py:</p>
  <pre class="lang-py prettyprint-override"><code>import pkgutil
  from jinja2 import Environment, FileSystemLoader
  
  data = pkgutil.get_data(__name__, &quot;templates&quot;)
  
  env = Environment(loader=FileSystemLoader(data))
  template = env.get_template(&quot;message.en_US.jinja2&quot;)
  print(template.render({&quot;foo&quot;: 1, &quot;bar&quot;: 2}))
  
  </code></pre>
  <p>pyproject.toml:</p>
  <pre><code>[tool.poetry]
  name = &quot;app&quot;
  version = &quot;0.1.0&quot;
  description = &quot;Does stuff&quot;
  authors = [&quot;Foo Bar &lt;foo@bar.com&gt;&quot;]
  license = &quot;AGPL-3.0-or-later&quot;
  
  [tool.poetry.dependencies]
  python = &quot;^3.8&quot;
  jinja2 = &quot;^2.11.3&quot;
  
  [tool.poetry.scripts]
  app = &quot;app:main&quot;
  
  [build-system]
  requires = [&quot;poetry&gt;=0.12&quot;]
  build-backend = &quot;poetry.masonry.api&quot;
  </code></pre>
  <p>This fails because the templates folder doesn't get packaged. I also don't know if I can pass the folder to the <code>Environment</code> constructor like this.</p>