Skip to main content

A Python tool to maintain a modular package architecture.

Project description

Tach

downloads version license python ci pyright ruff

Tach is a Python tool to enforce dependencies and interfaces, written in Rust.

Tach is inspired by the modular monolith architecture.

Docs

Discord

gauge-logo

https://github.com/user-attachments/assets/11eec4a1-f80a-4f13-9ff3-91a9760133b6

Tach can enforce:

Tach is:

  • 🌎 Open source
  • 🐍 Installable via pip
  • 🔧 Able to be adopted incrementally
  • ⚡ Implemented with no runtime impact
  • ♾️ Interoperable with your existing systems

Getting Started

Installation

pip install tach

Setup

Tach will guide you through initial project setup.

Run:

 tach init

After an introductory message, you will see a file tree interface allowing you to interactively configure your project.

Use the arrow keys to navigate, and mark each module boundary with 'Enter'. You can mark all of your top-level Python packages, or just a few that you want to track.

FAQ: What is a module?

If your Python code lives below your project root, or if you are working in a monorepo with multiple Python packages, mark your Python source roots using the 's' key.

Enforcement

Tach comes with a cli command to enforce the boundaries that you just set up! From the root of your Python project, run:

tach check

You will see:

 All modules validated!

You can validate that Tach is working by:

  1. Removing an item from the depends_on key in tach.toml, or marking it as deprecated
  2. By adding an import between modules that didn't previously import from each other.

Give both a try and run tach check again. This will generate an error:

 tach/check.py[L8]: Cannot use 'tach.filesystem'. Module 'tach' cannot depend on 'tach.filesystem'.

Each error indicates an import which violates your dependencies. If your terminal supports hyperlinks, click on the file path to go directly to the error.

When an error is detected, tach check will exit with a non-zero code. It can be easily integrated with CI/CD, Pre-commit hooks, and VS Code, and more!

Extras

Visualize your dependency graph.

tach show [--web]

Tach will generate a graph of your dependencies. Here's what this looks like for Tach:

tach show

Note that this graph is generated remotely with the contents of your tach.toml when running tach show --web.

If you would like to use the GraphViz DOT format locally, simply running tach show will generate tach_module_graph.dot in your working directory.

You can view the dependencies and usages for a given path:

tach report my_package/
# OR
tach report my_module.py

e.g.:

> tach report python/tach/filesystem
[Dependencies of 'python/tach/filesystem']
python/tach/filesystem/install.py[L6]: Import 'tach.hooks.build_pre_commit_hook_content'
python/tach/filesystem/project.py[L5]: Import 'tach.constants.CONFIG_FILE_NAME'
...
-------------------------------
[Usages of 'python/tach/filesystem']
python/tach/cache/access.py[L8]: Import 'tach.filesystem.find_project_config_root'
python/tach/cache/setup.py[L7]: Import 'tach.filesystem.find_project_config_root'
...

Tach also supports:

More info in the docs. Tach logs anonymized usage statistics which can be opted out of. If you have any feedback, we'd love to talk!

If you have any questions or run into any issues, let us know by either reaching out on Discord or submitting a Github Issue!


Contributors

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tach-0.29.0.tar.gz (519.9 kB view details)

Uploaded Source

Built Distributions

tach-0.29.0-cp37-abi3-win_amd64.whl (3.4 MB view details)

Uploaded CPython 3.7+Windows x86-64

tach-0.29.0-cp37-abi3-win32.whl (3.1 MB view details)

Uploaded CPython 3.7+Windows x86

tach-0.29.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ x86-64

tach-0.29.0-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (4.5 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ s390x

tach-0.29.0-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (4.2 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ppc64le

tach-0.29.0-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (4.2 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ i686

tach-0.29.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (3.8 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ARMv7l

tach-0.29.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.9 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ARM64

tach-0.29.0-cp37-abi3-macosx_11_0_arm64.whl (3.6 MB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

tach-0.29.0-cp37-abi3-macosx_10_12_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.7+macOS 10.12+ x86-64

File details

Details for the file tach-0.29.0.tar.gz.

File metadata

  • Download URL: tach-0.29.0.tar.gz
  • Upload date:
  • Size: 519.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.7.1

File hashes

Hashes for tach-0.29.0.tar.gz
Algorithm Hash digest
SHA256 0b27b9265eee34f396515a2e918fa783d3d02e69edfb6ea1dfd1843d49021429
MD5 cff147ffd410d6e86186bf7ac7e74820
BLAKE2b-256 c00371dc08afb67a98f75f338cbe06cafa4d4266a80b5f3192fae73289a38412

See more details on using hashes here.

File details

Details for the file tach-0.29.0-cp37-abi3-win_amd64.whl.

File metadata

  • Download URL: tach-0.29.0-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.4 MB
  • Tags: CPython 3.7+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.7.1

File hashes

Hashes for tach-0.29.0-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 2e15ceb80fc25435d18e01d10029fec15a54fb53bf6b430d53c4ecb53859a0ff
MD5 1a1864113dbe220ac281555fb5498cf0
BLAKE2b-256 6ecf6ddbcd4d32204698868e20afd8dcbd88dac1160d5fdf45df921852d27d29

See more details on using hashes here.

File details

Details for the file tach-0.29.0-cp37-abi3-win32.whl.

File metadata

  • Download URL: tach-0.29.0-cp37-abi3-win32.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: CPython 3.7+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.7.1

File hashes

Hashes for tach-0.29.0-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 d65408ec003ec16bdab4ef61990d7cfc0551672d145a78f80a4aef71e8714b9b
MD5 da82f2e359ca84053ef323c140b620cc
BLAKE2b-256 6873328d8c6b3a84e91a3295eb173df1c702f992af1963f069549c15db07ef37

See more details on using hashes here.

File details

Details for the file tach-0.29.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tach-0.29.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 58443cbd3f5d19d6b98cd3508593eae186c91f0e059c8bcf1348e3849095b622
MD5 c442e157831634ab5daf46be9a36751b
BLAKE2b-256 611158b54ba5a1ec9d7bddcf60016b2bddb9676cf2c201b65c4cfe29876681ce

See more details on using hashes here.

File details

Details for the file tach-0.29.0-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for tach-0.29.0-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 a7b8c82943f4ed72612282ff35c155fcca7222b9e9cd2864763b67497729f0c3
MD5 432d14111873ac93287d7c03fef65ce2
BLAKE2b-256 0433714a981282178f93443c66e6f225f49981c4275cb9dd522c6d842c4931fb

See more details on using hashes here.

File details

Details for the file tach-0.29.0-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for tach-0.29.0-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 810e5aaa2e936c8417bb91672708886aadaf8ab116763ae418c6b1b961422bba
MD5 423fa02d008d9faa8e8fe42f1863b260
BLAKE2b-256 4ef999dcef880d9bcd4e707dc92a6ed3058eb61fd6e091aa55623c4699cbf04a

See more details on using hashes here.

File details

Details for the file tach-0.29.0-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for tach-0.29.0-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 52903e54683b0aa26bd4ef0c9ed68b34480a3fbf83fb7b32e9d6a9908e2761e1
MD5 abba3e8db0fb5b195c7fce0ea1d774c8
BLAKE2b-256 646760b50347aca9ef17f934eb72fe51691062d2acc9142742decc9427a6527a

See more details on using hashes here.

File details

Details for the file tach-0.29.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for tach-0.29.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 3b40c59e9a1d0b28fc6176736876c4cfa2d01114870d539e9989dfb7c6638139
MD5 8275538e0e36f41ed46d34e18168f507
BLAKE2b-256 ef56859a9911674e052c2aa3d4369a177ab5eb5eb28d5429244b6cbfe0333df1

See more details on using hashes here.

File details

Details for the file tach-0.29.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tach-0.29.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 42e0bbecf5e8ea23791b62e54e7c8065376e8a7f642a232dcef8bcae0149944e
MD5 a7ac27207ae7861876c24cbcc4c22797
BLAKE2b-256 1df930d821984b85ba8a1f60bd00f9025d61e3a69ecbc496fd938df119ce994b

See more details on using hashes here.

File details

Details for the file tach-0.29.0-cp37-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tach-0.29.0-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d984f54bebba0e4c981d2a08c3e4cdf76c3b5f3126e2f593a0faaed9d218552a
MD5 c4c25884aff56af69e57ee35441d8ef0
BLAKE2b-256 753c163f18f282dd4d17db3b21f9098f30d94a8bab889e81894b5deeb4648456

See more details on using hashes here.

File details

Details for the file tach-0.29.0-cp37-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for tach-0.29.0-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 517f33d18d381326a775d101650e576c6922db53b2c336192db7db88b9a3521d
MD5 657091ffbaac75b6baaf162a8a19bd98
BLAKE2b-256 c2761dab7edd475c5a4992caa5c5f62db573c4ba8b8f66908f180063177236e4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page