wide-midnight-78598
07/22/2022, 1:48 PMexport
vs export-codegen
?
export
- Export Pants data for use in other tools, such as IDEs.
export-codegen
- Write generated files to dist/codegen
for use outside of Pants.
I'm missing some of the nuances as to what determines whether a new plugin should use one over the other, since they both appear to end up in the dist
folder. https://www.pantsbuild.org/docs/setting-up-an-ide has some additional examples, which are virtualenv
vs protobuf
. The best heuristic I can come up with is that export
is intended for tooling/support/not-part-of-release, while export-codegen
would represent files which would be part of the compilation/packaging/binary/production release process.
Specifically, I would wonder where the bash completions would go, and based on my assumption above, it's more likely an export
since it's sourced by the terminal, and has no part in actual production code.fast-nail-55400
07/22/2022, 1:51 PMSpecifically, I would wonder where the bash completions would go, and based on my assumption above, it’s more likely anThe v1 bash completions were generated by a dedicatedsince it’s sourced by the terminal, and has no part in actual production code. (export
bash-completion
goal.fast-nail-55400
07/22/2022, 1:52 PMcompletions
goal taking a --shell=bash
argument seem fine to me.happy-kitchen-89482
07/22/2022, 2:46 PMhappy-kitchen-89482
07/22/2022, 2:46 PMhappy-kitchen-89482
07/22/2022, 2:47 PMhappy-kitchen-89482
07/22/2022, 2:47 PMexport-venv
goal, which would have meant creating a specific and python-only goal.happy-kitchen-89482
07/22/2022, 2:48 PMexport
into a generic goal, with the idea of maybe folding export-codegen into ithappy-kitchen-89482
07/22/2022, 2:48 PMhappy-kitchen-89482
07/22/2022, 2:50 PMexport
goal takes a target set as input, and so its motion is "export per-backend exportables from these targets". But , for example, the most useful input to "export a venv" is probably the name of a lockfile, not a set of targetshappy-kitchen-89482
07/22/2022, 2:51 PMhappy-kitchen-89482
07/22/2022, 2:51 PMhappy-kitchen-89482
07/22/2022, 2:53 PMhappy-kitchen-89482
07/22/2022, 2:53 PMexport
what to exporthappy-kitchen-89482
07/22/2022, 2:54 PMwide-midnight-78598
07/22/2022, 3:49 PMinspect
or something, since they're not directly related to deliverable code)
◦ The whole fix
vs fmt
discussion is a good example of how tricky the public API can be, especially if it ever involved a change
◦ Testing bash completions has really pushed this idea with me, seeing which goals don't have options, which do - and just generally trying to tab complete everything to see whether I can guess what can come next
• It sounds like export
and export-codegen
could feasibly be merged, from a user-centric point-of-view (completely unrelated to technical implementation/details and targets and such)
◦ As a user, knowing that export
takes "inside Pants" to "outside Pants", that's already good enough to provide me with direction
◦ Having options or targets seem reasonable ./pants export --venv
or ./pants export :protobuf_stuff
or ./pants export --completions
◦ Upon reading that, I'm not a huge fan of how that reads - but at least I could infer what it would do pretty easily upon reading
Now, so this doesn't get bogged down as a generic API discussion, specifically with regards to completions - I'm at a bit of an impasse regarding where the completions should go in the next PR. I could put the file somewhere and use..../pants run
?happy-kitchen-89482
07/22/2022, 5:06 PMwide-midnight-78598
07/22/2022, 5:11 PMhappy-kitchen-89482
07/22/2022, 5:40 PMhappy-kitchen-89482
07/22/2022, 5:41 PMwide-midnight-78598
07/22/2022, 5:46 PMwide-midnight-78598
07/22/2022, 5:48 PMwide-midnight-78598
07/22/2022, 5:50 PMwide-midnight-78598
07/22/2022, 6:08 PMpants
file - would it make sense to source the ./dist/pants-completion.bash
? So that it's basically there by default? In the same way we source common.sh
or pants_venv
?
If something like that is reasonable, I think that's a good step forward
Edit: Hmmm - I might be thinking of the mainline repo's pants
script, but either way, if something like this idea is feasible.....