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.34.0.tar.gz (749.4 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.34.0-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.34.0-pp311-pypy311_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (4.7 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ i686

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

Uploaded CPython 3.7+Windows x86-64

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

Uploaded CPython 3.7+Windows x86

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

Uploaded CPython 3.7+musllinux: musl 1.2+ ppc64le

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

Uploaded CPython 3.7+musllinux: musl 1.2+ i686

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

Uploaded CPython 3.7+musllinux: musl 1.2+ ARMv7l

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

Uploaded CPython 3.7+musllinux: musl 1.2+ ARM64

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

Uploaded CPython 3.7+macOS 11.0+ ARM64

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

File metadata

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

File hashes

Hashes for tach-0.34.0.tar.gz
Algorithm Hash digest
SHA256 0d531623aaa0792deb58ebbcee16fe342cfcf8db92eee664f6a2749500216cbe
MD5 8e02257ccad08ab1b878f298ec0adf84
BLAKE2b-256 373a8b5a6da31b503b1e8d1c41583e7a538283dca89856b6d9fa99bf91c38ec5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ce857f94ca9e0325aefb5c38541eba3e6c8057e3cfd1b0af4059178b0ebf3885
MD5 c6622c0efbee188ba3ca4d8acd413b7c
BLAKE2b-256 05b647364027a1bc7b2562abfaac0bde25bd6e9f8fb0d097a5ca6fddbb21a2b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.0-pp311-pypy311_pp73-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 009dc524c5ad1e36b60e07be4daac6918103966f549901d9437d8d8a38463548
MD5 90aa78ea08401b4c5034fc7d7114426f
BLAKE2b-256 383b6893fa51090d1d3f0b9b29ffe4bb65ef0ca520274571a4ce922417813a61

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tach-0.34.0-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.34.0-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 5827b4ade9c208d9f09c0ca268adad6a8470661104b3558073502ccd086613c9
MD5 463b19923e9498420734f02c2f6cecbc
BLAKE2b-256 4f924153276aa6c54ac653a2d499de981c7ec249b02bf5c800af4ecc8f3d1b64

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tach-0.34.0-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.34.0-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 1acb3e8c55260576f631a927bdcbfc9cec059298a86a9813e856e83c1d8175e1
MD5 42e9ed59cbdbfb1fd367cbcab23d0bbb
BLAKE2b-256 e51ec9b762db4f983291bd076220d209fdc10973bd6a580efef3369f6410f76b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.0-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 00106dc36a7c7f8f412887a8d3833edbab4091906476efa48ec90f5e97a246c2
MD5 4e896576328bc7ab49e5091bc761222c
BLAKE2b-256 47136713ef572d8e4de4bac3c192afbdeb517abca736127163a6f19ead8d5708

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.0-cp37-abi3-musllinux_1_2_ppc64le.whl
Algorithm Hash digest
SHA256 521dab355d0675454826f373722f1c7c571dc421f8bbf784e5cfb8d833589d38
MD5 89c8d3d4cb30a0b2b61d163be10c280a
BLAKE2b-256 d30b81634f06c83972b9d8857d7e2e5880ac8c5f46c8ccf09aa3763bfa5b10a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.0-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 dcbbcc1fe23def9ff9cd6b47403511a299e358fefedca75e42811d615bd4a68f
MD5 94ab75b5713fe7179b7b91df941d3d0b
BLAKE2b-256 9297b504249ed4e81d07ddecc0bfa4a150b0dd1cbd61616dd5a24d2a550a2143

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.0-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 a7d0b8ae6a8418f4745fc9e707e520c651dd9a013ecc9ab5331f47bf50a24490
MD5 6df3c052551ee4b3d847ce10057cd510
BLAKE2b-256 e0ff91446342f025540de39b03713730443db8142398e30052f9d485188a0064

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.0-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 eef6d95257ab4a377d20fb874ef5e7aec6d2001faab0a0d5a094c24df3157d99
MD5 7310890492b539b0461674b6c0aa2a6a
BLAKE2b-256 9d8fc4655cd157ec4dc1ac2520964f88645c0ce7deb716b7c84b044965cfa7fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6e4d90f928335d4f18abd811e5385628912bc890b8304a7d8aa1f5ba287e91bc
MD5 26815c8450d6c2addeef16206eef4d00
BLAKE2b-256 a80f15f484d33385f8bbaee9659c9497ce0d984e493237bac3b9952db74f1907

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.0-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 353b435af2e623d50ffea21035fe6b92e537235808bcfb1038998176bf8833de
MD5 e6840c304566c229af54a7cc4efa0d84
BLAKE2b-256 75cd962ccf658eb2cd741010c936e8f65ed2d51a6c556e8b7d663c067bc3f488

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.0-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 4f09a88c0cd09d06ccc5700514a5af98ecad64835aeeacbf8e0764ba4995ecc4
MD5 af03e3c7e2f9397f5bfd5a2e4db01101
BLAKE2b-256 8b62744cc0415ca70e4fe78d450c981aa4bf57091e8f6916833076225be82037

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.0-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 38601e60d8a9608631a1e271d12eed0bfafb3a9e30ebc30b791ef12e1461499d
MD5 cfad8fbea280d1f57f1373b0ebd5e3f5
BLAKE2b-256 63b06eb04e01c4cb23a4f731619c2adcf048f35e844a0e1f87acd4f31a3da2f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 424d463a611e7f1f127e22a4a934b35954680d9b0576eab54b25f7dde48527c1
MD5 b24b2ac613b3e83238accf6f8206e00a
BLAKE2b-256 49b5c1087cf63d174a3a3567062797f0bb6552656427d96798bfc4949731e97e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fe88617125325157d2cd398021ea160ff1710631ee46679bda4cae89edd0c504
MD5 21cf541818ca99c0117beff19d950696
BLAKE2b-256 a13041beb906af4176a3f649204e133bb67472f34e0f36135da21b97774b97e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.0-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f4ff9208840efc03f2317c93296f2c6c2216192920069cdae7b8a4628019d700
MD5 bb03bd7ff4d1178d2a62318ea43f4e7c
BLAKE2b-256 35e7352a01b6ffbd5a651bc72e87603e7b5e151d51544a47f8079c1b100fbac1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.0-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1ad610cded9f91e43b1bb0bd51f795593711465ebef28b72ee219ff1144551c4
MD5 44bafcbe5bc1be271d6a3df67186ef19
BLAKE2b-256 6aa436aef8a3b9153cb9d08e2363d6e67244da6ab06b4a70187fe1f55461ad60

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