-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multiple source roots #192
Comments
Wouldn't we much rather prefer package_1_root, package_2_root, .... package_n_root to be n different modules inside one single package folder that can act as a source root. Having multiple |
I think this use case makes sense. Do you essentially use poetry to build and run everything as if it were a single package? And do all of your other tools work with this structure? Supporting multiple source roots might require significant refactoring, but I think it's probably common so I can sketch something out. @dhananjaypai08 I think since in this case it is a single logical Python package, Tach should be able to support a single 'check/sync' across all the source roots. It seems like it is just a matter of understanding the import paths correctly since it doesn't quite match the filesystem. |
Yes, this is a single package with a single dependency specification. Footnotes |
I just discovered tach and love it! It would be great if it would support monorepo setups. I want to provide a concrete example of a monorepo setup to help scoping this feature request. We are using a polylith based setup. An example repo is posted here: https://github.com/DavidVujic/python-polylith-example-rye tach is already very useful: when I point the source root at Congratulations on building such a cool tool! |
This is now supported natively in Marking each source root with |
That's awesome! One thing I don't understand currently, how it deals with common module names that are present in multiple source roots, e.g. if there is an |
Sorry, I was holding it wrong: they'll be prefixed by the root module name (obviously 🤦 ) It works great! |
Tried it out for our use case, and it works perfectly. Thanks a lot for the quick turnaround! |
In a monorepo, top-level packages are defined like this:
The source is split into subdirectories, but the whole repository consists of a single python package. This layout can be achieved with e.g.
poetry
:Then these packages can be used like this from python code:
I need to set
source_root
to e.g.package_1
, because otherwisetach
thinks that thepackage_<n>_root
is part of the module path.I'd like to enforce dependencies in and between all of these
python_<n>
packages, so it would be great to be able to telltach
that individual packages can reside under different prefixes.The text was updated successfully, but these errors were encountered: