Metadata-Version: 2.4
Name: template_filler
Version: 2025.9.26945
Author-email: Eugene Evstafev <hi@eugene.plus>
License: MIT License
Project-URL: Repository, https://pypi.org/project/template_filler/
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

[![PyPI version](https://badge.fury.io/py/template_filler.svg)](https://badge.fury.io/py/template_filler)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![Downloads](https://static.pepy.tech/badge/template_filler)](https://pepy.tech/project/template_filler)
[![LinkedIn](https://img.shields.io/badge/LinkedIn-blue)](https://www.linkedin.com/in/eugene-evstafev-716669181/)

# 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:

```bash
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

```python
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.Template` for 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](https://github.com/chigwell/template_filler/issues).

## Author

*   **Eugene Evstafev** - <a href="https://www.linkedin.com/in/eugene-evstafev-716669181/"><img src="https://img.shields.io/badge/LinkedIn-blue" alt="LinkedIn"></a>

## License

`template_filler` is licensed under the [MIT License](https://choosealicense.com/licenses/mit/).
