haystack
haystack copied to clipboard
feat: add rendering options for `Pipeline.draw()`
Related Issues
@bilgeyucel and I agree to simplify the diagrams shown in the future tutorials https://colab.research.google.com/drive/1eMfxnsY22NC6nXhh9kBlVK1dgsUurjV6#scrollTo=Tu1bPY3_O5Me and https://colab.research.google.com/drive/1cbHRSSrkadTv-prhnFiG5d9d9RDPCIqu#scrollTo=ze6CrSJSbAl_
Proposed Changes:
Introduces a few parameters to make the pipeline diagram more readable when many components are involved:
-
show_component_names
: whether the name of the component should be shown -
show_optional_inputs
: whether the optional inputs of the component should be shown -
show_connection_types
: whether the type of the connections should be shown -
direction
: whether the plot should be drawn top-down or left-right
Results:
pipe.draw("pipeline.png")
pipe.draw("pipeline.png", show_component_names=False, show_optional_inputs=False, show_connection_types=False)
pipe.draw("pipeline.png", show_component_names=False, show_optional_inputs=False, show_connection_types=False, direction="left-right")
(admittedly not the best example pipeline, but you get the point :smile: )
How did you test it?
Colab notebook, local runs
Notes for the reviewer
n/a
Checklist
- I have read the contributors guidelines and the code of conduct
- I have updated the related issue with new insights and changes
- I added unit tests and updated the docstrings
- I've used one of the conventional commit types for my PR title:
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
. - I documented my code
- I ran pre-commit hooks and fixed any issue
Really cool to have these options 🚀
Pull Request Test Coverage Report for Build 7930614764
Details
- 0 of 0 changed or added relevant lines in 0 files are covered.
- 9 unchanged lines in 2 files lost coverage.
- Overall coverage decreased (-0.02%) to 89.18%
Files with Coverage Reduction | New Missed Lines | % |
---|---|---|
core/pipeline/draw.py | 4 | 94.44% |
core/pipeline/pipeline.py | 5 | 94.23% |
<!-- | Total: | 9 |
Totals | |
---|---|
Change from base Build 7930236372: | -0.02% |
Covered Lines: | 4970 |
Relevant Lines: | 5573 |
💛 - Coveralls
I would prefer that @silvanocerza also take a look, as he has recently worked on this part and has better context than I do.