feat(v2): rich display for doc and da#1043
Conversation
5d453d4 to
ca7aadf
Compare
|
@anna-charlotte I believe we should tackle pretty printing in this PR as well. at the moment pritting a document array will lool like this |
15b6e0a to
b5923ad
Compare
|
Wrt pretty prints: this PR only includes the pretty print for rich provides a nice pretty print for pydantic models, which we would like to use as the Documents class MyDoc(pydantic.BaseModel):
title: str
mydoc = MyDoc(title='my title')
rich.print(mydoc)output: But for the Documents mydoc.summary()This I opened a question in their discussion to see if there is a nice way to solve this. Therefore for now only pretty print for DocumenArray. |
4592694 to
181b5a9
Compare
|
@anna-charlotte could you please link this PR/Issue to the dev roadmap and tick it off once merged? |
JohannesMessner
left a comment
There was a problem hiding this comment.
Honestly I am lost in all of this rich stuff, but the screenshots look pretty, so that's a thumbs up from me ^^
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: anna-charlotte <[email protected]>
23e3f6a to
2a6bd5c
Compare
|
📝 Docs are deployed on https://ft-feat-rich-display--jina-docs.netlify.app 🎉 |
* feat: add rich display for doc and da Signed-off-by: anna-charlotte <[email protected]> * fix: wip plot Signed-off-by: anna-charlotte <[email protected]> * fix: wip plot Signed-off-by: anna-charlotte <[email protected]> * fix: wip plot Signed-off-by: anna-charlotte <[email protected]> * feat: add math package and minmax normalize Signed-off-by: anna-charlotte <[email protected]> * fix: summary for document Signed-off-by: anna-charlotte <[email protected]> * chore: update poetry lock after rebase Signed-off-by: anna-charlotte <[email protected]> * fix: move all from plotmixin to base document Signed-off-by: anna-charlotte <[email protected]> * feat: add docs schema summary Signed-off-by: anna-charlotte <[email protected]> * feat: add document array summary Signed-off-by: anna-charlotte <[email protected]> * fix: display doc within doc Signed-off-by: anna-charlotte <[email protected]> * fix: in notebook print docs summary Signed-off-by: anna-charlotte <[email protected]> * fix: move summary from da to abstract da Signed-off-by: anna-charlotte <[email protected]> * fix: get schema for doc Signed-off-by: anna-charlotte <[email protected]> * fix: wip doc summary Signed-off-by: anna-charlotte <[email protected]> * fix: wip clean up Signed-off-by: anna-charlotte <[email protected]> * test: add test for da pretty print Signed-off-by: anna-charlotte <[email protected]> * docs: update note Signed-off-by: anna-charlotte <[email protected]> * docs: add some documentation Signed-off-by: anna-charlotte <[email protected]> * fix: apply samis suggestion Signed-off-by: anna-charlotte <[email protected]> * fix: mypy checks Signed-off-by: anna-charlotte <[email protected]> * fix: move to plot mixin Signed-off-by: anna-charlotte <[email protected]> * fix: remove redundant line Signed-off-by: anna-charlotte <[email protected]> * fix: remove comments Signed-off-by: anna-charlotte <[email protected]> * feat: add schema highlighter Signed-off-by: anna-charlotte <[email protected]> * fix: add plotmixin to mixin init Signed-off-by: anna-charlotte <[email protected]> * fix: adjust da summary Signed-off-by: anna-charlotte <[email protected]> * fix: move minmaxnormalize to comp backend Signed-off-by: anna-charlotte <[email protected]> * fix: remove redundant lines Signed-off-by: anna-charlotte <[email protected]> * fix: add squeeze and detach to comp backend Signed-off-by: anna-charlotte <[email protected]> * fix: apply suggestion from code review Signed-off-by: anna-charlotte <[email protected]> * refactor: rename iterable attrs Signed-off-by: anna-charlotte <[email protected]> * fix: clean up Signed-off-by: anna-charlotte <[email protected]> * fix: import Signed-off-by: anna-charlotte <[email protected]> * fix: iterate over fields instead of annotations Signed-off-by: anna-charlotte <[email protected]> * fix: remove math package since moved to comp backends Signed-off-by: anna-charlotte <[email protected]> * refactor: use single quotes Signed-off-by: anna-charlotte <[email protected]> * fix: apply suggestions from code review Signed-off-by: anna-charlotte <[email protected]> * fix: extract summary to doc summary class Signed-off-by: anna-charlotte <[email protected]> * fix: add pretty print for base document Signed-off-by: anna-charlotte <[email protected]> * fix: use rich capture instead of string io Signed-off-by: anna-charlotte <[email protected]> * fix: add colors for optional and union and use only single quotes Signed-off-by: anna-charlotte <[email protected]> * fix: extract display classes to display package Signed-off-by: anna-charlotte <[email protected]> * fix: make da not optional in da summary Signed-off-by: anna-charlotte <[email protected]> * fix: set _console instead of initializing new one everytime in __str__ Signed-off-by: anna-charlotte <[email protected]> * fix: put console at module level Signed-off-by: anna-charlotte <[email protected]> Signed-off-by: anna-charlotte <[email protected]> Signed-off-by: Joan Fontanals Martinez <[email protected]>
Goals:
.summary()to for Document and DocumentArray.Pretty prints:

For
Document:doc.summary()to display the Document instance2184b5 ...instead of2184b53f977f566d72f72a6e706edb00Example:
doc.schema_summary()to display the Document's schemaFor
DocumentArray:Homogenous DocumentsCommon Attributes, instead show the schemaMultimodal dataclass