Skip to main content

A Python tool to maintain a modular package architecture.

Project description

Tach

downloads version license python ci 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

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


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.33.2.tar.gz (786.7 kB view details)

Uploaded Source

Built Distributions

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

tach-0.33.2-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.4 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

tach-0.33.2-pp311-pypy311_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (4.6 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ i686

tach-0.33.2-cp37-abi3-win_amd64.whl (3.8 MB view details)

Uploaded CPython 3.7+Windows x86-64

tach-0.33.2-cp37-abi3-win32.whl (3.5 MB view details)

Uploaded CPython 3.7+Windows x86

tach-0.33.2-cp37-abi3-musllinux_1_2_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.7+musllinux: musl 1.2+ x86-64

tach-0.33.2-cp37-abi3-musllinux_1_2_ppc64le.whl (5.4 MB view details)

Uploaded CPython 3.7+musllinux: musl 1.2+ ppc64le

tach-0.33.2-cp37-abi3-musllinux_1_2_i686.whl (4.7 MB view details)

Uploaded CPython 3.7+musllinux: musl 1.2+ i686

tach-0.33.2-cp37-abi3-musllinux_1_2_armv7l.whl (4.5 MB view details)

Uploaded CPython 3.7+musllinux: musl 1.2+ ARMv7l

tach-0.33.2-cp37-abi3-musllinux_1_2_aarch64.whl (4.5 MB view details)

Uploaded CPython 3.7+musllinux: musl 1.2+ ARM64

tach-0.33.2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.4 MB view details)

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

tach-0.33.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (4.3 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ s390x

tach-0.33.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (5.2 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ppc64le

tach-0.33.2-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (4.6 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ i686

tach-0.33.2-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (4.2 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ARMv7l

tach-0.33.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.3 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ARM64

tach-0.33.2-cp37-abi3-macosx_11_0_arm64.whl (4.0 MB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

tach-0.33.2-cp37-abi3-macosx_10_12_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.7+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for tach-0.33.2.tar.gz
Algorithm Hash digest
SHA256 26621f7d30e364e2b255815706dc24d7185dbfad34a50ed2af9604e7d9c6e60f
MD5 950ee54e88c18f079add0ad7c9b26f89
BLAKE2b-256 afc3255cf2c094cb7c9e5ba2d68e9f45ea78f83ee8fca9866079682d80b675c0

See more details on using hashes here.

File details

Details for the file tach-0.33.2-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tach-0.33.2-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0a68255e20e1e12e30fa2dcef6165cb425e47b7fb971fb5ca2fb252f880fc43c
MD5 8e387a7a123ee016c9b3805183c1cb92
BLAKE2b-256 8e13a7eda8e75c6e52108773cc53943b82670f0c6aa7f91be87f6fcb15f32b70

See more details on using hashes here.

File details

Details for the file tach-0.33.2-pp311-pypy311_pp73-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for tach-0.33.2-pp311-pypy311_pp73-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 8e2f8ef4d9c9a06ede1fdd8d741b9cf28006f5ee0c191a81fb352b748844cfb9
MD5 566c55e175ca2509ed75aa5503f56747
BLAKE2b-256 8749d5757e9882201ea2f00981b72036def5c185689f5f98a74209cceb982649

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tach-0.33.2-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0d58dbc362023e84112b08e29a6ecbc9e9b0fa519ec7f00e3a6393048f68a18f
MD5 a5be2ab519178f0bdcb0a1503918589d
BLAKE2b-256 e2e49a636ecc670a851a516cfb125e8817337d70f1610e2aa3e4c4136dd34150

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tach-0.33.2-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 fef9377bf44fc342cf9d6834d69b0b6cfbb1c92c72c5fc1b8bdfbab37cdefa74
MD5 bb427079ab4c724a25f8889e24686fbb
BLAKE2b-256 a5eda98ebe0966cfa946e52889e55c019f9455e7b32482911569dbfc7e731940

See more details on using hashes here.

File details

Details for the file tach-0.33.2-cp37-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for tach-0.33.2-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f07cf07ef64dd1aa11f9f4ba52cc26b60bdd9f684202b5db83ba37abd1e07756
MD5 d11aa4c63aa933fbc15637c7d7a005fa
BLAKE2b-256 76a26ae44c03baa0bd63597cd76cdd9bc20ad0dc8a0018dde5892cd3cd52ccf4

See more details on using hashes here.

File details

Details for the file tach-0.33.2-cp37-abi3-musllinux_1_2_ppc64le.whl.

File metadata

File hashes

Hashes for tach-0.33.2-cp37-abi3-musllinux_1_2_ppc64le.whl
Algorithm Hash digest
SHA256 111b94337cdff9442281b5670e8908ddb5737fd6c82edb242f05c3870b2e7288
MD5 78812c1dd5d2b2263a85d175d3a959ea
BLAKE2b-256 8e548497656d5bbf16eefc2e88ec297449ca173098d9a4d8d8e97516cf0205a2

See more details on using hashes here.

File details

Details for the file tach-0.33.2-cp37-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for tach-0.33.2-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 45c2aa07381c139b066a3824e12499bd4ffdbd4c859cd3bf51d23baad76e8ee3
MD5 028f298d1e7e96dbeb27abbf00cae1a3
BLAKE2b-256 e68181578c9cec5dc179649121c1107cbfc20271b5050e9c24cf8a1d558ceeb3

See more details on using hashes here.

File details

Details for the file tach-0.33.2-cp37-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for tach-0.33.2-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 5e7d167ef2c17e31c87d2f3749c6f1e8cf9323b119792859ce6197b06a3866b1
MD5 11c96241a2cd88c47b3e0b74803589e7
BLAKE2b-256 ffba7a58dcd406abeeb98d53bb3f168529a2d15407315240a59f2e6980d88fa0

See more details on using hashes here.

File details

Details for the file tach-0.33.2-cp37-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for tach-0.33.2-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 0f3c75224d5449b1519445166095a3904aa45df8a12b7bc1cefad6184c358157
MD5 1431f4958657529c74209a8a1f2b1306
BLAKE2b-256 7f198799cd628b95f27e001f06228b4ebca3f4885bb03600d81e9b76e530bd88

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 956324a36db3fbd5cc30ffd0a51615420163a91a2bd8660d18b2b60f0ddc6d25
MD5 ecd86a5bf93d465e10dc78d5fc2d0bbe
BLAKE2b-256 a2d3f484cfd46e187746b23cb79f8c1d970b00869dc89dc5b161655349bfaf7e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 d5738d559bca28c6beea48225e291c592e484225fd131292b34c866469d6c642
MD5 79ffbab3a1221501f65e0ab5dfca98d0
BLAKE2b-256 51358aa92d4156cd8d8f0cf1f98224ce6ac24481e59bac5ce321fcc05da0b3fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 5ee3cd01948d1c46f377f992e884db9eca4db5aa6511d66aaf1633a3ae65773e
MD5 783b6a0b851c03289c6bd07da53f1273
BLAKE2b-256 a07e4060e0f127c8c6ae806b351df83ffdc94f43b0b4db98c9154601f0637d44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.2-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 b743e0bf7ab8a4017927043c591ca2fb9248bcecbd5e92928bd8c48cb4954efa
MD5 5c50059f7a767b9809619631eb561b21
BLAKE2b-256 02a7bb9368557684eb3a4646c83809c541cdfd23ce7ddf35d1c97b0673e24bce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.2-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 4510c0c3511379566a8141920020d7e9e7a73e1d3117ff443d4dcbbb56a4c9c2
MD5 6b6b7e944874b1877c57f013d415ee11
BLAKE2b-256 bc72b3832277ca61554368ee868f46408fca09b090d2f0abe86f447201b8a989

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 94696ed0860de30f2402eb1fa3efd661da21d55aacaebd7e06ad69a4223ff5a2
MD5 6a07da11759bffdc256628301b33a388
BLAKE2b-256 1ba4cb200ce19089912169b97a2e9c0d4c4b4f1274593c48e74fcca76851e2a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.2-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f053c9b84ec30e5a8899df6d8f492dda55062c2719b4166bdde1416d3dcc6cb0
MD5 4c6597fcb4554a3845d71de6f7d0c871
BLAKE2b-256 62ae09d746ec58465be1db47ded1741facf287369910b939caae1ccdfe2eafb0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.2-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0f46a12af6f2f80056ff24a1572d42b897a6cc593b74b895cd3f701548211021
MD5 5bb1870b37935005148c413e7163b3f4
BLAKE2b-256 398a391982d00b9c2d8d94d301951adc995aec5f9c7a3f0fcc49c765f81442b3

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