https://github.com/gauge-sh/tach Skip to content Navigation Menu Toggle navigation Sign in * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + GitHub Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions By size + Enterprise + Teams + Startups By industry + Healthcare + Financial services + Manufacturing By use case + CI/CD & Automation + DevOps + DevSecOps * Resources Topics + AI + DevOps + Security + Software Development + View all Explore + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Enterprise + Enterprise platform AI-powered developer platform Available add-ons + Advanced Security Enterprise-grade security features + GitHub Copilot Enterprise-grade AI features + Premium Support Enterprise-grade 24/7 support * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up Reseting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} gauge-sh / tach Public * Notifications You must be signed in to change notification settings * Fork 30 * Star 820 A Python tool to enforce dependencies, using modular architecture Open source Installable via pip Able to be adopted incrementally - [?] Implemented with no runtime impact [?][?] Interoperable with your existing systems Written in rust gauge.sh License MIT license 820 stars 30 forks Branches Tags Activity Star Notifications You must be signed in to change notification settings * Code * Issues 2 * Pull requests 0 * Discussions * Actions * Projects 0 * Security * Insights Additional navigation options * Code * Issues * Pull requests * Discussions * Actions * Projects * Security * Insights gauge-sh/tach This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main BranchesTags Go to file Code Folders and files Name Name Last commit message Last commit date Latest commit History 1,331 Commits .github .github docs docs public public python python src src .gitignore .gitignore Cargo.lock Cargo.lock Cargo.toml Cargo.toml LICENSE LICENSE Makefile Makefile README.md README.md pyproject.toml pyproject.toml tach.toml tach.toml View all files Repository files navigation * README * MIT license Tach downloads version license python ci pyright ruff a Python tool to enforce dependencies, written in Rust. Inspired by modular monolithic architecture. Docs Discord gauge-logo Tach lets you define and enforce dependencies between Python modules within your project. Here's an example: tach_demo If a module tries to import from another module that is not listed as a dependency, Tach can prevent it. Tach is: * Open source * Installable via pip * Able to be adopted incrementally * [?] Implemented with no runtime impact * [?][?] Interoperable with your existing systems (cli, hooks, ci, etc.) Getting Started Installation pip install tach Setup Tach allows you to configure where you want to place module boundaries in your project. You can do this interactively - run: tach mod # Up/Down: Navigate Enter: Mark/unmark module Right: Expand Left: Collapse Ctrl + Up: Jump to parent # Ctrl + s: Exit and save Ctrl + c: Exit without saving Ctrl + a: Mark/unmark all Mark each module boundary with 'Enter'. You can mark all of your top-level Python source packages, or just a few which you want to isolate. 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. This will create the config file for your project, tach.toml. Once you've marked all the modules you want to enforce dependencies between, run: tach sync Dependencies that exist between each module you've marked will be written to tach.toml. Check out what Tach has found! cat tach.toml Note: Your source roots will implicitly be treated as module boundaries, and can show up as . 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 module dependencies validated! You can validate that Tach is working by either: 1. Commenting out an item in a depends_on key in tach.toml 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 import '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: * Strict public interfaces for modules * Deprecating individual dependencies * Manual file configuration * Monorepos and namespace packages * Inline exceptions * Pre-commit hooks More info in the docs. Tach logs anonymized usage statistics which can be opted out of. If you have any feedback, we'd love to talk! If you have any questions or run into any issues, let us know by either reaching out on Discord or submitting a Github Issue! --------------------------------------------------------------------- Contributors [6874747073] About A Python tool to enforce dependencies, using modular architecture Open source Installable via pip Able to be adopted incrementally - [?] Implemented with no runtime impact [?][?] Interoperable with your existing systems Written in rust gauge.sh Topics config python rust cli productivity open-source devops package library framework programming terminal static-code-analysis ci monorepo developer-tools code-quality dependency-management Resources Readme License MIT license Activity Custom properties Stars 820 stars Watchers 7 watching Forks 30 forks Report repository Releases 59 v0.10.1 Latest Aug 25, 2024 + 58 releases Packages 0 No packages published Contributors 15 * @emdoyle * @caelean * @github-actions[bot] * @tiluckdave * @dependabot[bot] * @max-muoto * @dhananjaypai08 * @clin1234 * @sparshg * @anmolm96 * @letmerecall * @architgarg * @nikhil5642 * @rshindo * @ar090 Languages * Python 76.3% * Rust 23.0% * Makefile 0.7% Footer (c) 2024 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * Manage cookies * Do not share my personal information You can't perform that action at this time.