Skip to content

Conversation

willmcgugan
Copy link
Contributor

@willmcgugan willmcgugan commented Aug 15, 2021

Change Summary

Adds support for the Rich Repr Protocol so that Rich can pretty print PyDantic objects.

Screen Shot 2021-08-15 at 14 13 35

Note that Rich does not need to be added a dependency. If PyDantic objects are printed with Rich you will get the formatting above, otherwise there are no changes.

Related issue number

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes where applicable
  • changes/<pull request or issue id>-<github username>.md file added describing change
    (see changes/README.md for details)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

@willmcgugan
Copy link
Contributor Author

please review

Not sure if this change warrants any update to the docs. If anything, maybe a sentence or two max, but where?

@samuelcolvin
Copy link
Member

Thanks so much.

When life is less manic I'll review and merge.

Copy link
Collaborator

@PrettyWood PrettyWood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could probably add a note under Usage with devtools (e.g. Usage with rich) with just a screenshot and a link to rich. WDYT?

@PrettyWood
Copy link
Collaborator

Please update

@github-actions github-actions bot added awaiting author revision awaiting changes from the PR author and removed ready for review labels Sep 4, 2021
willmcgugan and others added 2 commits September 7, 2021 14:51
Adds code to markdown

Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
@willmcgugan
Copy link
Contributor Author

@PrettyWood Added a Usage with rich page as suggested. Here's what it looks like:

Screen Shot 2021-09-07 at 15 19 04

@PrettyWood PrettyWood removed the awaiting author revision awaiting changes from the PR author label Sep 7, 2021
@PrettyWood
Copy link
Collaborator

Looks great! Thank you 🙏 (big fan of your work btw)

@manzt
Copy link

manzt commented Feb 4, 2022

Love rich and pydantic, hope this gets merged!

@soumendra
Copy link

Great work. Hopefully we'll see this in the next pydantic release?

@samuelcolvin samuelcolvin enabled auto-merge (squash) August 4, 2022 13:38
@samuelcolvin
Copy link
Member

Thanks so much @willmcgugan, much appreciated.

Sorry this has taken so long to get to.

@samuelcolvin samuelcolvin merged commit e58dad6 into pydantic:master Aug 4, 2022
@willmcgugan
Copy link
Contributor Author

Thanks @samuelcolvin !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants