{"id":22845240,"url":"https://github.com/noahmorrison/chevron","last_synced_at":"2025-05-15T00:09:40.018Z","repository":{"id":22609220,"uuid":"25951460","full_name":"noahmorrison/chevron","owner":"noahmorrison","description":"A Python implementation of mustache","archived":false,"fork":false,"pushed_at":"2023-08-24T11:56:15.000Z","size":188,"stargazers_count":525,"open_issues_count":38,"forks_count":58,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-04-13T21:33:59.898Z","etag":null,"topics":["mustache","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/noahmorrison.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-10-30T02:34:57.000Z","updated_at":"2025-03-29T17:10:50.000Z","dependencies_parsed_at":"2024-06-18T12:31:18.035Z","dependency_job_id":"559c8d8b-fd08-48f7-8a1e-fe90f4b87666","html_url":"https://github.com/noahmorrison/chevron","commit_stats":{"total_commits":263,"total_committers":20,"mean_commits":13.15,"dds":"0.30418250950570347","last_synced_commit":"5e1c12827b7fc3db30cb3b24cae9a7ee3092822b"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noahmorrison%2Fchevron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noahmorrison%2Fchevron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noahmorrison%2Fchevron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noahmorrison%2Fchevron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noahmorrison","download_url":"https://codeload.github.com/noahmorrison/chevron/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254249206,"owners_count":22039029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mustache","python"],"created_at":"2024-12-13T03:16:27.041Z","updated_at":"2025-05-15T00:09:34.984Z","avatar_url":"https://github.com/noahmorrison.png","language":"Python","readme":"[![PyPI version](https://badge.fury.io/py/chevron.svg)](https://badge.fury.io/py/chevron)\n[![Build Status](https://travis-ci.org/noahmorrison/chevron.svg?branch=master)](https://travis-ci.org/noahmorrison/chevron)\n[![Coverage Status](https://coveralls.io/repos/github/noahmorrison/chevron/badge.svg?branch=master)](https://coveralls.io/github/noahmorrison/chevron?branch=master)\n\nA python implementation of the [mustache templating language](http://mustache.github.io).\n\nWhy chevron?\n------------\n\nI'm glad you asked!\n\n### chevron is fast ###\n\nChevron runs in less than half the time of [pystache](http://github.com/defunkt/pystache) (Which is not even up to date on the spec).\nAnd in about 70% the time of [Stache](https://github.com/hyperturtle/Stache) (A 'trimmed' version of mustache, also not spec compliant).\n\n### chevron is pep8 ###\n\nThe flake8 command is run by [travis](https://travis-ci.org/noahmorrison/chevron) to ensure consistency.\n\n### chevron is spec compliant ###\n\nChevron passes all the unittests provided by the [spec](https://github.com/mustache/spec) (in every version listed below).\n\nIf you find a test that chevron does not pass, please [report it.](https://github.com/noahmorrison/chevron/issues/new)\n\n### chevron is Python 2 and 3 compatible ###\n\nPython 2.6, 2.7, 3.2, 3.3, 3.4, 3.5, and 3.6 are all tested by travis.\n\n\n\nUSAGE\n-----\n\nCommandline usage: (if installed via pypi)\n```\nusage: chevron [-h] [-v] [-d DATA] [-p PARTIALS_PATH] [-e PARTIALS_EXT]\n               [-l DEF_LDEL] [-r DEF_RDEL]\n               template\n\npositional arguments:\n  template              The mustache file\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -v, --version         show program's version number and exit\n  -d DATA, --data DATA  The json data file\n  -p PARTIALS_PATH, --path PARTIALS_PATH\n                        The directory where your partials reside\n  -e PARTIALS_EXT, --ext PARTIALS_EXT\n                        The extension for your mustache partials, 'mustache'\n                        by default\n  -l DEF_LDEL, --left-delimiter DEF_LDEL\n                        The default left delimiter, \"{{\" by default.\n  -r DEF_RDEL, --right-delimiter DEF_RDEL\n                        The default right delimiter, \"}}\" by default.\n```\n\nPython usage with strings\n```python\nimport chevron\n\nchevron.render('Hello, {{ mustache }}!', {'mustache': 'World'})\n```\n\nPython usage with file\n```python\nimport chevron\n\nwith open('file.mustache', 'r') as f:\n    chevron.render(f, {'mustache': 'World'})\n```\n\nPython usage with unpacking\n```python\nimport chevron\n\nargs = {\n  'template': 'Hello, {{ mustache }}!',\n\n  'data': {\n    'mustache': 'World'\n  }\n}\n\nchevron.render(**args)\n```\n\nchevron supports partials (via dictionaries)\n```python\nimport chevron\n\nargs = {\n    'template': 'Hello, {{\u003e thing }}!',\n\n    'partials_dict': {\n        'thing': 'World'\n    }\n}\n\nchevron.render(**args)\n```\n\nchevron supports partials (via the filesystem)\n```python\nimport chevron\n\nargs = {\n    'template': 'Hello, {{\u003e thing }}!',\n\n    # defaults to .\n    'partials_path': 'partials/',\n\n    # defaults to mustache\n    'partials_ext': 'ms',\n}\n\n# ./partials/thing.ms will be read and rendered\nchevron.render(**args)\n```\n\nchevron supports lambdas\n```python\nimport chevron\n\ndef first(text, render):\n    # return only first occurance of items\n    result = render(text)\n    return [ x.strip() for x in result.split(\" || \") if x.strip() ][0]\n\ndef inject_x(text, render):\n    # inject data into scope\n    return render(text, {'x': 'data'})\n\nargs = {\n    'template': 'Hello, {{# first}} {{x}} || {{y}} || {{z}} {{/ first}}!  {{# inject_x}} {{x}} {{/ inject_x}}',\n\n    'data': {\n        'y': 'foo',\n        'z': 'bar',\n        'first': first,\n        'inject_x': inject_x\n    }\n}\n\nchevron.render(**args)\n```\n\nINSTALL\n-------\n\n- with git\n```\n$ git clone https://github.com/noahmorrison/chevron.git\n```\n\nor using submodules\n```\n$ git submodules add https://github.com/noahmorrison/chevron.git\n```\n\nAlso available on pypi!\n\n- with pip\n```\n$ pip install chevron\n```\n\n\n\nTODO\n---\n\n* get popular\n* have people complain\n* fix those complaints\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoahmorrison%2Fchevron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoahmorrison%2Fchevron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoahmorrison%2Fchevron/lists"}