Is there a way to restrict which in-repo modules a...
# general
w
Is there a way to restrict which in-repo modules are allowed to be imported to different in-repo modules with pants?
We currently use a separate python script to check for this, but it's proven to be a hard problem (dependency inference, anyone 😄) Our usecase 1. Easier to enforce SRP, which junior devs might struggle with 2. Modules can be classified at different risk levels in medical devices, and separating code by strict module depedencies makes us not drown in regulatory assessments
w
I don't think we can currently, but something like this has come up before. Related? https://github.com/pantsbuild/pants/issues/15247 https://github.com/pantsbuild/pants/issues/13393
w
Yep 👍
p
A very coarse method that is available today is using regex-lint like this: https://github.com/StackStorm/st2/pull/5778 I look forward to better methods in the future.
w
Perhaps this is worthy of a GH Discussion topic (if one doesn't exist)? It seems like this comes up a lot, but I haven't fully grokked what each person imagines it might look like. There is also whether this is a python thing vs a cross-backend thing
Having said that, I do something similar - but I don't use tooling to constrain it in python... I just trust people... Or scold them.