https://pantsbuild.org/ logo
w

witty-crayon-22786

06/28/2019, 11:19 PM
re: getting a description for `@union`: feel free to change the API however you want
there is a bit of a convention of actually using the
__doc__
string for things
v1 `Task`s use the first line of their
__doc__
as their help
for example
h

hundreds-breakfast-49010

06/28/2019, 11:20 PM
but actually if I swap "description" for "__doc__" in the invcation of
project_str
, that also seems not to work
w

witty-crayon-22786

06/28/2019, 11:20 PM
well, i might have made up "__doc__"... try it out in a repl =x
h

hundreds-breakfast-49010

06/28/2019, 11:20 PM
which makesme thing I'm doing something wrong with getting the Python object in
get_value_from_type_id
no it does seem like "__doc__" is the right python attr for a docstring I tried it
w

witty-crayon-22786

06/28/2019, 11:21 PM
k
a

aloof-angle-91616

06/28/2019, 11:21 PM
make sure it works in python too!! sometimes decorators don’t forward the docstring, and idk if i did that with @union
👍 1
w

witty-crayon-22786

06/28/2019, 11:21 PM
^
a

aloof-angle-91616

06/28/2019, 11:21 PM
functools.wraps()
is the method to use in that case
👍 1
w

witty-crayon-22786

06/28/2019, 11:22 PM
alternatively, have the
def union
decorator actually set a real named property on the union
(using the doc)
and then read that.
but yea.
a

aloof-angle-91616

06/28/2019, 11:22 PM
yes absolutely hack it in as necessary