https://pantsbuild.org/ logo
f

fresh-continent-76371

01/27/2023, 9:39 PM
Does anyone have any public real world examples of a pants repo that is building python, and c++ or rust ? I understand c++/rust would be via shell but visible examples would be good
l

loud-laptop-17949

01/27/2023, 9:48 PM
I haven't used it, but there is a non-documented cc backend https://github.com/pantsbuild/pants/tree/main/src/python/pants/backend/cc
b

busy-vase-39202

01/27/2023, 10:03 PM
That's @wide-midnight-78598's handiwork, so would be best able to point to examples if any are public. I believe he created it for private client work, so there may not be public repos to point to (for now).
@ancient-vegetable-10556 has been working on improvements to shell support that might also be relevant to this question. I believe those are scheduled for Pants 2.16, so examples may be a couple months away?
@fresh-continent-76371 is that any more info you can share on what need prompted the question? Perhaps there's another way we can meet the underlying need, while those two features are in progress.
f

fresh-continent-76371

01/28/2023, 11:25 AM
Yes of course. I have a repository of 50% python and 50% C++. With rust a potential down the track. There are some other technologies, but these are the primary. I switched the trial from Pants to Bazel and have most things working well. But pants has better python support, and the docker building experience was nicer with pants But for the c++ , bazel is kind of the answer; unless someone has done some good examples
b

busy-vase-39202

01/28/2023, 11:30 AM
Ah interesting. One thing you could opt to do in the interim is use both systems until Pants' C++ support is finished. Pants and Bazel can be run side by side in the same repo. You would configure Pants to use a different BUILD filename such as BUILD.pants. Then, say, configure Pants to build the Python portion of the codebase and Bazel to build the C++ side for now. It's not ideal, especially if you have a large team. But for a couple of months it could do as a workaround.
f

fresh-continent-76371

01/28/2023, 11:33 AM
What about a shell rust / cargo example ?
b

busy-vase-39202

01/28/2023, 11:34 AM
We don't have Rust support yet.
đź‘Ť 1
f

fresh-continent-76371

01/28/2023, 11:43 AM
Am I mistaken in thinking: any language build can be wrapped managed and cached , with work using the _shell command ?
b

busy-vase-39202

01/28/2023, 11:45 AM
@ancient-vegetable-10556 is the best person to answer that. I expect you'll hear from him on Monday.
a

ancient-vegetable-10556

01/30/2023, 4:12 PM
@fresh-continent-76371 yes, that’s a good summary. As long as the tools used in your
_shell_command
can be found on your
PATH
, you can invoke them in the sandbox, and get caching that’s as fine-grained as the targets you define.
There’s some limitations in how you can use the outputs of a shell command that will be fixed in Pants v2.16 (e.g it’s difficult to package files produced in that manner into an
archive
target).
6 Views