Skip to main content

dinterpol

PyPI Version Code style: black

dinterpol is a python library for data interpolation that supports both scalar and structured types generation.

Motivation

When dealing with structured data types like dictionaries, or data formats like JSON and YAML it can be useful to generate scalar or structured types resulting from the interpolation of multiple input elements. Python3 provides several standard string interpolation mechanisms: string.Template(), f-strings and str.format(), but because they all return strings, they are not suitable for structured with non string data interpolation.

Usage example:

from dinterpol import Template

data = {
    "product": "pie",
    "quantity": 33,
    "price": 14,
    "details": { "size": 10, "flavour": "orange"}
}

# simple key interpolation for string generation
Template("We have {quantity} pie(s)").render(data)
'We have 33 pie(s)'

# python expression for string generation, expression result concatnated with string
Template("Total price is {quantity * price}").render(data)
'Total price is 462'

# python expression for dict generation, type inferred directly from expression's eval()
Template({ "total": "{quantity * price}"}).render(data)
{'total': 426}

# Use attribute style references for key access
Template("{details.size}").render(data)
10

Code of Conduct

Everyone interacting in the dinterpol project's codebase, issue trackers, chat rooms, and mailing lists is expected to follow the PyPA Code of Conduct.

Release files for dinterpol 0.3.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dinterpol 0.3.6
File Size Uploaded
dinterpol-0.3.6.tar.gz 9.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dinterpol 0.3.6
File Interpreter ABI Platform
dinterpol-0.3.6-py3-none-any.whl Python 3 none any Details

Total release size: 20.5 kB

Release files / dinterpol-0.3.6.tar.gz

Download URL dinterpol-0.3.6.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c44c74d729f9879c5cb7c4bc113c376961e8c64bc02a215e2c91438713206026
BLAKE2b-256 checksum
How to use checksums
a2854ddd743ae1d0329edc53acf0932c4f863de5f05cb0c5ec29524fe10dcad0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / dinterpol-0.3.6-py3-none-any.whl

Download URL dinterpol-0.3.6-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc93aa75d5339fa8d8c9b59daea7ca952371ea83937b944dd344f73442f88c4a
BLAKE2b-256 checksum
How to use checksums
110d6cf6fcb2737ab4b7b9814fbf72616b34bfcf65c342fc4afc5ab70db62949
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.3.6 This release

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page