Skip to main content

Modern and easy way to handle placeholders.

Project description

python codecov

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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

emplace-0.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

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

Hashes for emplace-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b4efc1a79e4a9fd5f89bde26dae243a893e8e2ecbd3a026cccd9ce11e13983d8
MD5 a2a25dcea46730fc8da1ade22fd16785
BLAKE2b-256 28a52611d3e5dee655bf1504c79f810ef64bbaa320219fd28e627832b387b905

See more details on using hashes here.

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

Hashes for emplace-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c2c978fdac6466cd3f6c31b0bb7a25bc95fc7c2e49088839c17f8279a9bc661a
MD5 f09ee1e7c416c2eb083e9e0e593d58ad
BLAKE2b-256 46bd91360dddbf9f386921e22da59eed83bc31a6b975c93b6911cabcf4034927

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page