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.4.tar.gz (787.6 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.4-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

tach-0.33.4-pp311-pypy311_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (4.7 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ i686

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

Uploaded CPython 3.7+Windows x86-64

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

Uploaded CPython 3.7+Windows x86

tach-0.33.4-cp37-abi3-musllinux_1_2_x86_64.whl (4.7 MB view details)

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

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

Uploaded CPython 3.7+musllinux: musl 1.2+ ppc64le

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

Uploaded CPython 3.7+musllinux: musl 1.2+ i686

tach-0.33.4-cp37-abi3-musllinux_1_2_armv7l.whl (4.6 MB view details)

Uploaded CPython 3.7+musllinux: musl 1.2+ ARMv7l

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

Uploaded CPython 3.7+musllinux: musl 1.2+ ARM64

tach-0.33.4-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5 MB view details)

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

tach-0.33.4-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (4.4 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ s390x

tach-0.33.4-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.4-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (4.7 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ i686

tach-0.33.4-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (4.3 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ARMv7l

tach-0.33.4-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.4 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ARM64

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

Uploaded CPython 3.7+macOS 11.0+ ARM64

tach-0.33.4-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.4.tar.gz.

File metadata

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

File hashes

Hashes for tach-0.33.4.tar.gz
Algorithm Hash digest
SHA256 633f2f3c2516cfa5ee5169a230bb4383644167c35acba831f2a787b0be5d05ea
MD5 df0995e667473fda3c63fa826141e3f4
BLAKE2b-256 cd3deb9f0ec5e0c26ff0dbaaab4d2fc5849b3525f00876b672f8e696b3c8591e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.4-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4d8451dab4fdbadca98e8ce67b0de6e1d39b79b4ecdfca75636adbda5852829c
MD5 c7cc54a917011122e2a1b17e305c77b2
BLAKE2b-256 378a215195273cb0484637a3645491c2716fa81e7063dc6283b9396330aaa218

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.4-pp311-pypy311_pp73-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 171fb4800af5b99f017622062be98a9e7a0d6c7217266858b28346b3545c352d
MD5 f98724d21b9001b4a863c52db9fcb2a0
BLAKE2b-256 204f07050ea54d40b0fe970f49f44fb42ab2b5db49e47e526f3741ad5d5d9843

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tach-0.33.4-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.4-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e7a588314b337d8636de4b1c4c2e745adde8c103955ba4d2456833d30f9ae5b9
MD5 4631d9e5efffa202d86aa463b6b30802
BLAKE2b-256 87a7aa92f09fb9ef7aaba32a1dcf0f401ab48e038eb2f35462bb835305ac5d24

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tach-0.33.4-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.4-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 0b9096e513e861c61eee6a8174405bc99a7f7e2fab8793102ecbc5dd95419012
MD5 270b0fa9b1a9596ed7efcfc86d4d57c0
BLAKE2b-256 bbc63bf3ddcc60c9c2987a7ffcaeee95b4bb944068152e5c2d978e9102e25ca9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.4-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c2d93d86412575e9b2b6a1ad3db055bb89847b034dd529e0ad941cc235e030ec
MD5 66a47f3bc1aa5a881587e772c98f0c35
BLAKE2b-256 a2236305d76764b3a3fca71bf9606fb25e5568c5b1054b71aadcd247a7686313

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.4-cp37-abi3-musllinux_1_2_ppc64le.whl
Algorithm Hash digest
SHA256 5be463e6fd1bfd3e41b0746b52aa4d96e4bdf3c725b33e2716ad425081114a9b
MD5 aaef33b09fe828a0419fac6226c45ae6
BLAKE2b-256 e6526eaa54c4e256e324c40c74a4ef9dff7949793163fad0559cd114f43b9d55

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.4-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 206e099ff746833b6edc68ef59e25ef7997718247f94bdf46e0400e28c944f50
MD5 ae5294d4f74e61dd0a3b0ae685e026eb
BLAKE2b-256 17d6e6b451dbe51353910a13fa9491cd2aee55ef19015be612fafc8011e8ff6e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.4-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 b6760b2b4ec34cb58634b2faa66d9d6c212dcf5bf31fcd87986c348cb56b2570
MD5 2acb16071603fbb039f8ad82a679071d
BLAKE2b-256 e8a0ad64f218adea32859b928864b16d27fe6dd6645db726a7ca7262bd42756c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.4-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 c5d4a3df6a8608e68fd20f0b49721b906d8cb95be3adccd9a3c869fa4caa4a70
MD5 f19ec32d45fe21dfa12388819c544cb7
BLAKE2b-256 821a191e264378528dbe0457ba5b8a2de61636fa3d228d65dfccf01755119890

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.4-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5d5a803ffccda2bbb99fcba5fdce5eca6578fc606ff1ae9935baf44c765e2373
MD5 ca0a2b9060fa65f4146f590108b07c67
BLAKE2b-256 f1042b89f5401e1fc4f763b1fa6c76373f4ffe018dfe2d65268569d85cd78b55

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.4-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 9bf717dd896e47e6a81658fc8e89ceb0b21fc5c8c2f6223d80ddcd2ebad8cfbd
MD5 e770aedbc0309641ed961b770ac119af
BLAKE2b-256 cc7143a641309720a050a99b8834d1e28cc6cca219b517cd4c8db753e6c34cae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.4-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 d1770235b5523e1c9e8bd1adb1d211c3b27d770f87823a68c55f459d167c3cb8
MD5 26968896597d7e4f1a7dc5c9f2c63c84
BLAKE2b-256 da5b5db4759ae66caf7be1d7daa3d3894dea10caab80811629f44dc6c25d1b59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.4-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 5d246e6650cf414f1521372584c63c1a5ffbd5d30b0acea4121123bf4cfaab32
MD5 8ea47cc0f3bb5aa11a7befb53cb7d357
BLAKE2b-256 529c9965d47eb186458199d7224831278661dec41981746e100903dbbe62cb2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.4-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 967b258068d0fcddfed78b3bbca352f36062122660fdba28bf5dd645723992f9
MD5 a6e4d2a3667f4c69b3147044267942db
BLAKE2b-256 f49790a9da869f5fd7d34532f246f9eb7edd0a08f77d8d1774a4636b496ba201

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.4-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e9987d38afa30d64a0378e27fbd59b605ef07cde94242ae90538e39afe178e87
MD5 e630c2cd467c4fa2143d2fa8494098f3
BLAKE2b-256 e61b230995003110218ea8af582f09a50bc033019b608d4eef39fcc700af2a3e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.4-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 20e166a8c5dcc89205a1bfaa4b73079db024a5e98023d838671d052394a7ce40
MD5 c98dd4b05b75556f51ecbdc49e8d2253
BLAKE2b-256 4f18a21617773bd949c487697007325b0eb76efdba3d0e367a4d502258c5a75a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.33.4-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e95cc9b1ea0f33a45d9b637c94b1e128b345618b01e1f850bf2a59b2081b4b19
MD5 156ed3d6f8287450e79ee1c2dde147a3
BLAKE2b-256 a3f051b879132c439e1f7e8f8787a86d35c7a60be6dcc13702cb5136a4829118

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