https://github.com/eeemoon/emplace
Modern and easy way to handle placeholders.
https://github.com/eeemoon/emplace
placeholder processing python replace template text
Last synced: 24 days ago
JSON representation
Modern and easy way to handle placeholders.
- Host: GitHub
- URL: https://github.com/eeemoon/emplace
- Owner: eeemoon
- Created: 2025-06-19T11:24:10.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-07-08T20:56:03.000Z (11 months ago)
- Last Synced: 2026-03-18T21:15:15.896Z (3 months ago)
- Topics: placeholder, processing, python, replace, template, text
- Language: Python
- Homepage:
- Size: 16.6 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://pypi.org/project/emplace)
[](https://www.python.org/downloads)
[](https://codecov.io/gh/eeemoon/emplace)
# emplace
Modern and easy way to handle placeholders.
This package allows you to define text placeholders and process them dynamically. It's like `str.format()`, but gives you much more flexibility.
## Features
- **Reg**ular **Ex**pressions to find placeholders.
- Custom delimiters (`%var%`, `{var}`, `${var}` etc.).
- Modern API using asyncio and decorators.
- Nested placeholders (`{greet_{name}}`).
- Type safety using annotations.
- No additional dependencies.
## Installation
To install this module, run the following command:
```
pip install emplace
```
## Usage
Example of creating a formatter with single placeholder.
```python
from emplace import Formatter, placeholder
class MyFormatter(Formatter):
@placeholder(r"upper_(?P.*)")
def upper_ph(self, text: str) -> str:
return text.upper()
formatter = MyFormatter()
result = await formatter.format("Hello, {upper_world}!")
print(result) # Hello, WORLD!
```
## Examples
You can check out more examples [here](examples).