Skip to main content

MappingTools

Do stuff with Mappings and more

This library provides utility functions for creating, manipulating, and transforming data structures, which have or include Mapping-like characteristics.

Including inverting dictionaries, converting class-like objects to dictionaries, creating nested defaultdicts, and unwrapping complex objects.

Package PyPI - Version PyPI - Status PyPI - Python Version PyPI - Downloads PyPI - Dependents Libraries.io SourceRank
Code GitHub GitHub repo size GitHub last commit (by committer) Contributors
Tools PyCharm uv Ruff Hatch project commitizen Zensical
CI/CD Test Publish Publish Publish Docs
Scans Coverage Quality Gate Status Security Rating Maintainability Rating Reliability Rating Lines of Code Vulnerabilities Bugs Codacy Quality Codacy Coverage CodeFactor DeepSource DeepSource Snyk

🚀 Why use MappingTools?

Built for developers who need more than just standard dictionaries.

Problem Solution
Boilerplate Reduction Use Dictifier to broadcast method calls to a collection of objects (users.greet() instead of a for loop).
Deep JSON Diffing Use flatten() to collapse nested JSON into single-layer paths for easy comparison.
Data Collisions Use inverse() to swap keys/values without losing data (automatically creates sets for duplicates).
Slow Config Loading Use MeteredDict to profile exactly how many times your app reads specific config keys.
Quick Serialization Use simplify() to instantly convert Dataclasses, DateTime, and custom objects into pure Dicts.
Complex Grouping Use reshape() to pivot lists of dicts into N-dimensional nested dictionaries (tensors).
Key Remapping Use rename() or rekey() to transform dictionary keys using functions or maps.
Multi-Dimensional Counting Use CategoryCollector to aggregate data into multiple buckets simultaneously (e.g., by type AND by status).
Safe Deep Modification Use Lens to immutably update nested values without cloning the entire structure manually.

Documentation

https://erivlis.github.io/mappingtools/

Development

Ruff

ruff check src

ruff check tests

Test

Standard terminal Coverage Report

python -m pytest tests --cov=src --cov-branch --doctest-modules --cov-report=term-missing

Standard (cobertura) XML Coverage Report

python -m pytest tests --cov=src --cov-branch --doctest-modules --cov-report=xml

HTML Coverage Report

python -m pytest tests --cov=src --cov-branch --doctest-modules --cov-report=html

Metadata

Release files for mappingtools 0.18.2

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

Source distribution (sdist)

Source distribution for mappingtools 0.18.2
File Size Uploaded
mappingtools-0.18.2.tar.gz 749.6 kB Details

Built distribution (wheel)

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

Total release size: 792.4 kB

Release files / mappingtools-0.18.2.tar.gz

Download URL mappingtools-0.18.2.tar.gz
Size 749.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3b85207addd892077f518f89fa5621990e355603bccf3285c896982db1f6ad06
BLAKE2b-256 checksum
How to use checksums
f8dd06ab9213a99de60f1dcefd8e1c740926c3124b0c221a76bc63e1f085830d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / mappingtools-0.18.2-py3-none-any.whl

Download URL mappingtools-0.18.2-py3-none-any.whl
Size 42.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aac2113258776f12b82794debe11208f5a77841ebe59e23272105406ca09df18
BLAKE2b-256 checksum
How to use checksums
a42ccc79fe0efe6624867170c624404472f8e24380ad3fc3b0f282304268e480
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.18.2 This release

2 release files

0.18.1

2 release files

0.17.1

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

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.0

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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