Modern and easy way to handle placeholders.
Project description
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
- Regular Expressions 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.
Usage
from emplace import Formatter, placeholder
class MyFormatter(Formatter):
@placeholder(r"upper_(?P<text>.*)")
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
emplace-0.1.0.tar.gz
(4.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file emplace-0.1.0.tar.gz.
File metadata
- Download URL: emplace-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.1 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4efc1a79e4a9fd5f89bde26dae243a893e8e2ecbd3a026cccd9ce11e13983d8
|
|
| MD5 |
a2a25dcea46730fc8da1ade22fd16785
|
|
| BLAKE2b-256 |
28a52611d3e5dee655bf1504c79f810ef64bbaa320219fd28e627832b387b905
|
File details
Details for the file emplace-0.1.0-py3-none-any.whl.
File metadata
- Download URL: emplace-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.1 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2c978fdac6466cd3f6c31b0bb7a25bc95fc7c2e49088839c17f8279a9bc661a
|
|
| MD5 |
f09ee1e7c416c2eb083e9e0e593d58ad
|
|
| BLAKE2b-256 |
46bd91360dddbf9f386921e22da59eed83bc31a6b975c93b6911cabcf4034927
|