Metadata-Version: 2.1
Name: jinja2-fsloader
Version: 0.3.0
Summary: A Jinja2 template loader using PyFilesystem2
Home-page: https://github.com/althonos/jinja2-fsloader/
Author: Martin Larralde
Author-email: martin.larralde@ens-paris-saclay.fr
License: MIT
Project-URL: Bug Reports, https://github.com/althonos/jinja2-fsloader
Project-URL: Pyfilesystem2 documentation, https://docs.pyfilesystem.org
Keywords: jinja2,template,loader,pyfilesystem2,pyfilesystem,fs
Platform: any
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: System :: Filesystems
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Markup :: HTML
Requires-Python: !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.5.1,>=2.7
License-File: COPYING

``jinja2-fsloader`` |star me|
=============================

.. |star me| image:: https://img.shields.io/github/stars/althonos/jinja2-fsloader.svg?style=social&maxAge=3600&label=Star
   :target: https://github.com/althonos/jinja2-fsloader/stargazers

*A Jinja2 template loader using PyFilesystem2.*

|build| |repo| |versions| |changelog| |format| |coverage| |grade| |license|

.. |build| image:: https://img.shields.io/travis/althonos/jinja2-fsloader/master.svg?label=travis-ci&style=flat-square
   :target: https://travis-ci.org/althonos/jinja2-fsloader/

.. |repo| image:: https://img.shields.io/badge/source-GitHub-303030.svg?style=flat-square
   :target: https://github.com/althonos/jinja2-fsloader

.. |versions| image:: https://img.shields.io/pypi/v/jinja2-fsloader.svg?style=flat-square
   :target: https://pypi.org/project/jinja2-fsloader

.. |format| image:: https://img.shields.io/pypi/format/jinja2-fsloader.svg?style=flat-square
   :target: https://pypi.org/project/jinja2-fsloader

.. |grade| image:: https://img.shields.io/codacy/grade/f74bd301468341f59ce664ae129021ef/master.svg?style=flat-square
   :target: https://www.codacy.com/app/althonos/jinja2-fsloader/dashboard

.. |coverage| image:: https://img.shields.io/codecov/c/github/althonos/jinja2-fsloader/master.svg?style=flat-square
   :target: https://codecov.io/gh/althonos/jinja2-fsloader

.. |license| image:: https://img.shields.io/pypi/l/jinja2-fsloader.svg?style=flat-square
   :target: https://choosealicense.com/licenses/mit/

.. |changelog| image:: https://img.shields.io/badge/keep%20a-changelog-8A0707.svg?maxAge=86400&style=flat-square
   :target: https://github.com/althonos/jinja2-fsloader/blob/master/CHANGELOG.rst

About
'''''

This library allows you to use PyFilesystem2 as a backend to load templates into
Jinja2. You can take advantage of the whole ``fs`` ecosystem, which already implements
drivers for FTP, SSH, SMB, S3, WebDAV servers, ZIP and Tar archives, and
`many more <https://www.pyfilesystem.org/page/index-of-filesystems/>`_!


Installation
''''''''''''

Install with ``pip``::

    $ pip install --user -U jinja2-fsloader


Usage
'''''

.. code:: Python

    from jinja2_fsloader import FSLoader
    FSLoader(template_fs, encoding='utf-8', use_syspath=False)

``template_fs``
    a ``FS`` instance or an `FS URL <https://docs.pyfilesystem.org/en/latest/openers.html>`_
    where the templates are located.
``encoding``
    the encoding of the template files (*utf-8* by default).
``use_syspath``
    set to ``True`` for the loader to return the real path or an URL to the template
    when available (``False`` by default).


Examples
''''''''

.. code:: python

    import jinja2
    from jinja2_fsloader import FSLoader

    # templates in a ZIP archive
    env = jinja2.Environment(loader=FSLoader("zip:///path/to/my/templates.zip"))

    # templates in a S3 bucket
    env = jinja.Environment(loader=FSLoader("s3://mybucket"))

    # templates in memory
    mem = fs.open_fs('mem://')
    mem.settext('template.j2', 'This template is {{adjective}}')
    env = jinja.Environment(loader=FSLoader(mem))


See Also
''''''''

The `complete documentation <https://www.pyfilesystem.org/>`_ of PyFilesystem2 can
give you a better overview of all the features available in the library.


