from Hacker News

Show HN: Tach – Visualize and untangle your Python codebase

by the1024 on 2/25/25, 4:34 PM with 62 comments

Hey everyone! We're Evan and Caelean, the authors of Tach.

Tach lets you visualize the architecture of your Python codebase, and gives you the tools to incrementally improve it. It uses module boundaries to give teams the benefits of microservices without the deployment complexity.

If your code has been getting tangled up as your team and codebase grows, Tach helps you move back in the right direction, incrementally and quickly. You can use Tach to incrementally adopt a "modular monolith" architecture [1], for better local reasoning and smoother feature development.

Since our last Show HN (https://news.ycombinator.com/item?id=41359181) we've shipped support for layers, third party dependencies, visualizations, and more.

Tach is: * Open source (MIT) * completely free * fast (written in Rust) * in use by teams at NVIDIA, PostHog, and more.

One way Tach differs from existing systems that handle this problem (build systems, import linters, etc) is the ability to be incrementally adopted. Also, runtime speed.

If you struggle with dependencies, onboarding new engineers, or a massive codebase, Tach is for you! We built it with developers in mind - with clean integrations into Git, CI/CD, and IDEs, and the performance for it to be effective in any form factor.

[1] https://www.milanjovanovic.tech/blog/what-is-a-modular-monol...

  • by hansonkd on 2/26/25, 6:20 PM

    Really excited to see this project gain traction.

    > Note that this graph is generated remotely with the contents of your `tach.toml`

    Isn't shipping off parts of your codebase to a 3rd party without warning in the CLI a security risk? Or in regulatory environments you get audited that your code was only stored on properly vetted services which is why some sales cycles for AI coding assistant tools are so long. It would be kind of frustrating to have something like that happen and get set back on licensing, etc.

    Just from the video it doesn't seem like any sort of warning that you are shipping config files to your servers and the URL that you produced doesn't seem to have any authentication.

    Maybe i am misunderstanding that functionality, but it gives me pause to use it.

  • by godelski on 2/26/25, 11:31 PM

    I've been surprised that there hasn't been much progress in code tracing. It's incredibly hard to jump into a new code base. Cscope and ctags are still used but uncommon. It's not common to see people use debuggers. I suspect this is a major reason why Python and interpreted languages are so popular. But as code bases have exploded we still haven't gotten much better than where we were over a decade ago. Yeah RAGs can help but I'm not sure are a huge improvement over tags. Maybe realistically regressed, relying more on print statement debugging. When do we improve from gdb, cscope, grep, awk, and find? (I'm aware of the improved version of those but listen carefully if that's what you're jumping to respond with)

    So I'm really happy to see a project like this. Well done. Can't wait to see more

  • by stavros on 2/26/25, 8:21 PM

    We replaced our microservices architecture with a modular monolith and got tons of benefits, something I've been meaning to write up. However, while discussing that here, I was pointed to Tach, which looks fantastic if you have (or want to create) a modular monolith.
  • by drdrey on 2/26/25, 10:58 PM

    I would recommend installing it with

        uv tool install tach
    
    rather than

        pip install tach
    
    that way tach is installed system-wide but in its own isolated venv
  • by Attummm on 2/26/25, 10:44 PM

    This sounds great.

    Python is really great for quickly developing applications.

    However, maintaining them is a real pain point—especially when it comes to packages and their dependencies.

    Furthermore, because there isn’t a compile-time checker, function or method signatures can change unnoticed. Compilers are great for catching such issues at compile time rather than at runtime. Python does have mypy, which can play that role, but the package must support it. Currently, you are dependent on the package maintainer regarding their adherence to semver.

    Maybe this project will be able to fill that hole.

  • by tracnar on 2/26/25, 8:12 PM

    When I tried it, it seemed like you really need to list all modules in `tach.toml`.

    What I wanted was to work at a coarser package level. For example if you have the modules `foo.a`, `foo.b`, `bar.a`, and `bar.b`, I'd like a rule that `bar` can import from `foo` but not vice versa, without having to list or care about the submodules.

    Is that something you'd want to support?

  • by yogurt-male on 2/27/25, 1:04 PM

    This is great! Really wish that I'd known about this tool a month ago. Would have saved me a lot of headache. Thanks for sharing.
  • by adamc on 2/26/25, 6:32 PM

    Having the example be a video that changes was confusing at first, and if you are going to show me something that is changing, I would like to be able to rewind to the beginning. But really I just think it's a bad idea to show something like that without making it obvious what it is.
  • by benrutter on 2/26/25, 6:55 PM

    This looks nice! I vaguely know Grimp as a similar tool, any idea how they differ/compare?
  • by KronisLV on 2/27/25, 3:46 PM

    SourceTrail did something a bit similar, though it didn't focus just on the modules, but also what methods are called where. I really liked the tool, but it didn't really work out for them and they discontinued it: https://en.wikipedia.org/wiki/Sourcetrail
  • by jtwaleson on 2/26/25, 6:13 PM

    Cool! Do you have plans to launch a paid offering? The website makes me think it's a company but I didn't see any pricing / sales details.
  • by vednig on 2/26/25, 6:13 PM

    This is pretty cool, thanks for sharing
  • by lijok on 2/26/25, 6:22 PM

    Tools like this rub me the wrong way.

    We have well established conventions like prefixing private modules and symbols with an underscore, or declaring your public interfaces in the __init__.py file, but the Python developer decries it as "busywork", "weird" and "hard to read", so we instead use tools like this.

    We can manage dependencies with protocols, a type checker and generally following SOLID principles, but the Python developer decries it as "too indirect and convoluted", so we instead use tools like this.

    This is more commentary on the Python developer than this tool. Tach looks great.

  • by chairhairair on 2/27/25, 3:07 PM

    If this tool looks like it would improve your life I think you should consider using Bazel instead of whatever build system you are using. I don’t see much value add here for a project using Bazel.
  • by xtiansimon on 2/27/25, 1:21 PM

    Would this also apply to learning and exploring an unknown codebase?
  • by efitz on 2/27/25, 11:44 AM

    What kind of data set are you trying to build using the dependency information from collected toml files, and what do you intend to do with it?
  • by rubenvanwyk on 2/26/25, 8:21 PM

    Does this work together with uv?
  • by butterlettuce on 2/27/25, 2:47 AM

    Just wanted to say Caelean is such a cool name.

    Is it “kay-leen” or “kay-lee-an”

  • by willgax on 2/27/25, 6:41 AM

    do project like this exist for java spring boot it would be very cool if it could work on every codebase regardless of tech stack