Is it possible for a `@goal_rule` to have more tha...
# plugins
j
Is it possible for a
@goal_rule
to have more than one alias? For instance have
pants launch_jupyter
and
pants lj
do the same thing?
h
right now the name of a goal is determined by the
name
class property of the class specified as
subsystem_cls
on the type that the goal_rule returns
so I don't think there's a way to assign multiple names to the same goal rule
j
Thank you. From a UX perspective it probably isn't a good idea, but I wanted to ask in case I wanted to shoot myself in the foot.
h
The best you could do is factor out most of the logic into a helper
@rule
, and have both `@goal_rule`s call it by putting
JupyterSetup
in the signature of both your `@goal_rule`s But the factoring would be limited. Your helper
@rule
can’t request certain types like
InteractiveRunner
, which are banned from anything but a
@goal_rule
. (This is why
repl.py
and
run.py
are implemented the way they are; the downstream rules provide the setups, and then the
@goal_rule
does the actual side effect)
h
I wonder it wouldn't be too hard to implement "aliases" for goal names. it could be just another class property on the goal return type subsystem, like
name
is now
I also wonder why the
name
of a goal is on the
GoalSubsystem
subclass rather than the
Goal
subclass - the latter seems a bit more natural
h
Yeah, I think so.
pantsbuild/pants
tries hard to minimize the # of goals because it is bad from a UX perspective. But perhaps All Power To Users if they decide the aliases are worth it for their org
I also wonder why the name of a goal is on the GoalSubsystem subclass
The
GoalSubsystem
is the external interface to your goal, e.g. any options and its name