HitchStory is an open source bolt-on for pytest that, lets you build integration tests which autogenerate scenario-based documentation about your app.
The tests are written in type-safe StrictYAML. In the website example, running the tests generates screenshots and a GIF of the user story from playwright. These are all combined into step-by-step markdown documentation that non developers can follow that explain how your app works.
More here: https://github.com/hitchdev/hitchstory (including locally runnable code examples testing a REST API and a command line interface).