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.
Metadata
Release files for emplace 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| emplace-0.1.0.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| emplace-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.6 kB
Release files / emplace-0.1.0.tar.gz
| Download URL | emplace-0.1.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b4efc1a79e4a9fd5f89bde26dae243a893e8e2ecbd3a026cccd9ce11e13983d8
|
|
BLAKE2b-256 checksum How to use checksums |
28a52611d3e5dee655bf1504c79f810ef64bbaa320219fd28e627832b387b905
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.13.1 Windows/11
|
Release files / emplace-0.1.0-py3-none-any.whl
| Download URL | emplace-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c2c978fdac6466cd3f6c31b0bb7a25bc95fc7c2e49088839c17f8279a9bc661a
|
|
BLAKE2b-256 checksum How to use checksums |
46bd91360dddbf9f386921e22da59eed83bc31a6b975c93b6911cabcf4034927
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.13.1 Windows/11
|