FastEnum: implement __str__ and __repr__ to match StrEnum for docs reproducibility#2139
Conversation
b8bf0ee to
00544d3
Compare
|
Thanks for the patch. This looks like a good documentation improvement even ignoring reproducibility. One might argue that sphinx-click using The default One possibility would be to implement I haven't properly tested this but I think click will call |
00544d3 to
e5007e7
Compare
|
Thank you for taking the time to review this @juergbi. I have pushed a new version adjusting the Thanks again. |
|
You missed one case on line 1676 of |
e5007e7 to
60aa4e5
Compare
|
Apologies, I have applied both these suggestions now and pushed a new version. Thanks for taking the time to review this further. |
This means we can drop the redundant __str__ implementation on the subclass _PipelineSelection.
60aa4e5 to
8295936
Compare
This should mean the StrEnum-style repr is used by sphinx-click when rendering the default in documentation, resulting in `all` rather than `<buildstream.types._PipelineSelection object at 0xabc>`.
8295936 to
7967a16
Compare
I have been looking to package BuildStream's documentation alongside the application and library in Debian. Debian policy now requires that binary packages, including documentation, are reproducible, so this MR is motivated by fixing the (only) reproducibility failure Debian CI discovered in BuildStream's documentation, in the
Using / Commandspage.This is my first upstream patch to BuildStream, so I am of course happy to adjust as needed. Thank you for your consideration!
sphinx-click uses
__repr__when rendering thedefaultoption of aclick.choicein the HTML documentation [ref].Implementing
__repr__on_PipelineSelectiongives more helpful (and reproducible) documentation than the default representation,<buildstream.types._PipelineSelection object at 0x7f775b6b4ec0>. As an example in the documentation ofbst show:Mainline:
This branch: