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 |
|
| Code |
|
| Tools |
|
| CI/CD |
|
| Scans |
|
| Mentions |
|
🚀 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.19.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mappingtools-0.19.0.tar.gz | 754.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mappingtools-0.19.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 797.0 kB
Release files / mappingtools-0.19.0.tar.gz
| Download URL | mappingtools-0.19.0.tar.gz |
|---|---|
| Size | 754.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
61d733453acd5621cc84824f887b18b5894ac9aa2e7ac10cbcd869ce7b5fde8c
|
|
BLAKE2b-256 checksum How to use checksums |
24c764d09e7a69565e1382a2b65a5097462ee9a1d36ed2b5857453d00d0442a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / mappingtools-0.19.0-py3-none-any.whl
| Download URL | mappingtools-0.19.0-py3-none-any.whl |
|---|---|
| Size | 42.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fe03ba9afb4192e737056cd1f77e1bccdd783d88eb08c22cbbc508a71eade169
|
|
BLAKE2b-256 checksum How to use checksums |
f35f10bb692d169ad9eab5187b9ea4b5ff84aa481c05020210d109f2119d45ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|