template_filler
A Python package for filling template strings with combinations of provided variables. This tool is useful for generating multiple variations of text based on a single template and a set of possible variable values.
Installation
To install template_filler, use pip:
pip install template_filler
Usage
The fill_template function takes a template string and a list of dictionaries. Each dictionary specifies a variable name and a list of its possible values. The function returns a list of strings, where each string is a unique combination of the template filled with the provided variable values.
Basic Example
from template_filler import fill_template
template = "Hello, ${name}! Your age is ${age}."
vars_data = [
{"name": ["Alice", "Bob"]},
{"age": [30, 25]}
]
results = fill_template(template, vars_data)
# The 'results' list will contain:
# [
# "Hello, Alice! Your age is 30.",
# "Hello, Alice! Your age is 25.",
# "Hello, Bob! Your age is 30.",
# "Hello, Bob! Your age is 25."
# ]
for res in results:
print(res)
Features
- Combinatorial Filling: Generates all possible combinations of provided variable values.
- String Templates: Utilizes Python's
string.Templatefor straightforward placeholder syntax (e.g.,${variable_name}). - Type Flexibility: Handles various data types for variable values, converting them to strings for substitution.
Contributing
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
Author
License
template_filler is licensed under the MIT License.
Metadata
Release files for template-filler 2025.9.26945
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| template_filler-2025.9.26945.tar.gz | 3.5 kB | Without provenance | Details for template_filler-2025.9.26945.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| template_filler-2025.9.26945-py3-none-any.whl | Python 3 | none | any | Details for template_filler-2025.9.26945-py3-none-any.whl |
Total release size: 7.7 kB
Release files / template_filler-2025.9.26945.tar.gz
| Download URL | template_filler-2025.9.26945.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9b1dbc3bd8a95693e02bc6a2d78f258972589b2216e775b164c8584284c1e14
|
|
BLAKE2b-256 checksum How to use checksums |
33ed08d7565223fcbf105941074749baf4e518bc2ac0d730c9751c5a45d2c0f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.11
|
Release files / template_filler-2025.9.26945-py3-none-any.whl
| Download URL | template_filler-2025.9.26945-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c437ab2134b8922c357e49732a6eb66dc05adb176271df5d0e3868592d046c6e
|
|
BLAKE2b-256 checksum How to use checksums |
e90cd71860144aa4e2113e2024e3135ed5ed8edb503a40aea7f6a35e349fb023
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.11
|
Security for template-filler 2025.9.26945
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.