https://pantsbuild.org/ logo
#general
Title
# general
w

white-pager-32496

11/28/2022, 3:46 PM
Hey all, I wanted to check my understanding after doing some initial due diligence. Given a monorepo, is there a way to model Pants such that the source code in each respective module is only visible to the others via explicit declaration, e.g via BUILD files? Dependency inference seems to suggest that Pants’ philosophy is “see-all” by default, rather than “see-nothing”. Where the monorepo isn’t so much a set of distinct encapsulated modules, but rather a monolithic codebase, which can be carved up into smaller units as desired. My experience is from the JVM/Bazel ecosystem, so I come with baggage :) And what I’m suggesting above isn’t necessarily a better way to do things, it’s just what I’m comfortable with. My main motivation behind wanting this behaviour is that I’m looking to set up rather strict organisational rules around code ownership, dependencies, and modularity. Happy to elaborate, but this is already getting wordy. Thanks!
c

curved-television-6568

11/28/2022, 3:49 PM
As it happens, Pants 2.16.0 will come with a new “visibility” feature that does exactly that. See the draft doc PR here: https://github.com/pantsbuild/pants/pull/17632
b

busy-vase-39202

11/28/2022, 4:02 PM
h

happy-kitchen-89482

11/28/2022, 4:02 PM
Yep, this has been a long-requested feature that we have finally implemented, thanks to @curved-television-6568 ! The nice thing about how this interacts with dep inference is that (unlike with Bazel) the rules will apply to your actual imports, not just your BUILD-file-declared ones.
c

curved-television-6568

11/28/2022, 4:26 PM
the released wheels needs some attention before being usable for the 2.16.0.dev1 release though…
w

white-pager-32496

11/28/2022, 4:54 PM
Wow, well I am very glad I sent this message.
Will jump in and investigate tomorrow morning :)
👍 1