Implement usethis tool tach for architecture enforcement#1639
Implement usethis tool tach for architecture enforcement#1639nathanjmcdougall merged 17 commits intomainfrom
usethis tool tach for architecture enforcement#1639Conversation
Add Tach tool integration that: - Creates tach.toml configuration with layers inferred from import graph - Adds tach as a dev dependency - Configures pre-commit hook for tach check - Registers tach in the arch toolset alongside Import Linter - Adds CLI command: usethis tool tach Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/e208815b-6629-4e78-aaad-bc82cbedace0 Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
…or tach Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/e208815b-6629-4e78-aaad-bc82cbedace0 Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
usethis tool tach for architecture enforcement
|
@copilot failing static checks, please fix |
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/ddb46dff-7a44-4df4-b2c2-2f5d1208a964 Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Merging this PR will degrade performance by 5.95%
Performance Changes
Comparing |
…d use_tach tests Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/aa9351bc-3fdf-4933-8e5d-48f36e6c7245 Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
|
@copilot tests are failing, please fix. Details=================================== FAILURES =================================== self = <tests.usethis._core.test_list.TestGetUsageTable object at 0x7fc5307e2980>
E AssertionError: assert UsageTable(ro...us='unused')]) == UsageTable(ro...us='unused')]) expected = UsageTable(rows=[UsageRow(category='tool', name='Codespell', status='unused'), UsageRow(category='tool', name='Coverag... UsageRow(category='config', name='docstyle', status='unused'), UsageRow(category='', name='README', status='unused')]) tests/usethis/_core/test_list.py:51: AssertionError self = <tests.usethis._core.test_list.TestGetUsageTable object at 0x7fc5307e0d00>
E AssertionError: assert UsageTable(ro...us='unused')]) == UsageTable(ro...us='unused')]) expected = UsageTable(rows=[UsageRow(category='tool', name='Codespell', status='unused'), UsageRow(category='tool', name='Coverag... UsageRow(category='config', name='docstyle', status='unused'), UsageRow(category='', name='README', status='unused')]) tests/usethis/_core/test_list.py:80: AssertionError self = <tests.usethis._core.test_list.TestGetUsageTable object at 0x7fc5307e33a0>
E AssertionError: assert UsageTable(ro...atus='used')]) == UsageTable(ro...atus='used')]) expected = UsageTable(rows=[UsageRow(category='tool', name='Codespell', status='unused'), UsageRow(category='tool', name='Coverag...), UsageRow(category='config', name='docstyle', status='unused'), UsageRow(category='', name='README', status='used')]) /home/runner/work/usethis-python/usethis-python/tests/usethis/_core/test_list.py:106: AssertionError self = <tests.usethis._tool.impl.base.test_pyproject_toml.TestOtherTools object at 0x7fc52fabdfc0>
E AssertionError: assert {'codespell',...-commit', ...} == {'codespell',...-commit', ...} self = <tests.usethis._tool.impl.base.test_pyproject_toml.TestOtherTools object at 0x7fc52fabdfc0> tests/usethis/_tool/impl/base/test_pyproject_toml.py:15: AssertionError Full diff:
Full diff:
Full diff:
Extra items in the right set: Full diff:
=====================================================================================
|
|
@copilot please apply user testing for the CLI changes |
|
@copilot we need to add the new command to the docs in README.md among other places. |
User testing completed successfully in a fresh temporary project. Tested all three CLI paths:
No issues discovered — all paths work as expected on a fresh project. |
…ence.md Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/0f53d301-459d-43cf-b4c2-97a82bfddabe Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
|
@copilot the Instead of naming the layers "layer1", "layer2" etc. let's just name them the same as the module path. |
…aths as layer names Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/78ef23db-f7f0-4b8b-8207-ba0b8d529c8d Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Fixed in e44af81 — removed |
…MIN_MODULE_COUNT relationship Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/0e90e864-519d-487d-a92b-c288a19e2112 Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
src/usethis/_tool/impl/spec/tach.py- Tach tool specification (config, deps, pre-commit)src/usethis/_tool/impl/base/tach.py- Tach tool implementationTachTOMLManagertosrc/usethis/_config_file.pyfortach.tomlfile managementTachToolinsrc/usethis/_tool/all_.pyuse_tach()function tosrc/usethis/_core/tool.pytachCLI command tosrc/usethis/_ui/interface/tool.pytests/usethis/_tool/impl/base/test_tach.py(100% coverage on spec+base)use_tach()intests/usethis/_core/test_core_tool.py(add, config, pre-commit, remove, how)usethis tool tachintests/usethis/_ui/interface/test_tool.py(add, how, remove).importlintercontracts to include tach modulesAGENTS.mdanddocs/module-tree.txtsyncuse_tachandtachCLI functionsdocs/functions.txtand AGENTS.md sync blocks_toolset/arch.py— tach is an alternative to import-linter, not a complement"tach"in_HOOK_ORDERin_integrations/pre_commit/hooks.pyTachTooltoOTHER_TOOLSinpyproject_toml.pyand update usage table test expectationsusethis tool tachagainst the usethis project — verifiedtach checkpassestach checkall work correctly on a clean projectdepends_onfields (tach infers from layer ordering), use module paths as layer names instead of generic "layer1", "layer2"Resolves #1254
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.