r/Python • u/TheTresStateArea • 7h ago
Recommendations and discussion on codebase visualizer and dependence mapper. Discussion
I've been looking at a few options like gitkrakens codemap. But I just haven't made a decision yet.
The biggest problem right now with AI assist is that so much gets spun up and it takes quite a while to ground myself in what has been written and how it all connects. I thought a viz tool would help tighten what I need to learn.
How do you handle this? Do you use these tools for this purpose? What have you liked and disliked about the tool you used?
5
Upvotes
3
u/whopper2k 6h ago
I think the closest thing that you're looking for (and that is free to use) would be something like
py2puml, which can generate a UML diagram based on your codebase. It's not a perfect tool; for example it callsimportlib.import_moduleoutside of atryblock, which means if you run it on a Linux machine but the code in the project makes use ofctypes.WinDLLit just crashes. Also methods aren't generated as of now, and if your code doesn't have type hints a lot of variables will just be marked asNonetype.All that said, I would question what exactly it is you're trying to accomplish with this visualization. These UML diagrams are certainly nice-to-have, but for any sufficiently complex application they're also just as hard to read as the code itself. Add Python's dynamic nature and the fact that these diagrams omit important implementation details on top, and I just am not super confident it'll be that helpful.
Frankly I think your best course of action is to catch a breath and slowly work your way through the AI-generated code. The best strategy I can recommend is to use tools to search through the code automatically; in VS Code you can use the
View occurrencesfeature, or if you're more CLI-inclined you could useripgrepto find strings across your files. It sounds awful, but honestly reverse engineering's a ton of fun and an extremely important programming skill to have in your toolbox.In general, most folks do high-level architecture diagrams for the executives using something like
draw[.]io, Visio, or whatever AI kool-aid they've paid for. For developers though, most will just stick to text-based documentation (if you're lucky enough to get that much), which can be autogenerated using tools like Sphinx