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.1.tar.gz (766.0 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.1-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.6 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

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

Uploaded PyPymanylinux: glibc 2.17+ i686

tach-0.34.1-cp37-abi3-win_amd64.whl (3.7 MB view details)

Uploaded CPython 3.7+Windows x86-64

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

Uploaded CPython 3.7+Windows x86

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

Uploaded CPython 3.7+musllinux: musl 1.2+ ppc64le

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

Uploaded CPython 3.7+musllinux: musl 1.2+ i686

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

Uploaded CPython 3.7+musllinux: musl 1.2+ ARMv7l

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

Uploaded CPython 3.7+musllinux: musl 1.2+ ARM64

tach-0.34.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.6 MB view details)

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

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

Uploaded CPython 3.7+macOS 11.0+ ARM64

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

File metadata

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

File hashes

Hashes for tach-0.34.1.tar.gz
Algorithm Hash digest
SHA256 58b5a8f9dd4f5c9fc9b1ade875aa0b31d3ac2f2f6802c655c05197a503d5acde
MD5 2fe194f08c5162b8d8429f08dd16a636
BLAKE2b-256 2d5ba82de1482ede35e245951a6e039d608cdc86111aa8207344fffb8c927623

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.1-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c396aef13bd7e5398674886115160f4d6b9cf7baae1fb9431689d9ac4237f97a
MD5 c4c45eaa9aa1f34a11317b230c5c4be6
BLAKE2b-256 3ca04a1aa15f3efe68e437d5a00c33adc71e1311b74f66def645ded3483f0992

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.1-pp311-pypy311_pp73-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 b54972211022eafe29a03f5fd4c34d2a7b52ed77eb0e9ff897d64f4c8c2dcd2f
MD5 63ee10510a2e3b475962d95649dacd68
BLAKE2b-256 7c2af0c5fbc486d251de9303eaba1a694fc9781d3da7d244cdb403884634a664

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tach-0.34.1-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.34.1-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0220c002da4bf4656b121c6317313490e8660627e5200251e0bca3e00a27d0c4
MD5 b536f5a1eabe149320af86e21fc08eca
BLAKE2b-256 b66c51f1d58eb3ebd1f79d2944f4813806c18c9c715178956424a4528e8bd281

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tach-0.34.1-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.34.1-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 abd9d1e468a9b8bec1e0037c06797b31e9c23c62adf13bcfacf057a21310ad3f
MD5 581502810890db1fe72d0971879e0c90
BLAKE2b-256 ddd50209e74d57b0d32057b6ea997b77db847e38d649bd27e6261a4bd58e1da5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.1-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 1246b2718cfffecd4e6d66d6e232323fc4b3f2c68b4c990af0063464808f85fa
MD5 e7b025d8b8cf3d5e3fd6f4b5d71c0d9f
BLAKE2b-256 04c2d0e46185745af3a3d4057fd73eeac9ec003f054d5591c54e2fd835f4cbe4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.1-cp37-abi3-musllinux_1_2_ppc64le.whl
Algorithm Hash digest
SHA256 f94909630d699806e8682662962de0ac76ecc05dfcf7893af2c7e1a5c71de57e
MD5 5ad3c7567bcef846ab942025cc0ece60
BLAKE2b-256 22c6340e9ba6821d4e97f1bfeea5ad36a07c888f3422bb68f4805c74c1dc576c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.1-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 d917fc81adae85e9b3f2d29e135ba572a69dc677661727012b3adf95e0216e9e
MD5 f92f38e28afd1423024c36d76bbdf961
BLAKE2b-256 44f68538205bba54d77d8b5e3f4afe8203d705bc430578f59bf4d108b3b6da47

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.1-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 7be15f69c99b89cdadc2835368fc3cfb3ad45e74c7a704a7d42bcdd2917608b2
MD5 46335d8b6a2c97a32ab1a2ba85e382b4
BLAKE2b-256 665ec716a12ed58a7cc23b27f61f52e31e60410914b2a4afdb0b1a88d16008a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.1-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 c600ea6f8748ea13183aaf802fb733c148238e252cc0e66a85ac8d6de9939906
MD5 ab447333d5947ea48b29481003203d05
BLAKE2b-256 8c5429ffea4faf1c0c623bc2e97e8affc658fbaf38fcf8babf758fa63864dc1b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1cba2d957371fde09c64cb1b70349844e33fae3d87f55e6b002929587c5c7826
MD5 56e68600296de2133ed28d671182d26e
BLAKE2b-256 6ea025ac1fb225aa07faacb29c2470dc49633583fed11214c9e128eae65dece9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.1-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 9b52a70262f16b701aaa03781656d808f88a3eb6a263762f8cea726ea9ffb980
MD5 d299bdf665e9aca98c90f6f6dab65dad
BLAKE2b-256 12f7838d3c2bc0972626eddb3f69d13fdf3eaa7cc46c6132ad965fe7839fe452

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.1-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 6042b4f040c5941d28229963451b94a8cf2b08cdbb0ab0e338a04a46887c712f
MD5 f33e731680c70d4d35d4b45db5e40439
BLAKE2b-256 e4d375b46da7c62a929ddde6c9eb4bb54f775693ee5a006f1b9a069a9aa2f5f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.1-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 b272ee726d8b0ef3887d3a3057f618922ab0f7471e1b1d6096f78f2ae93727e4
MD5 c9e273149c7286a713586ef064362ff0
BLAKE2b-256 04903459ce8c55a0aa4fa4533faf66cbbfef37eb5927aab1b87f8439c6db228b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.1-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 fcb8ca825287160c1dd37b1cb164b88675e01ee97304ce14d50d7e8e1d3b853c
MD5 1588f72d75ae002e8db9a43c7f6cc0dd
BLAKE2b-256 24f73c75beb144017a22229808b497bfb22cd79acc11d836c9870dc8708185a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 862d240a7fc297283a51c857eb269d8c56163f14b7e398f757b284bed1e3df4f
MD5 dc2ed8339773b956c9267612278a92f7
BLAKE2b-256 9bde12e565a0374436ba2b9c00ba68c3a9bf9999081ac546faf33da77162316e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.1-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 70d55ec38dfcc15f1fff9e420ba17d63c36bb1b27f92abb8e8c910ffb71fd233
MD5 1d4850ec1b07ad66d8a82c103248b273
BLAKE2b-256 1baeaeb7f67c34b5a9ee43d1aa556b16c6e60424cafeb3f23e6fbf3298a968cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tach-0.34.1-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6dff869e7f8933be23055f407a751e6f9e4c8ecb0bf3a93a962a0815e106c313
MD5 9a708a1ee35043fcb88dd3013c8820b1
BLAKE2b-256 333fd071b841bf634da94068b84d7a2098c99c18deb21b3418969f29e152d793

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