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.2.tar.gz (764.7 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.2-cp37-abi3-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.7+Windows x86-64

dtach-0.31.2-cp37-abi3-win32.whl (3.3 MB view details)

Uploaded CPython 3.7+Windows x86

dtach-0.31.2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.3 MB view details)

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

dtach-0.31.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (4.3 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ s390x

dtach-0.31.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (5.0 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ppc64le

dtach-0.31.2-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (4.5 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ i686

dtach-0.31.2-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (4.1 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ARMv7l

dtach-0.31.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.1 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ARM64

dtach-0.31.2-cp37-abi3-macosx_11_0_arm64.whl (3.8 MB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

dtach-0.31.2-cp37-abi3-macosx_10_12_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.7+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for dtach-0.31.2.tar.gz
Algorithm Hash digest
SHA256 87e6f1591eede62fbdbfb292ce98604a28706c6ac68b2b181dbf40795fdad912
MD5 af4c1c6a0f9fb77918284a65ecee12fe
BLAKE2b-256 f6e1b2ceb1dd6ee9002cd5ab9684bfb24dbe3a10a036782d78cc99ad110135ec

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dtach-0.31.2-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.6 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.2-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9ce3388754f970170c11515c4a63d1841732cd11c99bde70aab2f48d6fce567a
MD5 805f8b69c4c56a5a8e67c6f69f75afdc
BLAKE2b-256 578bf57265422b6bdbd2c693780f666df07d25f63a2e7f3cfd2ed1f54a8922c5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dtach-0.31.2-cp37-abi3-win32.whl
  • Upload date:
  • Size: 3.3 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.2-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 968d9bc50c5e58e7ff4c6856a35addcf5ff40ecb0c88648be056ac011d40fc44
MD5 62943f60cca053f97bfff045243d564d
BLAKE2b-256 ecc24f43a3217d335cf52744215f79c41980e1eaded93db5dc2e7e94c4ed9f20

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtach-0.31.2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c0f6d86209517221d9e3116c5db8250ca44500de244d2d7640846c60ea473707
MD5 c1494f93ee98b8cdbadfd5a88a832929
BLAKE2b-256 2d7b3c3f694ba488fdeda3d3a12dbdea14e70c7064870ebcde1dbe744c185b8e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtach-0.31.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 37268f714b8bd360b58081743ac5ef5b26680920f941968682a6f7ef1c0325b5
MD5 4e954967591374e6712664776e9092bc
BLAKE2b-256 70e6d6214e77eb18d9abfad5b492c6be3ae00ba4ab3875569218fb65e15309c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtach-0.31.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 046b6b51d7686369d9386529011315aceabde378d58ce679c08c4bd3864ecd32
MD5 d9ac0b6d65984ef51e9ebec8e8c20775
BLAKE2b-256 8101cf0d1797d61e165d0b5d6e5cd424ea95afedb8404511b64666786eeb6f06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtach-0.31.2-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 6bbef86b0097b64e95750a4767f2c35fc369ccbdd413bfd8152e112ddcd0c4fe
MD5 384971543128d5004d0120b267e140e4
BLAKE2b-256 1c5ad4a8704bee7adbc7d786cdd4818a7a82afac113d21da4ed2b5314b61f678

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtach-0.31.2-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 0bb617dbf0ed1a8f67d548daec2c46f21e736c5290322f6ab988178f48247ac4
MD5 5269d786ae07939938d0ac8c7b59d31d
BLAKE2b-256 0c9b2d43552a28008f6265961ae2270cab5c6f79157121146bd1c6e65d89aabd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtach-0.31.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 200bab57752e1d794441b0d23d44cdf3be30e07f6e91c2cb2c97c777b5988ddc
MD5 3b05a4b137f2395600a3646a033380ea
BLAKE2b-256 046a3399972816b141d3a6538a1ce44b1cc386a9806fa70385070c8d2ea26ec9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtach-0.31.2-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0f66170e8dfbd85843a0a00365eb1e41bde676c0bdb1dfac51065fbf15584ae3
MD5 1a8838009c9cfc76f802ad2c244502a3
BLAKE2b-256 4374b654f93ae53206b583e9230f572a43ef27c706d8a640e2514501b6f9549e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtach-0.31.2-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2063763476d80059ad124e70c10c5bd256cc77b219d1620be432832588000451
MD5 3dc00ffe64b95ffde171605219e974b0
BLAKE2b-256 4d23687e757c561ff058b6764f0a9b8ce72c06e017ea7cb2eb1d8f60b33b0bbe

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