gauge-sh / tach

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
https://gauge.sh
MIT License
1k stars 35 forks source link

Support for PEP 420 Implicit Namespace Packages #203

Closed malcolmgreaves closed 1 month ago

malcolmgreaves commented 1 month ago

Hello! πŸ‘‹ Thank you for making and distributing tach! ❀️

Does tach support namespace packages? πŸ€” I did not see explicit support in the docs. And I've been running into issues trying to adapt tach to my situation. I'd like to use tach in a project that makes use of multiple namespace packages.

The individual packages are all PEP-420 compliant. There is a specific set of inter-dependencies that must be enforced between the namespaced packages. This DAG is currently encoded in each's own install_requires. However, I'd like to use tach to further enforce and check that these inter-namespace package dependencies are (a) all what we intend and (b) identify and flag any module boundary violations. It'd be great if tach would also inspect the install_requires and verify that the dependency graph is correct too. Here, "module" really means "distinct namespace package." Though I think the concepts are well aligned :)

Is this something that is in the near-future for tach?

malcolmgreaves commented 1 month ago

Also, I think that this issue is quite related: https://github.com/gauge-sh/tach/issues/192 I did not want to distract from that individual's issue by bringing up explicit PEP-420 support. But perhaps a solution can work for both issues?

emdoyle commented 1 month ago

This is now supported natively in 0.9.0! The presence of __init__.py is no longer required to detect Python packages, and multiple source roots will automatically 'merge' namespace packages from distinct file system roots.