You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We might consider storing all code examples used in the documentation as individual .py files. When the docs are built, each example is evaluated and the code (along with whatever is printed to stdout) is templated into the docs.
Projects like Pydantic use this approach and it allows them to:
Have confidence that all examples in the documentation work properly (examples that won't run would fail the CI pipeline)
Give readers of the documentation more information (they see the output of the code snippet without needing to copy & execute it themself)
Minimize maintenance, as the output would be automatically generated.
We might consider storing all code examples used in the documentation as individual
.py
files. When the docs are built, each example is evaluated and the code (along with whatever is printed to stdout) is templated into the docs.Projects like Pydantic use this approach and it allows them to:
Here's one example from Pydantic:
The text was updated successfully, but these errors were encountered: