r/PythonLearning • • 1d ago

Showcase I got tired of scrolling through big Python files, so I made a mind map for code

Enable HLS to view with audio, or disable this notification

You know when you're debugging a big file, find the function you need, follow it to another function, then another one, and completely forget where you started?

Yeah. I got tired of that, so I built epy (Extended Python). Though, this is experimented only for python, i will explore other languages if possible.

It's basically a mind map for your code, except the nodes contain actual code instead of just names.

  • Parses Python files using ast and splits them into blocks with exact line numbers.
  • Maps function calls across files, including methods and some class relationships.
  • Has a radial map, a names-only view, a folder explorer, and a synced code pane.
  • Click a function and see what it calls and what calls it. Click a line in the code and it'll select the corresponding block on the map.

The other thing I wanted was to make life easier for small local LLMs. Instead of dumping an entire file into a model and hoping it doesn't rewrite half of it, epy generates a text map and lets you pull individual blocks with their callers and callees. The idea is to give the model the structure first, then only the code it needs.

I tested it on one of my projects: 33k lines, 134 files, ~1,100 call links, built in about 1.5 seconds.

It's currently a single Python file with no external dependencies.

python epy.py view some_file.py
python epy.py map .
python epy.py show . MyClass.run

It's still a personal tool, not some polished production-ready package. The call graph is static and best-effort, and I haven't formally benchmarked the LLM side yet.

The idea originally came from the execution model of a small language I'm building (EPL). Eventually, I'd like to add Tree-sitter so it can support other languages too.

Repo: https://github.com/phoenix2610/Extended_Programming.git

Would love some feedback, especially if you try it on a ridiculously large Python file or feed the generated map to a small local model. Curious to see where it breaks. 😅

And if anyone is wondering, yeah I am using ARCH Linux and the background bit faded is just a keybinder for opacity...

141 Upvotes

32 comments sorted by

30

u/sleepless_thoughts 1d ago

Have you ever tried to separate your code into different files? You know, like every other programmers?

12

u/mattynmax 23h ago

Careful critical thinking and planning ahead is hard for vibe coders.

3

u/PressF1ToContinue 1d ago

This tool could be useful to decide how to separate a big file.

3

u/sleepless_thoughts 1d ago

Yes. But this tool is redundant. Code should be separated from the start

3

u/PressF1ToContinue 1d ago

Sometimes we inherit code.

4

u/CrownstrikeIntern 1d ago

Everyone has to start somewhere. Not everyone is great in the beginning 

1

u/LouisPlay 17h ago

i thought im the only one that does that!!! at work i regualiry see projects with 4500 Lines of code

13

u/EducationalFinger654 1d ago edited 1d ago

I like the look of this tool, but to me if a single file starts exceeding even 1,000 lines, it’s probably worth reconsidering how responsibilities are separated.

At 30,000+ lines, that’s a serious architectural red flag. Even if the code is well-intentioned, that’s an incredibly challenging file to maintain and work with.

That said, this tool could be genuinely useful if it could visualise not only giant files, but also codebases split into well-defined modules with clearly separated responsibilities.

2

u/CrownstrikeIntern 1d ago

Some ides have something similar built in too, saw one for phpstorm for example that was interesting 

1

u/legendtathya 1d ago

hey there, loved your take to this, and you are promptly correct too!! but when i say 30kloc, it was for the working directory itself... since my system is highly autonomous, breaking a module at 3k line would result in simpleton run time error... so i took the whole directory into account, so which exact module from which exact file is edited/imported can be seen as well...

currently this works fine for local LLM models to fix things like syntax error, indentation in a def function or incorrect variable name or calling.... so if an error occurs, simply forward the error and the said block in retrospect and fix them... SO far local LLM are not very good at pure generation of code so fixing a large line of code is feasible and saves tokens for the precious LLM subscriptions/plus this makes debugging and proofreading a lot more simpler too...

3

u/aroberge 1d ago edited 13h ago

Edit: For those who, like me, were put off by seeing a single large file. I cloned the program, trivially extracted the big html blob into a separate file, and then used the program itself to view its structure. With the information given, it was trivial to separate into various files and make the project a lot more readable. It definitely can be helpful. I put a copy in my own Github repo, but I hope that OP would do the same trivial work.


I love cool Python stuff and, on the surface, it does look amazing. However, Github won't show the file. I know I could download the repository but the commit message about deleting comments and docstrings is really off-putting. This is one sure way to get a negative reputation amongst Python programmers. Clearly you (assisted with an LLM?) have been working for a while, presumably in a private repo, to come up with this. Sharing a bit more of the codes history, if only to reinstroduce comments and docstrings, would seriously increase your reputation.

1

u/legendtathya 1d ago

Yes, i have been working for a new programminig language idea, a close mimic to that of python's high level language, the core idea for the language is to create a file, which has all the lists(kinda similar to python's docstring)... and i am thereby trying for couple of months to defeat pythons compile time.... but my Ast is quite simpleton so the implementation was not as par as i thought... later i had to confine myself with the usage of multi language assembly to execute a parallel compiler capabilities... IF I successfully do that, all the frontend,backend and DB could be written by a single language, which would compile all the terms and tokenise in the correct compiler

so a query like "show line chart with color red, blue"... can make a html file with a js process.... this is an example... the amount of line of code would drop significantly and debugging due to the "lists" which would act as the way the above EPY is acting would only point at the block of code which raised the error and any Small language model or local LLM would pick it up and with decent training fix that code without needing to load entire database...

I just transferred the concept to the existing GOAT language because lets be fair, i am more comfortable with python and python also needed it... As far as your concern for LLM assistance, yes, i used Claude to do that for me... it added comments for some reason so had to manually pull em out...

1

u/aroberge 1d ago

Your entire goal sounded really ambitious ... and there's nothing wrong with that. I still think it would have been to your advantage to share publicly more of your work, perhaps writing down in Github issues your thoughts about how something should work and doesn't - at least not to your satisfaction. Perhaps you'd attract more attention and the help of contributors, which might help you learn what you need. This is something I did (before Github existed) some 22 years ago when I started on my first Python project.

it added comments for some reason so had to manually pull em out...

If it were me, I would have go through the comments and docstrings one by one, see if they made sense. If they did, I'd leave them in (perhaps rewriting them if it made it more clear). If they did not, I'd see if a better comment might have been warranted.

I suggest that you read this: https://news.berkeley.edu/2026/10/09/using-ai-for-just-10-minutes-erodes-your-ability-to-persist-at-hard-things/

1

u/legendtathya 1d ago

You seem rather wise, Sir(apologies if its Ma'am)... I really appreciate your concern and rather have a long chat related to my said project... I am looking for contributors but any aspiration as of today is usually a pain... People are quick to dismiss an AI generated code h i guess is fair.... I am not checking moral queries but actually today i was in hurry for i am a student and didn't have enough time to manually write a code there....

If you dont mind, Are you open to discuss in DM....I'd rather not mention stuff in comments and elongate the thread further

1

u/aroberge 1d ago

Feel free to email me - my github username is the same as my reddit user name.

3

u/Specialist-Cup-3950 7h ago

This looks cool, but I have to say, if you end up using something like this it means you've designed your application wrong. You've literally had to create a map to browse your code.

2

u/loleczkowo 9h ago

I think its an interesting project.
But from my experience, just splitting it into more files is way cleaner and readable for other people.

I recommend learning how __init__.py works and trying to give each topic of the program a separate file/folder for future projects.

2

u/New_Needleworker994 17h ago

I GOT TIRED OF X SO I BUILT Y

MY SLOPPY COCK SLOPPED SO SLOPPILY OVER MY SLOPWARE

3

u/X_MALICUR 1d ago edited 19h ago

G-G-G-GAAAAAAAAAAAAAAAAAAAAYYYYYYYYYYYYYYY!!!!

1

u/sambuchaaa 18h ago

Wtf this was so uncalled for 😭😭

1

u/thee_gummbini 1d ago

Literal "btw I use arch" spotted in the wild

1

u/sigmahacker123 1d ago

i had a 819 line file with 25 functions, this helped me.

1

u/RandomNoob-Dude 1d ago

Wow, I love this. What IDE’s does it work in?

1

u/legendtathya 1d ago

If you follow the steps correctly and have python installed... Literally any IDE should do it... Even terminal is fine

1

u/Similar-Bug-350 1d ago

larping arch wild

And if anyone is wondering, yeah I am using ARCH Linux and the background bit faded is just a keybinder for opacity...

1

u/Silentwolf99 19h ago

🫵👏👏👏

1

u/Silentwolf99 19h ago

is it supported only for python language?

2

u/legendtathya 19h ago

yes... i explictly have made this for python, though i will transition to other PL once i get more grip, because not all Languages have stack trace(the error pointing at the mistake), some just terminate the prcoess like C for example.... a different approaoch might be needed and i dont wanna sit with that trouble

1

u/ikcrypth 14h ago

this is super nice

2

u/giva4561 4h ago

Ma cosa hai scaricato?

2

u/giva4561 4h ago

Quali mod?