MappingTools. Do stuff with Mappings and more.
Project description
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 |
|
🚀 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 (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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mappingtools-0.13.1.tar.gz.
File metadata
- Download URL: mappingtools-0.13.1.tar.gz
- Upload date:
- Size: 717.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4c27fbcdb825b244e104609f20f5e53e5230772d73d87f1dcaa52b917ba33dd
|
|
| MD5 |
d0695403554b030af550b4392b0c126b
|
|
| BLAKE2b-256 |
009726ca0370d7f2d8080a1648b4041a161bdce303a3031d704391ab743b2479
|
File details
Details for the file mappingtools-0.13.1-py3-none-any.whl.
File metadata
- Download URL: mappingtools-0.13.1-py3-none-any.whl
- Upload date:
- Size: 34.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b6c58a0d206e8fae295324daabedde8b540f1cb1aa8d224be80631a55ed5b41
|
|
| MD5 |
b8bb261ff6c917631ecf8e0da956611e
|
|
| BLAKE2b-256 |
9bc4029b52aef8018e63a6a98c8fb1bd189a648192aea52dd301cbd1272da7d5
|