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.3.tar.gz (786.8 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.3-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.3-pp311-pypy311_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (4.6 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ i686

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

Uploaded CPython 3.7+Windows x86-64

tach-0.33.3-cp37-abi3-win32.whl (3.4 MB view details)

Uploaded CPython 3.7+Windows x86

tach-0.33.3-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.3-cp37-abi3-musllinux_1_2_ppc64le.whl (5.4 MB view details)

Uploaded CPython 3.7+musllinux: musl 1.2+ ppc64le

tach-0.33.3-cp37-abi3-musllinux_1_2_i686.whl (4.6 MB view details)

Uploaded CPython 3.7+musllinux: musl 1.2+ i686

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

Uploaded CPython 3.7+musllinux: musl 1.2+ ARMv7l

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

Uploaded CPython 3.7+musllinux: musl 1.2+ ARM64

tach-0.33.3-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.3-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.3-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.3-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.3-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.3-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.3-cp37-abi3-macosx_11_0_arm64.whl (4.0 MB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

tach-0.33.3-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.3.tar.gz.

File metadata

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

File hashes

Hashes for tach-0.33.3.tar.gz
Algorithm Hash digest
SHA256 e5c049cb1f677fcbaaef020fb8a9bff150b9a13914a326c7686d0ea3ed9ebcea
MD5 64c77297de9ad9eeaeb3d9909ea51d5f
BLAKE2b-256 aee426ce2c1e56f43e2062c6056ad334ba6578c9722cca8885e00ff0a0d98bc8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.3-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b08567024a345c3689f7d906d268bd26e3d783e22b055697ec7b8774f1a2d712
MD5 a73c4efbdac2cf3e06654cf4eed1f720
BLAKE2b-256 da7dfb92773122b19809e239ba7790941c5c067644a48f117c0f832e495c571e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.3-pp311-pypy311_pp73-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 00281bd0248051a3f6004a0cdcc530b5ce7712a5c05083c03147e261bc006eda
MD5 cc17311ac382b044353db4050d3b693a
BLAKE2b-256 25ef7a7334a3ee4e42d80798230ee86fc8e3c98ce83c7931a5f6d5542266176a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tach-0.33.3-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.3-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 eef15d18f1a1a98b8b4160eaf10a79bee3c3ef0d13a959fc9cf824e2c6f1026b
MD5 93f56bfc54c55a9eabb3f1091e45b7b1
BLAKE2b-256 015b84df2825a845fc45e28ac0d68e8655d1a6ac9b477727f4b5fcb00b78b926

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tach-0.33.3-cp37-abi3-win32.whl
  • Upload date:
  • Size: 3.4 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.3-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 3edfdd4968fc26588a721eba162ef05c2aa70c9b2ee83bf785d3e664949a4741
MD5 4883edb9e6fb7bee98c3141ef5374d4e
BLAKE2b-256 e62d65c1024a5df139e7fae913ff9927874a79f8e3ac3c06af58e3c9a9a02f66

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.3-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 543a519bb052a303e29baecd7ee233d62614ec072c61f9d2a89c374e9a99c16d
MD5 593b6c71ffc3b2cf37ceb4e8db3ee4cf
BLAKE2b-256 59d03f4de120fa229e4ab3591d65bf552741d6924eb9bd5454ec6c2eeee9f7f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.3-cp37-abi3-musllinux_1_2_ppc64le.whl
Algorithm Hash digest
SHA256 f245fec19670ba68717e8aaa5976607e1c8a984fcdbf3eaab1d71397536f07c6
MD5 3765b3e112ca144511602adc13403cb2
BLAKE2b-256 449ac25f02d09f4d4a7da915352ad716c2687ecc854ca270872c689c95823454

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.3-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 c1de2714789185ac152176d8bc3573ae87cc67d07a41acc6f75adbbb94a2ee2c
MD5 1a279f7a67824f8ebdb6a3a62093dac2
BLAKE2b-256 94fb8fdd79c5abcf423e22c09c9a9ef4f3dfa2242291ab4517996341fc34a473

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.3-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 2d5b5a96021b2512ec18d91949c2c6d0e9a0b57d49efc211e258afefa1ed3229
MD5 8300ce605fede10d6a0c5ae873eaf69c
BLAKE2b-256 9c4ac14149ce5279443fa2a1ed5f28a864d2125e5d7e65034f6b2c2fde49f9ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.3-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 7d79a947bcfa42affe292607cc54835fdce96e3be5f58de840ed7ed81c668e2f
MD5 230f669f5448f9ad87b72acd558d4c62
BLAKE2b-256 1085071faf10c574d4d1df16d14b8b5a8617c34ee447d3b48c70bcef6af67cfa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.3-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5177a4243ffa7b8913af49f65894f21bb53086d7e399a6d1805b1637d0d28354
MD5 6244084af8538da18c33053b40589b49
BLAKE2b-256 ad928914be0dc588bfe23727e3ed1a59885627e21d9650765385c4e93adea207

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.3-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 a65cfdbc33fabc526edac9990fbdeec6002c56a6af84a46385e6e8616764df33
MD5 ddba21f53ecea49ab584670ecc57fb09
BLAKE2b-256 13e9f4783ce40617e6f31939ea9404efa0b1af97d5e631f33ce789558171add7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.3-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 40347d655d81f3802afac8381cbf4638718ac8c3d6540f8e2db287fa0c1c603d
MD5 a3798f613777994c4de16fcb4e7fed60
BLAKE2b-256 d805fd0c4cfdd15cd3428178bf0c1ffcb63fed123058293b2ca94ee27388a088

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.3-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 67d0f32c0191c0b08dfda847dee27afd1eb23012135cd0435a254d1a3c787640
MD5 6bf773a2f8e12cfd0b2be5d1b2d8cb09
BLAKE2b-256 3f53fc7fd3bab467fc597f93387efc038554e027e040bd175535dca1e5465a5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.3-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 b58c4d0cbcabe1a189e2c747bc0b1d0354708f6e9f4e235f55fddbe8582d7d5c
MD5 b8a1e42c819c67b4a143199e3eefa9e3
BLAKE2b-256 54003ab628b65ea074af516e1f0de0fbf2cbbff9d4949b5edde28181192bfa6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.3-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 512de664eb87f9933a600ad757a79bb34847fa25d77c53968350b2d945fe9109
MD5 00a9d90da98a0d014b547b5d46cd2125
BLAKE2b-256 c335bdb3d684fc31d8b536cc6e0fa56922d71fef39dbc32332cbf88f23ad3d3b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.3-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d01ede007d5602f56b2695352cdfce2ee2c07d9eb97aff0497f6cda4aed61da3
MD5 26bd2ca904cd168e78672e87d99c3de3
BLAKE2b-256 6608c34ac39cdb2e8e3698cedca5d6952d67826c78027c6e140db573aa95bdfd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.3-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fa7e1f798fc4a99671b4aa4dc363fbf5d91631e95acba85b073a91b36d6ee443
MD5 466fb4ee63d1bc80c322aa604aff1ca6
BLAKE2b-256 475166d360f3b8aca1ca9218ee3b8c0c0579739db426166c74aacad0ddbf16ad

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