{"id":16189319,"url":"https://github.com/caolan/python-magery","last_synced_at":"2025-03-19T03:30:51.301Z","repository":{"id":57439141,"uuid":"60034213","full_name":"caolan/python-magery","owner":"caolan","description":"Python implementation of Magery templates","archived":false,"fork":false,"pushed_at":"2019-10-22T23:18:32.000Z","size":61,"stargazers_count":5,"open_issues_count":3,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-28T15:04:38.123Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/caolan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-30T19:32:49.000Z","updated_at":"2021-12-23T15:06:31.000Z","dependencies_parsed_at":"2022-09-26T17:11:36.048Z","dependency_job_id":null,"html_url":"https://github.com/caolan/python-magery","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fpython-magery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fpython-magery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fpython-magery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fpython-magery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caolan","download_url":"https://codeload.github.com/caolan/python-magery/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243965774,"owners_count":20375917,"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":[],"created_at":"2024-10-10T07:35:01.830Z","updated_at":"2025-03-19T03:30:51.076Z","avatar_url":"https://github.com/caolan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python Magery\n\nA server-side implementation of the [Magery][magery] templating library for\nPython 2 and 3. See the Magery [README][magery] for template syntax.\n\nIn the [example](example) directory is a [Flask][flask] app demonstrating\nserver and client code sharing templates.\n\n## Installation\n\n```no-highlight\npip install magery\n```\n\n## API\n\n```python\nimport magery\n```\n\n### compile_templates(filename, templates=None)\n\nParses templates from `filename`, returns a dictionary of templates.\nIf `templates` is not `None` it will extend the existing templates\ndictionary instead of returning a new one.\n\n```python\ntemplates = magery.compile_templates('./template.html')\n```\n\n### Template.render\\_to\\_string(data)\n\nRender a compiled template using `data`, and return the output as a\nstring.\n\n```python\ntemplates = magery.compile_templates('./template.html')\n\ndata = {'name': 'world'}\ntemplates['app'].render_to_string(data);\n```\n\n### Template.write(data, out)\n\nRender a compile template using `data`, and write the result to the IO\nstream `out`.\n\n```python\ntemplates = magery.compile_templates('./template.html')\n\nwith open('output.html', 'w', encoding='utf-8') as f:\n    data = {'name': 'world'}\n    templates['app'].write(data, f);\n```\n\n[magery]: https://github.com/caolan/magery/\n[flask]: http://flask.pocoo.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaolan%2Fpython-magery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaolan%2Fpython-magery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaolan%2Fpython-magery/lists"}