Stabilising experimental_shell_command
and friends
#18082
Replies: 10 comments 33 replies
-
I like the |
Beta Was this translation helpful? Give feedback.
-
As mentioned on the stabilization ticket, I remain concerned that I agree with the benefits that you point out, but those would still be achievable with any mechanism used to "run a runnable". Something similar to the syntax that I floated a while back (#17405 (comment)) still seems like it would allow for achieving that. Updating that for the current shape of the "run a runnable" syntax, that might instead look like environment variables which expand to a complete way to run the runnable: experimental_shell_command(
command="$RUNNABLE_NPM_THING && $RUNNABLE_PYTHON_THING",
dependencies=[
":running-python-thing",
":running-npm-thing",
],
) This would compose across multiple languages and tools, and would avoid having two very similar shaped target types. |
Beta Was this translation helpful? Give feedback.
-
Note that I am considering the naming discussion concluded at this point. Following the above discussion: I'm in favour of having An alternative way forward is to pursue only adding the |
Beta Was this translation helpful? Give feedback.
-
OK, this has gone quiet for a day or two, so here's where I think we're at:
With that in mind, here's how I would like to proceed: PROPOSAL: Rename and move PROPOSAL: PROPOSAL: Rename PROPOSAL: Create a ticket describing an PROPOSAL: Create a ticket for making PROPOSAL: Create a ticket (or update an existing one) for making digest manipulation actions (e.g. alter prefix, rename, etc) easier within This effectively represents stabilising the features that already exist within Pants' EDIT: 2023-02-06 Per @jsirois comment I'm adding the following two proposals PROPOSAL: Create a ticket describing a feature that allows users to select a shell other than |
Beta Was this translation helpful? Give feedback.
-
Reading through all this, and with my not-letting-the-great-be-the-enemy-of-the-good hat on, I think stabilizing eris makes sense (whether in 2.16 or 2.17 is open to debate). It covers substantial real use-cases in a streamlined way (although I still want to see some JS examples...) I'd like to see real-world demand for the proposed composability of runnables inside an esc before deciding that going down that route is worth stalling for. |
Beta Was this translation helpful? Give feedback.
-
Also, we haven't (I think?) discussed the option of a shell script itself being a runnable via a " Right now eris/esc and friends are in the shell backend, but that is confusing things. The shell backend should be for "I have shell sources in my codebase", just like python, go, java etc. eris/esc and friends don't interact with any of that (afaict) and are really more like core Pants mechanisms. But just as eris can run a Python or Java runnable, if the relevant backend is enabled, it should be able to run a Shell one if that backend is enabled. |
Beta Was this translation helpful? Give feedback.
-
So, we have what appears to be a useful thing with |
Beta Was this translation helpful? Give feedback.
-
With #18237, I've implemented something close to what @cognifloyd suggested in his comment:
With this change adopted, we would be in a position to stabilise Thoughts? |
Beta Was this translation helpful? Give feedback.
-
The changes in #18082 (comment) have now been applied. I'll be creating the tickets suggested earlier on in the ticket shortly. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
tl;dr: link to the current list of proposals under consideration
After a bunch of work, we're now in a position where the contents of
shell_command.py
are ready for their forever home in Pants.This ticket describes the things that need to be done, along with initial proposals for what we do to accomplish these. These are subject to discussion.
Note that
experimental_wrap_as_*
, while written largely to supportexperimental_shell_command
(esc
) andexperimental_run_in_sandbox
(eris
), are not subject to this stabilisation work, since there are known deficiencies with the current approach.Moving and renaming
experimental_run_in_sandbox
eris
solves the technical problem of not being able to use build scripts written in Pants-supported languages as ad-hoc steps in Pants, along with the secondary goal of allowing 3rd-party tools to be integrated into a Pants installation in an ad-hoc fashion.It also fulfils a philosophical goal of Pants: code quality is better if it's validated and tested. Currently, we have a great answer for production code, but not for code that is run in the build itself. With
eris
, these ad-hoc steps can be quality-checked by other Pants goals (test/lint/fmt/fix/check). Such validation is not possible withesc
as it is currently designed.We should encourage using code that can be quality-checked over code that cannot.
PROPOSAL:
eris
is documented as the preferred way to run user-supplied code as a build step, whenever it is possible, notesc
.esc
should be introduced only for cases where Pants does not provide any support.See future work for an important realisation on this topic.PROPOSAL: Rename and move
experimental_run_in_sandbox
from theshell
subsystem. The proposed new subsystem name ispants.backend.adhoc
, and the target be namedadhoc_tool
.I'm proposing the name
adhoc
overgeneric
, because I feel it describes the use cases for these targets: one-off cases where a plugin does not exist, or would not be suitable. To me,generic
, invokes the idea of re-use, which doesn't really apply here. On the other hand,adhoc
invokes the idea of "this is a thing that is being done instead of a plugin". Happy to bikeshed this one.Renaming
experimental_shell_command
PROPOSAL: Rename
experimental_shell_command
toshell_command
.Once
shell_source
is runnable througheris
,esc
will only be the preferred option for trivial shell commands. At this point,shell_command
is the obvious name for the thing that executes a line of shell scriptPROPOSAL: Rename
experimental_test_shell_command
toshell_command_test
This is in line with nomenclature for other targets.
Removing
experimental_run_shell_command
PROPOSAL: Delete
experimental_run_shell_command
(ersc
), and makeshell_command
runnable.Now that
esc
supportsworkdir
, andtools
is optional foresc
, there is negligible difference betweenesc
andersc
from an interface perspective. Makingesc
runnable would reduce the number of targets (and would be in line with the goal of making more targetsrunnable
, for use ineris
). It would also open up the possibility ofesc
being used as therunnable
foreris
, which is important (see Future work).Future work
This list addresses possibilities that are enabled by following the above proposal.
Enable
shell
usage througheris
Note that the
shell
backend currently does not implementRunRequest
onshell_source
targets. However, ifRunRequest
were implemented, thenshell_source
targets could be executed usingeris
, which would make it possible to quality-check those build steps.With this in mind, we should be encouraging
eris(runnable=some_shell_source)
as the preferred way to execute ad-hoc shell code in all but the most trivial of cases.### Alloweris
to run multiplerunnable
s in sequence in the same sandboxIfshell_command
becomes arunnable
target (that could optionally be supplied toeris
), then it would be possible to string together severalrunnable
steps in the samesandbox
if you needed to compose the results of multiple ad-hoc steps.Consensus/decision making.
I'll leave this discussion open for 48 hours to allow for initial thoughts and to see if consensus emerges. If some alternate viewpoints emerge, I'll try to find consensus, and allow 24 hours of cooling off to see if we've actually met consensus. Ideally the contentious decisions policy won't come into play, but if we don't achieve consensus, then that's what it's there for.
Beta Was this translation helpful? Give feedback.
All reactions