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.35.0.tar.gz (731.1 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.35.0-cp37-abi3-win_amd64.whl (3.7 MB view details)

Uploaded CPython 3.7+Windows x86-64

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

Uploaded CPython 3.7+Windows x86

tach-0.35.0-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.35.0-cp37-abi3-musllinux_1_2_ppc64le.whl (5.3 MB view details)

Uploaded CPython 3.7+musllinux: musl 1.2+ ppc64le

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

Uploaded CPython 3.7+musllinux: musl 1.2+ i686

tach-0.35.0-cp37-abi3-musllinux_1_2_armv7l.whl (4.4 MB view details)

Uploaded CPython 3.7+musllinux: musl 1.2+ ARMv7l

tach-0.35.0-cp37-abi3-musllinux_1_2_aarch64.whl (4.4 MB view details)

Uploaded CPython 3.7+musllinux: musl 1.2+ ARM64

tach-0.35.0-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.35.0-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.35.0-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.35.0-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.35.0-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.35.0-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.35.0-cp37-abi3-macosx_11_0_arm64.whl (3.9 MB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

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

File metadata

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

File hashes

Hashes for tach-0.35.0.tar.gz
Algorithm Hash digest
SHA256 db8594820685f8ce316ef45d4dfa1a8ed39ce97dd873aa5006800d2668c3b3bb
MD5 8dad7297dbacf025a5dc63810f88f30b
BLAKE2b-256 81548bae607899ba9fd7abd9895215f2e5dc789a73529f8afeb0a10d2ee71500

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tach-0.35.0-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.7 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.35.0-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 746271a5313c348e00c1b85927260e3e1a75351d86b2da1746e85c5dd77051e6
MD5 910fa7dbff7f09f6e2d7d090741b67ae
BLAKE2b-256 4b1d5dddf88fa9433bf4fcc76afad18e49d8e50e24f1f40c981c286edccd6c2d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tach-0.35.0-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.35.0-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 72dd6553d9fdd1e72fbd8e5b71892a463e8cd70b3ff6377b4f682aab100937d3
MD5 2d3fad9d5007526ecb8502bc28a61a2d
BLAKE2b-256 2ee5054784261781dbcb8ac663a5d09af6c7996f5bde5230282b4c062dcf1f1f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.35.0-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e9275b65ff31e7ff9842b3bd7417a393115dbadd1fa8c3d953ae330cff7fbefb
MD5 ea095526797d28087aa1b70266caece5
BLAKE2b-256 4b0fe1842c063d0ac7be804797fab569ac782ef8a9fa349092c71125bc628e4d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.35.0-cp37-abi3-musllinux_1_2_ppc64le.whl
Algorithm Hash digest
SHA256 e73aebad3af4aa99c20f72d54f270e40eac8681b5fd3bb439333936bfba5c892
MD5 f7bc1ea368b25290f3fddda56e7cf76e
BLAKE2b-256 a4c30859a8f4f85b167174a9173df79bc0f15b93908d69537a737f1c44e2d8b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.35.0-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 2c2e9fc654a7a250f3698b26872c89de7b42f649736e3c322cb91edcc749cd55
MD5 2012f0b197581d1e239649b2041e70e6
BLAKE2b-256 8187267e1ea74dc4bacce03d301991b39da58211f636325b1fed7bd83b5e9c40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.35.0-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 4162f07b9ca0364eb4f05530b2b6a66b6c6544fae8752e4378458f604346f800
MD5 c3379946664837920fdd17bc116c83c3
BLAKE2b-256 ea065dd9e47839e9d5b202bf1f9d9d526940020f561d461607498938d2c55a5f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.35.0-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 e9940ec5f07200e349fb68d85939f72b659b96644c28d2f3d4e97d290ec85f95
MD5 622983385474aa964cf340339243d563
BLAKE2b-256 e9f27fc5ee5e9521ab6d75c0fa9affad4f324bf70f0554c47251cba599a30b5e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.35.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 162677645f6a28b0fd91d5d33334b1e92ac40c8085540f40bf072fc8ab6a2b0c
MD5 edda44bf3160fa160628eb240eb037c4
BLAKE2b-256 370765d158d670a3106f3b327e53187fdf812a2894a3286407154f802ade6874

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.35.0-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 afa96c12355acf2a00dc27d3c39ccbca5516fa954640051d9dab9fd47a373d6d
MD5 6dd51249eb71ff92db1062b1ece903ee
BLAKE2b-256 33b8aeb321f3752522198a5e8a2f8b0e88cf36f54c108938ec50a845fe19290c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.35.0-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 0c65273272f842c1490c2086279296a250a3eeb40b01c02a252b0c8021c52441
MD5 8c50473dd8348992203052038e13a25e
BLAKE2b-256 7fe5254462c90ec22cd1f2f8f5dc27f4b8bef62940eb3775565366d3fb6cd563

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.35.0-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 236d2113e4920e83fa60fd814d09a7fc9cbab87fd60a0a79d5afc9dd60a81102
MD5 2c7bb6a71062cca3a5f4355b0aba30e7
BLAKE2b-256 1e16d235f6ba6be79c8c4490ee1469a73e2325d1f8f380c29954c4103b6aff09

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.35.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 272234f3ff9f6cef54dffb5175a83313938461e37617c1fe18bbbaa2cc52179c
MD5 f5721de84c0b2f20b1f6c724ee0d534b
BLAKE2b-256 870e575f119447647e2321fc71bacf3909450b743fcbaf5015f11037bd304fee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.35.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f0109591f1be3d0e323769d495b1e303ee41305bf03e9143328000a40eee7059
MD5 fdcd5fba622cbe4a4a4fe39b63b9918e
BLAKE2b-256 41de936963142c9af18e7a59909960bf6d4645e82190471e162c28ba80dd2475

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.35.0-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f14a3943783fa3285030468958718a0696d908d50a5c5119e2b42dae37e32114
MD5 0d6b3b1b66b7d93140c151a4a551e1e8
BLAKE2b-256 adb6e43617eaf57cd2f8a27935c87256eab63b8505e1c7b7a3e1947f2a612f88

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.35.0-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 83b43975bcd23ddca2de388891d9f2cce7de3775682ac0a7857981adc4454787
MD5 e4f9da9f1c78ff3e09c0e4efecb62fdc
BLAKE2b-256 30657ec3ac15167d9a2def25ed5cc6699348a940d7d24408d0c0b3e9bf14f1c3

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