{"id":37077730,"url":"https://github.com/k5md/templated-generator","last_synced_at":"2026-01-14T09:01:05.199Z","repository":{"id":57473975,"uuid":"393752388","full_name":"k5md/Templated-Generator","owner":"k5md","description":"Generate files from templates with template entries replaced","archived":false,"fork":false,"pushed_at":"2023-04-01T10:34:13.000Z","size":345,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-10T03:48:09.457Z","etag":null,"topics":["cli","generator","gui","module","python","template","text-editing","text-substitution"],"latest_commit_sha":null,"homepage":"https://k5md.github.io/Templated-Generator/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/k5md.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}},"created_at":"2021-08-07T17:44:57.000Z","updated_at":"2023-04-01T19:39:56.000Z","dependencies_parsed_at":"2022-09-10T15:41:37.954Z","dependency_job_id":null,"html_url":"https://github.com/k5md/Templated-Generator","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/k5md/Templated-Generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k5md%2FTemplated-Generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k5md%2FTemplated-Generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k5md%2FTemplated-Generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k5md%2FTemplated-Generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/k5md","download_url":"https://codeload.github.com/k5md/Templated-Generator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k5md%2FTemplated-Generator/sbom","scorecard":{"id":546526,"data":{"date":"2025-08-11","repo":{"name":"github.com/k5md/Templated-Generator","commit":"1fcb675c01d685867e106d8be01543a3b23b4131"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.1,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v1.1.4 not signed: https://api.github.com/repos/k5md/Templated-Generator/releases/94509929","Warn: release artifact v1.1.3 not signed: https://api.github.com/repos/k5md/Templated-Generator/releases/50059445","Warn: release artifact v1.1.1 not signed: https://api.github.com/repos/k5md/Templated-Generator/releases/48631447","Warn: release artifact v1.0.0 not signed: https://api.github.com/repos/k5md/Templated-Generator/releases/47500872","Warn: release artifact v1.1.4 does not have provenance: https://api.github.com/repos/k5md/Templated-Generator/releases/94509929","Warn: release artifact v1.1.3 does not have provenance: https://api.github.com/repos/k5md/Templated-Generator/releases/50059445","Warn: release artifact v1.1.1 does not have provenance: https://api.github.com/repos/k5md/Templated-Generator/releases/48631447","Warn: release artifact v1.0.0 does not have provenance: https://api.github.com/repos/k5md/Templated-Generator/releases/47500872"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":8,"reason":"2 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-5vgj-ggm4-fg62","Warn: Project is vulnerable to: PYSEC-2023-292 / GHSA-9w2p-rh8c-v9g5"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T09:41:01.632Z","repository_id":57473975,"created_at":"2025-08-20T09:41:01.632Z","updated_at":"2025-08-20T09:41:01.632Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28414732,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:38:59.149Z","status":"ssl_error","status_checked_at":"2026-01-14T08:38:43.588Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cli","generator","gui","module","python","template","text-editing","text-substitution"],"created_at":"2026-01-14T09:01:04.158Z","updated_at":"2026-01-14T09:01:05.186Z","avatar_url":"https://github.com/k5md.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Templated Generator\n[![Python 3.7](https://img.shields.io/badge/python-3.7-blue.svg)](https://www.python.org/downloads/release/python-370/) [![Build Status](https://app.travis-ci.com/k5md/Templated-Generator.svg?token=ZSWp3q2qzbTb4nzaxqWy\u0026branch=master)](https://app.travis-ci.com/k5md/Templated-Generator) \n[![tempgen_illustration.png](https://gifyu.com/images/tempgen_illustration.png)](https://gifyu.com/image/S74q3)\n\nTemplated generator is a utility, that allows users generate files from templates with embedded template entries that could be edited and automatically transformed, saving time that would be otherwise spend on manually editing generic documents.\n\nThe project includes python module, available on pypi, for use inside python scripts, cli and gui applications to edit template entries and quickly generate documents.\n\n## Template entries\nGenerally, template entries are stringified and enclosed in double curly brackets valid JSON objects. Here is an example:\n```\n{{{\"id\": \"total\", \"title\": \"Total cost\", \"value\": \"2500\", \"post\": [{\"fn\": \"append\", \"args\": [\" U.S. Dollars\"]}], \"group\": \"primary\", \"order\": \"1\"}}}\n```\nMinimal template entry contains id and value properties. Entry ids can be not unique and for each entry, the value specified once as replacement will be substituted and transforms (for respective entry) will be applied. This allows to edit value associated with id encountered multiple times over multiple templates only once.\nFor instance loaded templates can contain:\n```\n{{{\"id\": \"total\", \"value\": \"2500\", \"post\": [{\"fn\": \"append\", \"args\": [\" U.S. Dollars\"]}]}}}\n{{{\"id\": \"total\", \"value\": \"2500\", \"post\": [{\"fn\": \"append\", \"args\": [\"$\"]}]}}}\n{{{\"id\": \"total\", \"value\": \"2500\"}}}\n```\nIn GUI application all three will be represented by one input with default value of \"2500\". Given replacements dictionary (for cli and using as module) of { \"total\": \"42\" }, or if input in this field equals \"42\" (for gui application), these will be represented in generated documents as\n```\n42 U.S. Dollars\n42$\n42\n```\n**Notes**:\n- when creating templates in Microsoft Office [disable smart quotes](https://support.microsoft.com/en-us/office/smart-quotes-in-word-702fc92e-b723-4e3d-b2cc-71dedaf2f343) since only straight quotation marks are allowed in template entries\n- for template entries to be correctly imported and substituted in MS/Open office documents, **whole** template entry string, for instance ```{{{\"id\": \"total\", \"value\": \"2500\"}}}```, must have consistent formatting\n\n### Entry object properties\n| property name  | type   | required | description |\n| :--------  | :----  | :------- | :---------- |\n| id | string | yes | id used to reference entry in replacements|\n| title | string | no | human-readable title that will be used to represent entry field in tempgen gui|\n| value | string | yes | default value that will be used as replacement if no changes are made|\n| pre | array of objects | no | array of transform objects that will be applied to value property before it becomes available for editing|\n| post | array of objects | no | array of transform objects that will be applied to value property on generated document save|\n| group | string | no | group tag name, entries with equal group property value will be grouped together in tempgen gui\n| order | string | no | order number, used to determine entry position among other group entries in tempgen gui, entries with lower order value will appear earlier\n| autocomplete | object | no | specifies which suggestions should be displayed on user input in entry representation in tempgen_gui\n\n### Transform object properties\nTransforms available by default are listed [here](https://github.com/k5md/Templated-Generator/blob/master/src/tempgen/transforms.py) .\nThese are functions, that are applied on \"value\" property sequentially either\n* when template is loaded, if transform is in \"pre\" list\n* when generated document is being saved, if transform is in \"post\" list\n\nTransforms are provided with value (from entry) automatically, additional arguments could be provided via \"args\" array.\n**Note**: When using as a module, one can easily modify the dictionary by changing tempgen instance 'transforms' attribute\n| property name  | type   | required | description |\n| :--------  | :----  | :------- | :---------- |\n| fn | string | yes | name of transform function|\n| args | array of strings | no | additional arguments, provided after value|\n\n### Autocomplete object properties\n| property name  | type   | required | description |\n| :--------  | :----  | :------- | :---------- |\n| external | string | no | full name of json file (must be in the same directory as the template it is referenced from) containing array of autocomplete suggestion strings, used to fill data property|\n| data | array of strings | no | list of values that will be used in as suggestions for entry value in tempgen gui|\n\n## Getting Started\n### Tempgen GUI/CLI standalone executables\n* Download latest tempgen_gui/tempgen_cli [release](https://github.com/k5md/Templated-Generator/releases/latest)\n* Unpack archive to any directory\n* Run tempgen_gui/tempgen_cli binary\n### Installation as module\nTo install from [pypi](https://pypi.org/project/tempgen/):\n```\npip install tempgen\n```\n\n#### Usage as module\n```python\nfrom tempgen.module import Tempgen\n\nt = Tempgen() # create new independent tempgen instance\n\nt.transforms.keys() # get list of supported transforms, you can add new on the fly, by setting t.transforms dictionary key to desired function name and value to this function\n# dict_keys(['append', 'inverted_date', 'ru_date_month_as_string_year', 'ru_monetary_string_replace', 'ru_monetary_as_string', 'ru_monetary_ending_append'])\n\nt.parsers.keys() # get list of supported file extensions, refer to documentation on how to add new extensions support\n# dict_keys(['.docx', '.xlsx', '.md', '.txt', '.odt', '.ods'])\n\nt.load_template(absolute_path_to_template) # parse template\n\nt.get_templates() # get list of loaded templates\n\nt.get_fields() # get reference to parsed entries\n\nt.save_result(absolute_path_to_template, target_name_without_extension, { \"id_from_template_text\": \"desired value\" })\n```\n\n### Supported extensions\n- docx\n- xlsx\n- md\n- txt\n- odt\n- ods\n\n## Development\n### Environment setup\n1.  Install Python 3.7+\n2.  Install `virtualenv`\n    ```sh\n    pip install virtualenv\n    ```\n3.  Clone this project\n4.  From project directory, run\n    ```sh\n    virtualenv .env\n    ```\n    **Note**: This will create a virtual environment using the Python version\n    that `virtualenv` was run with (which will be the version it was installed\n    with). To use a specific Python version, run:\n    ```sh\n    virtualenv --python=\u003cpath_to_other_python_version\u003e .env\n    # For example, this might look like\n    virtualenv --python=/usr/bin/python3.6 .env\n    ```\n5.  Assuming you are using the `bash` shell, run:\n    ```sh\n    source .env/bin/activate\n    ```\n    For other shells, see the other `activate.*` scripts in the `.env/bin/`\n    directory. If you are on Windows, run:\n    ```sh\n    .env\\Scripts\\activate.bat\n    ```\n6.  Install all of the required packages using\n    ```sh\n    pip install -r requirements.txt\n    ```\n\n### Module/cli/gui code running\nWith virtual environment active, execute one of the following commands from **src** project directory:\n```sh\npython -m tempgen\npython -m tempgen_cli\npython -m tempgen_gui\n```\n\n### Testing\nThis project uses pytest and mostly relies on snapshot testing. To trigger tests run\n```sh\npytest\n```\noptionally with -vv and -s flags for verbosity and prints.\n**Note**: After each code modification that presumes expected generated output file changes, update snapshots by running\n```sh\npytest --snapshot-update\n```\n\n### Creating portable executables\nThis project employs pyinstaller to create binaries. To generate executables from sources on your PC:\n1. Enter the virtual environment (run `source .env/bin/activate` or OS/shell equivalent).\n2.  Run the following command to create bundles with binaries for tempgen_cli and tempgen_gui in project's dist directory\n    ```sh\n    python package.py\n    ```\nGenerated archives will be placed in **artifacts** directory\n### Packaging module\nRun the following command to package tempgen module:\n```sh\npython -m pip install --upgrade build\npython -m build\n```\nGenerated archive and .whl package will be placed in **dist** directory.\n\n### Generating documentation\nRun the following command to generate updated documentation from collected docstrings and place it in **docs** directory:\n```sh\npdoc src\\tempgen --output-dir docs -d numpy\n```\n\n## Contributions\nPR are always welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk5md%2Ftemplated-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fk5md%2Ftemplated-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk5md%2Ftemplated-generator/lists"}