Skip to main content

MakeFlatt

Simple library to make your dictionary flatten in Python

PyPI version PyPI - Python Version Unit Tests Code Style PyPI - License

Installation

pip install makeflatt

Usage

Quick start:

>>> from makeflatt import FlattMaker
>>> mf = FlattMaker()
>>> mf.apply({"a": {"b": {"c": "test"}}})
{'a.b.c': 'test'}

Make nested structured flatten:

>>> mf.apply({"a": {"b": ["b1", "b2", "b3"]}})
{'a.b.0': 'b1', 'a.b.1': 'b2', 'a.b.2': 'b3'}

If you don't wan't to expand nested lists you can set include_lists to False:

>>> mf.apply({"a": {"b": ["b1", "b2", "b3"]}}, include_lists=False)
{'a.b': ['b1', 'b2', 'b3']}

You can also change the separator and define your own:

>>> mf = FlattMaker(sep=":")
>>> mf.apply({"a": {"b": ["b1", "b2", "b3"]}})
{'a:b:0': 'b1', 'a:b:1': 'b2', 'a:b:2': 'b3'}

License

MakeFlatt is released under the MIT Licence. See the bundled LICENSE file for details.

Development

Check the CONTRIBUTING file.

Versioning

This package attempts to use semantic versioning. API changes are indicated by the major version, non-breaking improvements by the minor, and bug fixes in the revision.

It is recommended that you pin your targets to greater or equal to the current version and less than the next major version.

Maintainer

Created and maitained by Jonathan Schweder (@jaswdr)

Metadata

Release files for makeflatt 1.0.4

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

Source distribution (sdist)

Source distribution for makeflatt 1.0.4
File Size Uploaded Provenance Actions
makeflatt-1.0.4.tar.gz 3.4 kB Without provenance Details for makeflatt-1.0.4.tar.gz

Built distribution (wheel)

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

Total release size: 6.8 kB

Release files / makeflatt-1.0.4.tar.gz

Download URL makeflatt-1.0.4.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
25b2b4533ec01a5841f23b53431baa83713a090f09e548b633923e33f47c8896
BLAKE2b-256 checksum
How to use checksums
8eba70be3905af2492cfaf80141d91819df17eae19c50501e295c2bcec3f6eef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.8.15 Darwin/21.6.0

Release files / makeflatt-1.0.4-py3-none-any.whl

Download URL makeflatt-1.0.4-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f76931c4d804cfd8eeff956c836346632c977f291e7628e899a0c6454fd39ce
BLAKE2b-256 checksum
How to use checksums
ea60657994e7b9507924b02f8cfdafa7b5b6d199d3d6edff37e025989d01a094
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.8.15 Darwin/21.6.0

Security for makeflatt 1.0.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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