Skip to main content

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mappingtools-0.18.1.tar.gz (749.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mappingtools-0.18.1-py3-none-any.whl (42.7 kB view details)

Uploaded Python 3

File details

Details for the file mappingtools-0.18.1.tar.gz.

File metadata

  • Download URL: mappingtools-0.18.1.tar.gz
  • Upload date:
  • Size: 749.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mappingtools-0.18.1.tar.gz
Algorithm Hash digest
SHA256 df9feb8711196deb57ffe51d3d6fbfb02fc824b0d3f5bdeeee3a8d5b98245dca
MD5 9dda40a780fb1b5585d0c4087e196902
BLAKE2b-256 76e5c2f59ca99903b4b9f18a2e439788dce7960fd3e55a147fc46f1416ac533c

See more details on using hashes here.

File details

Details for the file mappingtools-0.18.1-py3-none-any.whl.

File metadata

  • Download URL: mappingtools-0.18.1-py3-none-any.whl
  • Upload date:
  • Size: 42.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mappingtools-0.18.1-py3-none-any.whl
Algorithm Hash digest
SHA256 12c112cf8348e45c9641d7bb0129eb5a0df085e08f3c70f9b1d31f0c0ba2e143
MD5 7745ace2211f43cb05f89577596ff513
BLAKE2b-256 7444b19f69c59ac6b9b383bd97887578db1b0ddd7d63d1e7a29e4092f1d53adf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page