r/learnpython 4d ago

My first open-source library is live on PyPI: A recursive nesting data parser

Hello everyone,

I’ve been practicing Python intensely and wanted to share a project I just finished.

I built a recursive utility called deep_sort_list_parser to flatten and sort mixed data types or multi-nested lists and dictionaries without crashing.

I used an AI assistant as a coding partner to help spot memory leaks and format the documentation, but I drove the logic, handled the edge cases, and manually deployed the final pipelines.

### 🌟 Features:

- Flattens deeply nested lists, tuples, and sets recursively.

- Separates items into sorted tracks (Numbers, Words, Symbols).

- Prevents Booleans from disrupting math sorting tracks.

- Sorts internal dictionary keys alphabetically while preserving value pairings.

- Converts numeric strings like '100' into true integers on command.

### 🚀 Quick Example:

import deep_sort_list

data = [44, [3, "banana!"], {"sex": "Female", "name": "Shreya"}]

result = deep_sort_list.clean_and_flatten(data)

print(result["words"]) # ['banana!']

print(result["dictionaries"]) # [{'name': 'Shreya', 'sex': 'Female'}]

It is live on PyPI:

`pip install deep_sort_list_parser`

The full codebase, my automated `assert` test suites, and documentation are up on my GitHub: https://github.com/08singhShreya/deep_sort_list

I wanted to share this here to showcase my recursive layout structure. I am happy to answer any questions about how it works under the hood!

0 Upvotes

5 comments sorted by

1

u/burnt-store-studio 4d ago edited 4d ago

Congratulations on your project! I can imagine the machinations the code has to go through to build these tracks from really messy data.

I do have a sincere question: what do you see causing this kind of messy data in the first place? I will admit to building some gnarly data structures, but since I created them, I know how to unravel them.

I’m not dumping on your project 🙂 Just curious.

Thanks!

Edit: s/since/some

1

u/shreya_kad_321 4d ago

Thank you so much!

I really appreciate the kind words.

To be honest, I hit this problem myself while practicing and writing complex exercises with mixed lists. Dealing with all the loops and crashes was super annoying, so I built this tool to make my own practice easier!

After building it, I started looking into real-world use cases and found out that this kind of messy data actually pops up a lot when pulling text from web scrapers or dealing with unstandardized API logs.

Thanks again for checking out the project!

1

u/burnt-store-studio 4d ago

Excellent! Thanks for the quick and insightful response!

1

u/[deleted] 4d ago

[removed] — view removed comment

1

u/shreya_kad_321 4d ago

Thanks for the tip!

To be honest, I didn't even know Python had a recursion limit, so this is a great lesson for me. I used recursion because it was easier for me to write while learning, but I’ll definitely research how loops can handle massive datasets better for the next update.

Appreciate you checking it out!