Skip to main content

CLi + module to deeply flatten nested structures like a pro

Project description

flatten-utils

PyPI version

Downloads

License: MIT

🔧 A lightweight utility to deeply flatten nested Python structure like 'lists', 'tuples', 'sets','dicts' and more -- without breaking a sweat.

🚀 Features

  • 🌀 Deep flattening of arbitrarily nested structures
  • 🔂 Control flatten depth with '--depth'
  • ➖ Stop flattening at specific types like 'str', 'bytes', 'dict' with '--stop_at'
  • 📦 Use as both an Python module and a CLI tool
  • 📁 Read Input from files or strings
  • 🎨 Pretty-printing support with '--pretty'

Usage Example

As a CLI tool:

'''bash

flatten-utils "[1, [2, [3, 4]]]"

Output: [1, 2, 3, 4]

flatten-utils --file input.json --depth 2 --pretty

📦 Installation

✅ From PYPI (recommended)

pip install flatten-utils

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

flatten_utils-0.1.3.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

flatten_utils-0.1.3-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file flatten_utils-0.1.3.tar.gz.

File metadata

  • Download URL: flatten_utils-0.1.3.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for flatten_utils-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d065795723a63bcd6b3189551cab1f61aa1ea1704f4dde6bdaa56af483b04980
MD5 0881b9f65e615353245fec8edfdc4489
BLAKE2b-256 165578820a6dd3260767dc710f98f3bd914d7b1182f250039619abeb327dbb4c

See more details on using hashes here.

File details

Details for the file flatten_utils-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: flatten_utils-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for flatten_utils-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0aa80d8e0a15c9675eb181078129f82c28bf12be132c1a95ad789a683f9587f7
MD5 2ec4d5d5ff1147785ba4e5a8c7e5a8eb
BLAKE2b-256 1db46f07b4ceea68b38267d368140842587a264cc40fbda83374bc5ce5cc7a91

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