https://pantsbuild.org/ logo
s

straight-farmer-24902

04/27/2023, 12:57 AM
Hi, I am kinda new to
pants
, and had a question about optionally doing builds during run time. So we have a repo that has Python and Go code, and we run one of the Python script in CI (Buildkite) using
pants
. But it fails while looking for Go binaries. Is there a way to tell
pants
to skip
Go
build during run time?
Copy code
./pants run <path to python file> --args1 args1
e

enough-analyst-54434

04/27/2023, 1:05 AM
Do you want to turn off Go support completely for CI?
If so you could have a CI pants.toml override file you activate by having CI export `PANTS_CONFIG_FILES=pants.no-go.toml`:
Copy code
[GLOBAL]
backend_packages.remove = ["pants.backend.experimental.go"]
s

straight-farmer-24902

04/27/2023, 1:08 AM
Just for that run.
e

enough-analyst-54434

04/27/2023, 1:09 AM
Ok, you can do that then as a fairly ugly hack, but easy to implement and try real quick.
c

curved-television-6568

04/27/2023, 1:09 AM
won’t that make pants choke on go targets then?
e

enough-analyst-54434

04/27/2023, 1:09 AM
Damn Pants
I guess
c

curved-television-6568

04/27/2023, 1:10 AM
had the same idea but no feasible work around.. would be nice perhaps with exposing a
--ignore-unknown-targets
flag..
e

enough-analyst-54434

04/27/2023, 1:11 AM
I'd rather Pants didn't nanny quite so much, but since it does - yeah - maybe that.
The real fix here though is that Pants shouldn't need Go or any binaries if it doesn't actually use them. That seems like a bug.
c

curved-television-6568

04/27/2023, 1:13 AM
yea
s

straight-farmer-24902

04/27/2023, 1:14 AM
Agreed, I have to unnecessary blot the environment.
e

enough-analyst-54434

04/27/2023, 1:15 AM
Maybe Pants does really use Go binaries as part of parsing BUILD somehow.
c

curved-television-6568

04/27/2023, 1:16 AM
I think it is during parsing of dependencies or some such..
e

enough-analyst-54434

04/27/2023, 1:16 AM
Dep inference
Yeah 😕
c

curved-television-6568

04/27/2023, 1:17 AM
so there’s likely some too eager
AllTargets
-> Deps lookup going on..
e

enough-analyst-54434

04/27/2023, 1:18 AM
This is apparently totally ad-hoc, not present for Go fwict, but: https://www.pantsbuild.org/docs/reference-scala-infer#imports
So if that sort of thing were around for Go, turning it off might work.
h

happy-kitchen-89482

04/29/2023, 12:49 AM
Yeah, I think this is due to needing to use go to parse .go files for dep inference, because as far as Pants knows, the python file might depend on a go file. But that is clearly silly, and we should have a way to not do this.
2 Views