Files
pydantic/docs/usage/devtools.md
T
Samuel Colvin c3098a30cf Consistent __repr__ and __str__ methods for all types (#884)
* Consistent __repr__ and __str__ methods for all types

* add change description

* devtools integration and feedback on repr methods

* fix Color repr

* tests for truncate

* add devtools section to docs

* tests for devtools

* ValidationError inheriting from Representation

* fix imports

* tweaks

* tweak docs

* exec_examples.py integration with __repr__ changes
2019-10-14 17:37:04 +01:00

754 B

!!! note Admission: I (the primary developer of pydantic) also develop python-devtools.

python-devtools (pip install devtools) provides a number of tools which are useful during python development, including debug() an alternative to print() which formats output in a way which should be easier to read than print as well as giving information about which file/line the print statement is on and what value was printed.

pydantic integrates with devtools by implementing the __pretty__ method on most public classes.

In particular debug() is useful when inspecting models:

{!.tmp_examples/ex_debug.py!}

Will output in your terminal:

{!.tmp_examples/ex_debug.html!}