Files
pydantic/docs/usage/devtools.md
T
Arseny Boykov c24d33e5f1 Generate docs exampels for Python 3.10 and above (#4339)
* Generate docs exampels for Python 3.10 and above

Code quality is not great and main intent here is to show the result.

* Fix docs build on 3.9

* Build docs on 3.10

* What's Python 3.1?

* Create temp dir if not exists

* Refactor and improve imlementetion

* Keep runtime typing in examples

* Revert unrelated formatting changes

* Add changes file

* Allow specifying requirements in examples

* Pin autoflake and pyupgrade

* Add docs/build to Makefile lint/format/mypy

* ignore_missing_imports for ansi2html and devtools

* Add .tmp-projections to .gitignore

* Remove dont-upgrade now when Pattern is supported

* Update postponed evaluation examples

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2022-08-14 17:21:53 +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/devtools_main.md!}

Will output in your terminal:

{!.tmp_examples/devtools_main.html!}