umapper
A small Python utility for wrangling dictionary keys: translate between snake_case, camelCase and PascalCase, turn nested dicts into attribute-accessible objects, and merge multiple dicts in one shot.
Installation
pip install umapper
Features
- Case translation — recursively remap all keys in a dict (or list of dicts) to snake, camel, or pascal case
- Object conversion — turn nested dicts into plain objects so you can write
response.userIdinstead ofresponse["userId"] - Dict assembly — merge several dicts at once, translate their keys, strip
Nonevalues, and inject extra fields, all in one call
Usage
Case translation
from umapper import Case, translate_case
data = {
'OutterField': {'inner_field': 123, 'sibling_inner_field': 321},
'siblingField': 'Hello',
}
translate_case(data, Case.SNAKE)
# {'outter_field': {'inner_field': 123, 'sibling_inner_field': 321}, 'sibling_field': 'Hello'}
translate_case(data, Case.CAMEL)
# {'outterField': {'innerField': 123, 'siblingInnerField': 321}, 'siblingField': 'Hello'}
translate_case(data, Case.PASCAL)
# {'OutterField': {'InnerField': 123, 'SiblingInnerField': 321}, 'SiblingField': 'Hello'}
Translation works on lists too — each element is converted independently.
Translation works on tuples too. Scalar values (strings, numbers, etc.) are returned as-is.
Object conversion
from umapper import Case, translate_case, convert_to_object
data = {'userId': 42, 'homeAddress': {'city': 'São Paulo'}}
obj = convert_to_object(translate_case(data, Case.SNAKE))
print(obj.user_id) # 42
print(obj.home_address.city) # São Paulo
translate_case is optional — use it beforehand when you want a specific attribute naming style on the resulting object.
Assembling dicts
assemble_dicts merges any number of positional dicts, translates all keys to a target case (camelCase by default), and lets you inject extra fields as keyword arguments.
from umapper import assemble_dicts
user = {'first_name': 'Ada', 'last_name': 'Lovelace'}
coords = {'lat': -23.5, 'lng': -46.6}
result = assemble_dicts(user, coords, active=True)
# {
# 'firstName': 'Ada',
# 'lastName': 'Lovelace',
# 'lat': -23.5,
# 'lng': -46.6,
# 'active': True,
# }
Options:
| Parameter | Default | Description |
|---|---|---|
mapping_case |
Case.CAMEL |
Target case for all keys. Pass None to skip case translation. |
include_nones |
True |
When False, keys whose value is None are dropped from the result. |
# Strip None values and use snake_case output
result = assemble_dicts(user, coords, mapping_case=Case.SNAKE, include_nones=False)
Registering custom mapping classes
Some libraries provide dict-like objects that don't inherit from collections.abc.Mapping. Register them so umapper traverses them correctly:
from umapper import register_mapping_class
register_mapping_class(MyCustomDictLike)
API reference
Full API docs are available on Read the Docs.
Metadata
Release files for umapper 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| umapper-0.1.6.tar.gz | 6.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| umapper-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.5 kB
Release files / umapper-0.1.6.tar.gz
| Download URL | umapper-0.1.6.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ebdacd07556edef770098e4b7e08c8580d68fce345b7c4c84666e80a7a11ffc1
|
|
BLAKE2b-256 checksum How to use checksums |
7a134c500178e4d209a0b90d4713654b2dbbf66bb9c92883aac43fa100865209
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logRelease files / umapper-0.1.6-py3-none-any.whl
| Download URL | umapper-0.1.6-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
16972c873e511993de6d1229ca0bb957de4036fa57a7bf1ce2a632823a5d3557
|
|
BLAKE2b-256 checksum How to use checksums |
2491e9d234c3f8e2c6332af0c3722dd865eee1d674e782b226d3abb031d45ebe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency log