Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/iFamishedX/mapres/llms.txt

Use this file to discover all available pages before exploring further.

mapres is a Python library for resolving placeholder strings using structured, layered data maps. Define your template context as typed Python dataclasses, compose maps in priority-ordered layers, and let mapres handle substitution — with support for multiple syntax styles, recursive resolution, pipeline transforms, and built-in color and time utilities.

Installation

Install mapres from PyPI and get your environment set up in seconds.

Quickstart

Resolve your first placeholder string in under five minutes.

Core Concepts

Understand DataMaps, the Resolver, Layers, and Syntax patterns.

API Reference

Full reference for every class, method, and decorator in mapres.

Key Features

Multiple Syntax Styles

Choose from {braces}, ${dollars}, <angles>, or %percents% — or define your own regex pattern.

Layered Resolution

Stack maps with priority ordering so overrides and fallbacks work naturally across any context.

@datamap Decorator

Turn any Python dataclass into a typed template context with a single decorator.

Built-in Maps

Ship with ColorMap (ANSI + Minecraft) and TimeMap (dynamic date/time with timezone support).

Pipeline Transforms

Chain custom text transformation functions before or after map substitution.

LRU Caching

Enable built-in LRU caching for high-throughput repeated resolution with zero extra dependencies.

Get Started

1

Install mapres

pip install mapres
2

Define a DataMap

from mapres import datamap

@datamap
class Greeting:
    name: str = "World"
    version: str = "1.0"
3

Resolve a string

from mapres import MapResolver, Layer, LayerStack

stack = LayerStack([Layer("base", [Greeting()])])
resolver = MapResolver(layers=stack)
result = resolver.res("Hello, {name}! Version {version}")
# → "Hello, World! Version 1.0"
4

Explore built-in maps

Check out ColorMap for ANSI and Minecraft color codes, and TimeMap for live date/time placeholders.

Build docs developers (and LLMs) love