Skip to main content

A Python tool to maintain a modular package architecture.

Project description

DTach

[!IMPORTANT] DTach is a fork of the unmaintained tach project.

downloads version license python pyright ruff

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

Tach is inspired by the modular monolith architecture.

Docs

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

uv (recommended)

uv add --dev dtach

pip

pip install dtach

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 submitting a Github Issue!


Contributors

Project details


Download files

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

Source Distribution

dtach-0.30.2.tar.gz (598.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

dtach-0.30.2-cp37-abi3-win_amd64.whl (3.4 MB view details)

Uploaded CPython 3.7+Windows x86-64

dtach-0.30.2-cp37-abi3-win32.whl (3.1 MB view details)

Uploaded CPython 3.7+Windows x86

dtach-0.30.2-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

dtach-0.30.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (4.5 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ s390x

dtach-0.30.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (4.2 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ppc64le

dtach-0.30.2-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (4.2 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ i686

dtach-0.30.2-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (3.8 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ARMv7l

dtach-0.30.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.9 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ARM64

dtach-0.30.2-cp37-abi3-macosx_11_0_arm64.whl (3.6 MB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

dtach-0.30.2-cp37-abi3-macosx_10_12_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.7+macOS 10.12+ x86-64

File details

Details for the file dtach-0.30.2.tar.gz.

File metadata

  • Download URL: dtach-0.30.2.tar.gz
  • Upload date:
  • Size: 598.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.7.1

File hashes

Hashes for dtach-0.30.2.tar.gz
Algorithm Hash digest
SHA256 8b057cadb9cad3ba03c98ef7ab364c170509c7b880e301ae69a7b2bcc36783df
MD5 ce21b26ea9c2fb27348ce179156bfeee
BLAKE2b-256 e5fb28437d81439fd1bcac2aff285ea30f152c43d8e028fffe212689e0e7d751

See more details on using hashes here.

File details

Details for the file dtach-0.30.2-cp37-abi3-win_amd64.whl.

File metadata

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

File hashes

Hashes for dtach-0.30.2-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e027fac9af611d836184e916fe3d9dee36a4714c776a2efc63034e62cc9a180d
MD5 c2e1480c86aae6351ef13fa064267d82
BLAKE2b-256 24bf9903fff8ddf3fbade1e17a970370557411d8906fb48d850bb9a4f87c1711

See more details on using hashes here.

File details

Details for the file dtach-0.30.2-cp37-abi3-win32.whl.

File metadata

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

File hashes

Hashes for dtach-0.30.2-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 b788edc78467946b9215bf020b70b68ed5f23dc39dfcace5913547379ec06f56
MD5 29180f3ee26820b22f6e0b0d9f5fcaab
BLAKE2b-256 e7d6e173680e47c2e57820f25a1ced40774061c807a083f9ec614e3b477c94ee

See more details on using hashes here.

File details

Details for the file dtach-0.30.2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dtach-0.30.2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e2a5a79c25e5ead7eb71c1df361abbb32879abc415930cfdabc0b40745a01c40
MD5 1aebb0fd2d1e8fd940988a7efef70481
BLAKE2b-256 af85bb95a6dd4d17b67735dfa0214d548293ef9c4bc3db5aff009c78ce9fbefb

See more details on using hashes here.

File details

Details for the file dtach-0.30.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for dtach-0.30.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 9b454583a2d6046a0d4f4a685a0de16d0b6de2b4f456a698c291ea21461b11a9
MD5 41b2b93b318b5ab824b28334c468176d
BLAKE2b-256 657afe4d13953d3b76881a366df910474b2b2628dbdb7b33b045c733d12eeef1

See more details on using hashes here.

File details

Details for the file dtach-0.30.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for dtach-0.30.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 a8dfd03a63214aefb2f89f04be4f66f060a912f0223f6dbab8ee36eb84a5ef2e
MD5 d98a8347adbf545cae789cd153ea6f2f
BLAKE2b-256 fb72554a93cca133a2a609431b793a3d7d2a30177d8f6a1ac8028effa9a7531e

See more details on using hashes here.

File details

Details for the file dtach-0.30.2-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for dtach-0.30.2-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 e6f518f9b49319196f19c12e16c533a223c97a345992e99146af92504835f9c8
MD5 32102e94fec85da935ad93d333f6c17a
BLAKE2b-256 1aed19f8cbfcf89e2eb44fa5453954b4fc69626d675c3914e6414222e013f891

See more details on using hashes here.

File details

Details for the file dtach-0.30.2-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for dtach-0.30.2-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 acc22fed25d8e78deb9cb876bcbb24409cb5c2caa447c651e1af68dd0737d2e4
MD5 67ce9788d33795a2fefe0c009023e9fd
BLAKE2b-256 d67ab175c538bbc808e183542653749ffac1ee51c0b51546f8fc220a1c255e9d

See more details on using hashes here.

File details

Details for the file dtach-0.30.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for dtach-0.30.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5063e6f6d3c5de1173b2153b0590f8ecc67fd821743d589684c8acce84b367d0
MD5 d5053754348c97f7deded5753950bdfb
BLAKE2b-256 052a8b28c989cd92fe4ee779b9862c52affa7b35fb81f0981f5ab1d122b2f5b8

See more details on using hashes here.

File details

Details for the file dtach-0.30.2-cp37-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dtach-0.30.2-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 68e8f18c495bb5dc5f34f1fdcff4d772eaf484c735a0fcd373c852f13b289715
MD5 b9811494f0fb3b17c7c2a22f421da787
BLAKE2b-256 9f22b66929827679725afc36558e49204db7c9d32edb94bfa29a2156baac9c36

See more details on using hashes here.

File details

Details for the file dtach-0.30.2-cp37-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for dtach-0.30.2-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 05fa94132a81e4f5a91384a475c6293da2695620f5ee5ddd840ba7c1a84bf613
MD5 caf19db2772f5583994239fe4c99c65b
BLAKE2b-256 9026a671167bafbd920593602545fbc6c4f59a26f1cbd49186f7962b9e267a08

See more details on using hashes here.

Supported by

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