Name | jinja2schema JSON |
Version |
0.1.4
JSON |
| download |
home_page | https://jinja2schema.readthedocs.io |
Summary | Type inference for Jinja2 templates. |
upload_time | 2017-04-05 18:04:12 |
maintainer | None |
docs_url | None |
author | Anton Romanovich |
requires_python | None |
license | Copyright (c) 2014 by Anton Romanovich.
Some rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* The names of the contributors may not be used to endorse or
promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
jinja2schema
============
.. image:: https://travis-ci.org/aromanovich/jinja2schema.svg?branch=master
:target: https://travis-ci.org/aromanovich/jinja2schema
:alt: Build Status
.. image:: https://coveralls.io/repos/aromanovich/jinja2schema/badge.svg?branch=master
:target: https://coveralls.io/r/aromanovich/jinja2schema?branch=master
:alt: Coverage
.. image:: http://img.shields.io/pypi/v/jinja2schema.svg
:target: https://pypi.python.org/pypi/jinja2schema
:alt: PyPI Version
.. image:: http://img.shields.io/pypi/dm/jinja2schema.svg
:target: https://pypi.python.org/pypi/jinja2schema
:alt: PyPI Downloads
Demo_ | Documentation_ | GitHub_ | PyPI_
A library that provides a heuristic type inference algorithm for `Jinja2`_ templates.
.. code-block:: python
>>> from jinja2schema import infer, to_json_schema
>>> s = infer('{{ (x.a.b|first).name }}')
>>> s
{'x': {'a': {'b': [{'name': <scalar>}]}}
>>> s = infer('''
... {% for x in xs %}
... {{ x }}
... {% endfor %}
''')
>>> s
{'xs': [<scalar>]}
>>> to_json_schema(s)
{
'type': 'object',
'required': ['xs'],
'properties': {
'xs': {
'type': 'array'
'title': 'xs',
'items': {
'title': 'x',
'anyOf': [
{'type': 'string'},
{'type': 'number'},
{'type': 'boolean'},
{'type': 'null'}
],
},
}
}
}
More examples can be found at the `demo page`_.
Installing
----------
::
pip install jinja2schema
License
-------
`BSD license`_
.. _Jinja2: http://jinja.pocoo.org/docs/
.. _Demo: http://jinja2schema.aromanovich.ru/
.. _demo page: http://jinja2schema.aromanovich.ru/
.. _Documentation: https://jinja2schema.readthedocs.io/
.. _GitHub: https://github.com/aromanovich/jinja2schema
.. _PyPI: https://pypi.python.org/pypi/jinja2schema
.. _BSD license: https://github.com/aromanovich/jinja2schema/blob/master/LICENSE
Raw data
{
"_id": null,
"home_page": "https://jinja2schema.readthedocs.io",
"name": "jinja2schema",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Anton Romanovich",
"author_email": "anthony.romanovich@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/60/6f/8db433c9b644654f77a5a85a251298b278b6fefe668c1d856ad34c61c811/jinja2schema-0.1.4.tar.gz",
"platform": "UNKNOWN",
"description": "jinja2schema\n============\n\n.. image:: https://travis-ci.org/aromanovich/jinja2schema.svg?branch=master\n :target: https://travis-ci.org/aromanovich/jinja2schema\n :alt: Build Status\n\n.. image:: https://coveralls.io/repos/aromanovich/jinja2schema/badge.svg?branch=master\n :target: https://coveralls.io/r/aromanovich/jinja2schema?branch=master\n :alt: Coverage\n\n.. image:: http://img.shields.io/pypi/v/jinja2schema.svg\n :target: https://pypi.python.org/pypi/jinja2schema\n :alt: PyPI Version\n\n.. image:: http://img.shields.io/pypi/dm/jinja2schema.svg\n :target: https://pypi.python.org/pypi/jinja2schema\n :alt: PyPI Downloads\n\nDemo_ | Documentation_ | GitHub_ | PyPI_\n\nA library that provides a heuristic type inference algorithm for `Jinja2`_ templates.\n\n.. code-block:: python\n\n >>> from jinja2schema import infer, to_json_schema\n >>> s = infer('{{ (x.a.b|first).name }}')\n >>> s\n {'x': {'a': {'b': [{'name': <scalar>}]}}\n\n >>> s = infer('''\n ... {% for x in xs %}\n ... {{ x }}\n ... {% endfor %}\n ''')\n >>> s\n {'xs': [<scalar>]}\n >>> to_json_schema(s)\n {\n 'type': 'object',\n 'required': ['xs'],\n 'properties': {\n 'xs': {\n 'type': 'array'\n 'title': 'xs',\n 'items': {\n 'title': 'x',\n 'anyOf': [\n {'type': 'string'},\n {'type': 'number'},\n {'type': 'boolean'},\n {'type': 'null'}\n ],\n },\n }\n }\n }\n\nMore examples can be found at the `demo page`_.\n\nInstalling\n----------\n\n::\n\n pip install jinja2schema\n\nLicense\n-------\n\n`BSD license`_\n\n.. _Jinja2: http://jinja.pocoo.org/docs/\n.. _Demo: http://jinja2schema.aromanovich.ru/\n.. _demo page: http://jinja2schema.aromanovich.ru/\n.. _Documentation: https://jinja2schema.readthedocs.io/\n.. _GitHub: https://github.com/aromanovich/jinja2schema\n.. _PyPI: https://pypi.python.org/pypi/jinja2schema\n.. _BSD license: https://github.com/aromanovich/jinja2schema/blob/master/LICENSE",
"bugtrack_url": null,
"license": "Copyright (c) 2014 by Anton Romanovich.\n\nSome rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n* Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n* The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
"summary": "Type inference for Jinja2 templates.",
"version": "0.1.4",
"project_urls": {
"Download": "UNKNOWN",
"Homepage": "https://jinja2schema.readthedocs.io"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "606f8db433c9b644654f77a5a85a251298b278b6fefe668c1d856ad34c61c811",
"md5": "66d51d65a02b61607909c4a4e966670a",
"sha256": "236e4ee6612a0ab5a5664c453c954a2c7e42b6be986c12f7b31f34f9082043bc"
},
"downloads": -1,
"filename": "jinja2schema-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "66d51d65a02b61607909c4a4e966670a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 19794,
"upload_time": "2017-04-05T18:04:12",
"upload_time_iso_8601": "2017-04-05T18:04:12.046847Z",
"url": "https://files.pythonhosted.org/packages/60/6f/8db433c9b644654f77a5a85a251298b278b6fefe668c1d856ad34c61c811/jinja2schema-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2017-04-05 18:04:12",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "jinja2schema"
}