https://pantsbuild.org/ logo
#development
Title
# development
e

enough-analyst-54434

11/29/2022, 11:29 PM
@curved-television-6568 I'm looking at https://github.com/pantsbuild/setup/pull/123 and am wondering how this is used in practice.
Currently it can do anything bash can do, but do you actually only use it like an
.env
file to source env vars?
I'm hoping the latter, but it also seems like the can of worms may be already open.
c

curved-television-6568

11/29/2022, 11:31 PM
Only env vars. Using bashisms to optionally set them only.
e

enough-analyst-54434

11/29/2022, 11:32 PM
Ok. That's good to know. I'll have to contemplate the unknown uses that may have sprouted and what to do about them.
c

curved-television-6568

11/29/2022, 11:33 PM
Hmm.. at svs I’ll have to reach out to see if there were some cmd involved in order to produce some of the values.. like running git to get a rev or so
You want to lock this down more..?
e

enough-analyst-54434

11/29/2022, 11:37 PM
The driver is not that, its starting to think about a native launcher (Rust). That can certainly parse .env and set env, but arbitrary bash is another thing.
👍 1
I'm thinking of transition smoothness mainly. I'd like this to be seamless.
Native launcher aside, if there still is a pants script - which there will need to be probably for the transition, there will also be a side-by-side pants.ps1 and then you're stuck too, but at least that's a totally new use case and so can define new rules with 0 transition.
c

curved-television-6568

11/29/2022, 11:45 PM
ah, ok, I see. that makes sense yea.
I guess there are other tools one may employ to get the same effect, like direnv or something along those lines
e

enough-analyst-54434

11/29/2022, 11:47 PM
Yeah. The loose idea is to use the rust-dotenv crate to try to parse .env and maybe the .pants.bootstrap, but the latter will definitely fail if there is anything bashy above and beyond; so I wanted to check the intent at least. Thanks, this is good background to think further with.
h

hundreds-father-404

11/30/2022, 12:01 AM
How much have we publicized PANTS_BOOTSTRAP? Do we expect it to be used in the wild?
e

enough-analyst-54434

11/30/2022, 12:04 AM
I mean, once its public you have to assume you break someone.
Until I cry uncle, I'll assume that anyway.
c

curved-television-6568

11/30/2022, 12:12 AM
I’ve prescribed that solution at least two or three times, a couple of them just the other week or so.. even wrote https://github.com/pantsbuild/pants/discussions/17633 😛
👍 1
e

enough-analyst-54434

12/02/2022, 10:54 PM
Circling back, supporting
.pants.bootstrap
and that use case was easy enough. As long as the only meaningful side effects of that file are setting env vars, that's covered.
~100us startup overhead does go to 2ms though for a
.pants.bootstrap
with just
: ${GIT_COMMIT:=$(git rev-parse HEAD)}
c

curved-television-6568

12/02/2022, 11:03 PM
I’ll take that hit 😉 as long as it’s opt-in (read it as 2ms in case the file exists not otherwise, right?)
e

enough-analyst-54434

12/02/2022, 11:05 PM
Correct.
👍 1
c

curved-television-6568

12/02/2022, 11:07 PM
I guess most of those 2ms is the
git
command…
e

enough-analyst-54434

12/02/2022, 11:10 PM
1ms for bash 1ms for git
c

curved-television-6568

12/02/2022, 11:10 PM
gotcha