Tach: Enforcing Python Dependencies with Modular Architecture

Tach: Enforcing Python Dependencies with Modular Architecture

Summary

Tach is an open-source Python tool, written in Rust, designed to visualize and enforce dependencies within your projects. It promotes modular architecture by ensuring declared dependencies, public interfaces, and preventing dependency cycles. Installable via pip, Tach offers incremental adoption and no runtime impact.

Repository Info

Updated on February 26, 2026
View on GitHub

Tags

Click on any tag to explore related repositories

Introduction

Tach is an open-source Python tool, implemented in Rust, designed to help developers visualize and enforce dependencies within their projects. Inspired by the modular monolith architecture, Tach ensures a clean and maintainable codebase by defining clear boundaries and rules.

Key capabilities of Tach include:

Tach is highly adaptable, offering incremental adoption, no runtime impact, and seamless interoperability with existing systems.

Installation

Getting started with Tach is straightforward. You can install it via pip:

pip install tach

Examples

Project Setup

Tach provides an interactive command to guide you through the initial project setup. Run tach init to configure your module boundaries and source roots.

tach init

Dependency Enforcement

Once configured, use tach check to validate your project's dependencies against the defined rules. This command is ideal for integration into CI/CD pipelines.

tach check

Dependency Visualization

Visualize your project's dependency graph with tach show. The --web flag generates an interactive web-based graph, or you can generate a local GraphViz DOT file.

tach show [--web]

Detailed Reporting

To inspect dependencies and usages for a specific path or module, use the tach report command:

tach report my_package/

Tach also supports a range of advanced features, including public interfaces for modules, deprecating individual dependencies, layered architecture, incremental adoption for unchecked modules, generating JSON dependency maps, and integration with pre-commit hooks.

Why Use Tach?

Tach empowers development teams to maintain robust and scalable Python applications by enforcing architectural discipline. By preventing common issues like tangled dependencies and hidden interfaces, it significantly improves code quality, reduces technical debt, and streamlines onboarding for new team members. Its Rust implementation ensures high performance, while its incremental adoption strategy makes it easy to integrate into existing large-scale projects without disruption.

Links