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 basedpyright - checked 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.31.0.tar.gz (765.0 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.31.0-cp37-abi3-win_amd64.whl (3.4 MB view details)

Uploaded CPython 3.7+Windows x86-64

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

Uploaded CPython 3.7+Windows x86

dtach-0.31.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

dtach-0.31.0-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.31.0-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.31.0-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.31.0-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.31.0-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.31.0-cp37-abi3-macosx_11_0_arm64.whl (3.6 MB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

dtach-0.31.0-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.31.0.tar.gz.

File metadata

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

File hashes

Hashes for dtach-0.31.0.tar.gz
Algorithm Hash digest
SHA256 00eaee316ea48f0e40a6139db211ef5368a8772d8677dc84068025fd4a9069c2
MD5 93cc794604126739e9f32318cae12e5a
BLAKE2b-256 18300964c1be0302e940a0cb79d7fee287f6266e542bad41cee30512b417ac6f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dtach-0.31.0-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.31.0-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 506be8803ef260fcdf03fcfa5819d305af494d04451bb749a1ffe10ccd3fda98
MD5 8ba19c6395f0f93941f8c6a311d1a3fb
BLAKE2b-256 19405b2c00c4e2444a498d4d744bfa2cf1fee6ab3fb2bfb07893d29c382f565b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dtach-0.31.0-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.31.0-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 c709bb15b08c286e49e01269f6f1456cb99137ed17c45172d3b8735c735bb6bb
MD5 caf4927ef52c3d794ce71600530f3425
BLAKE2b-256 5b98ca2d55a215d4f4ceb38fed86af257cbf35a6dfe2532242b01a16a06e9809

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtach-0.31.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 673e8593606514d660dbcb445fdb7f4f6b17969074b2cae72ec6b7dbef6c6f52
MD5 636f7fabebd1887180e70b64258aa5f1
BLAKE2b-256 79e25b5626019524cb29013e7d974eee1c4d6fdd61c1dd5108ac9d8bdd6109c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtach-0.31.0-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 e89f5c46764f2acba55ce139a15c2633c51e557cc290b6445ead89e866f6c5ec
MD5 2dac9a1777ca9f1c1c10fd7bdb27df05
BLAKE2b-256 9e1ec12dd87c526d2d9b5b4e066e775a4d85dfab42023b3e74123494cd975c64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtach-0.31.0-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 a38e5fb88969f225911b72fccd8eedd1ce8b4515814ad3a356468eaa7bd65027
MD5 424deab9032eed2b8205c9cf4904edb2
BLAKE2b-256 c4f88f2a831f1d0fa02138e9af8aaa4bbc57224835f2299cf676655642af771c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtach-0.31.0-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 0435d74404c585653ee100a96cd23b7950e9c32dffd3de4325a05335248695ff
MD5 c50c10b2931c432ab8f2676d1e8c6c75
BLAKE2b-256 96d557743bf81d1436a8914b397d22328ac94eedc0ece26d37f1f258f5647676

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtach-0.31.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 b7960f962af49bac07da26cd48c0635ee802ef27abd1929c4ae2014be86fc5b6
MD5 3181a7b253f774eff927e9fff5fe6115
BLAKE2b-256 6b8bb3f51f4928c3a9314bac807e136c5918d4caaacd52de475527fa126908bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtach-0.31.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6d2cba27c8dba8387f3cf12407473ec7f536f886adea55e9b9e70c9281a6f015
MD5 4764526fd4080a5ee52b8496998986fd
BLAKE2b-256 8eee830c9f7c2068a3bbd0e8c5b7e46d9e40e5ca37a4efd4730c0bf70395a190

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtach-0.31.0-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 339dafac08c6b43a2eebdf0dac328a78eb4237794ed837dae970e8c557bfe611
MD5 fe84a28363c2ed48fa873bc38fcfbc16
BLAKE2b-256 b0f21f21f044f65ce2df9bed06f206e60cdde356215accb0b51df273d21ff993

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtach-0.31.0-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d27f7e0370d093f37218fe0a3485798f5aee95ea26d57a87aaad7c9403786b32
MD5 8633b770d1acf15da5952f76734bb2f4
BLAKE2b-256 95c67e9560ac033877523a29d303abcf675eb2540414b8d222646a5523e0bf36

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