At the summit, we concluded that a `contrib` directory in the pantsbuild.pants repo would act as a home for plugins and utilities that didn't quite fit into core pants, or which were still new enough that we wanted to delineate them from mature backends.I'm about to put some time into open sourcing and upstreaming buildgen (another action item from the summit), and I want to add it to this directory. Here's my proposed layout (using buildgen as an example):contrib/buildgen/{src,test}/{jvm,python,etc}/Concretely for jvm:contrib/buildgen/{src,test}/jvm/com/pants/contrib/buildgen/...Concretely for python:contrib/buildgen/src/python/pants/contrib/buildgen/...andcontrib/buildgen/test/python/pants_test/contrib/buildgen/...With the big questions being:* Should {src,test} be under contrib/{subproject}? I'm voting yes since it localizes a contributed project's code into a single subdirectory, making it easier to read and navigate. The downside of this is that it adds a couple of source roots per contributed project.
* Should python code in contributed projects be under the pants namespace package, in particular pants.contrib? I'm also going with yes since it will play well with our intended goal of distributing modular plugins for pants under the pants namespace. But namespace packages in python can be tricky, so I'm interested in hearing opinions on this.
Any other thoughts?
On Sat, Feb 7, 2015 at 12:12 PM, Patrick Lawson <p...@foursquare.com> wrote:At the summit, we concluded that a `contrib` directory in the pantsbuild.pants repo would act as a home for plugins and utilities that didn't quite fit into core pants, or which were still new enough that we wanted to delineate them from mature backends.I'm about to put some time into open sourcing and upstreaming buildgen (another action item from the summit), and I want to add it to this directory. Here's my proposed layout (using buildgen as an example):contrib/buildgen/{src,test}/{jvm,python,etc}/Concretely for jvm:contrib/buildgen/{src,test}/jvm/com/pants/contrib/buildgen/...Concretely for python:contrib/buildgen/src/python/pants/contrib/buildgen/...andcontrib/buildgen/test/python/pants_test/contrib/buildgen/...With the big questions being:* Should {src,test} be under contrib/{subproject}? I'm voting yes since it localizes a contributed project's code into a single subdirectory, making it easier to read and navigate. The downside of this is that it adds a couple of source roots per contributed project.I'd personally prefer:contrib/src/python/buildgen/scroogegen/src/jvm/com/pants/buildgen/scroogegen/AKA a single source-tree layout for all contrib - *BUT* - your proposal will almost certainly more friendly to the vast majority of contibutors... so sgtm.
* Should python code in contributed projects be under the pants namespace package, in particular pants.contrib? I'm also going with yes since it will play well with our intended goal of distributing modular plugins for pants under the pants namespace. But namespace packages in python can be tricky, so I'm interested in hearing opinions on this.They are tricky, but pants must be able to handle them since pants users will use them even if we don't. So I'm again +1
Any other thoughts?
On Sat, Feb 7, 2015 at 4:47 PM, John Sirois <john....@gmail.com> wrote:On Sat, Feb 7, 2015 at 12:12 PM, Patrick Lawson <p...@foursquare.com> wrote:At the summit, we concluded that a `contrib` directory in the pantsbuild.pants repo would act as a home for plugins and utilities that didn't quite fit into core pants, or which were still new enough that we wanted to delineate them from mature backends.I'm about to put some time into open sourcing and upstreaming buildgen (another action item from the summit), and I want to add it to this directory. Here's my proposed layout (using buildgen as an example):contrib/buildgen/{src,test}/{jvm,python,etc}/Concretely for jvm:contrib/buildgen/{src,test}/jvm/com/pants/contrib/buildgen/...Concretely for python:contrib/buildgen/src/python/pants/contrib/buildgen/...andcontrib/buildgen/test/python/pants_test/contrib/buildgen/...With the big questions being:* Should {src,test} be under contrib/{subproject}? I'm voting yes since it localizes a contributed project's code into a single subdirectory, making it easier to read and navigate. The downside of this is that it adds a couple of source roots per contributed project.I'd personally prefer:contrib/src/python/buildgen/scroogegen/src/jvm/com/pants/buildgen/scroogegen/AKA a single source-tree layout for all contrib - *BUT* - your proposal will almost certainly more friendly to the vast majority of contibutors... so sgtm.I agree with John that a single layout for all contrib is preferable. Otherwise we all have to keep modifying our IDE settings. In general, proliferation of source roots is one of the things Pants is great at preventing in our monorepos. It's at least partly why we're all using it. So I think we should practice what we preach.
I disagree that this is really about maven vs. pants. In an internal monorepo, the desire to have a single src and test directory stems largely from the fact that the code within that repo is intended to be seen as an indivisible unit. On the other hand, the specific point of contrib projects is that they (1) potentially start outside the repo and get integrated later--and we don't want to add friction to that integration and (2) can be clearly separated when editing (and to be clear, I don't think of intellij or whatever when I say this, just directory layout).
I will pile on to just having one 'src' and 'test' directory under contrib. Besides the reasons already mentioned, there is convention established as that is how the other 'examples' and 'testprojects' directories are setup.
Speaking of convention, I've never understood why we change ‘pants’ to ‘pants_test’ under test directories, like this:
src/python/pants/…
test/python/pants_test/…
why not just
test/python/pants/...
?
I will pile on to just having one 'src' and 'test' directory under contrib. Besides the reasons already mentioned, there is convention established as that is how the other 'examples' and 'testprojects' directories are setup.
Speaking of convention, I've never understood why we change ‘pants’ to ‘pants_test’ under test directories, like this:
src/python/pants/…
test/python/pants_test/…why not just
test/python/pants/...
I will pile on to just having one 'src' and 'test' directory under contrib. Besides the reasons already mentioned, there is convention established as that is how the other 'examples' and 'testprojects' directories are setup.
Here's the thing - if you treat a contrib as a vertical it will be a vertical. Joe contribs console helper foo with innovation bar that stays in the foo vertical. Jane contributes baz that could use the bar innovation but she either doesn't discover it because - verticals, or she does and is intimidated or too lazy to factor bar into a shareable target. This story is not contrib special, its true of any repo with maven style (vertical) layout - IMO.
Lots of good arguments, so implementers wins. The one who steps up to do the work has a stronger weighting! I'd go for you proposal Patrick and burn down the bikeshed before it gets its roof.