-
Notifications
You must be signed in to change notification settings - Fork 242
[Docs] Implement mkdocstring to automatically create pydantic docsstrings #1546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
… description are not hyperlinked It is those discrepancies that make it really frustrating to implement quickly at scale
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Sadly we need to leave the default text for the fields that draw their type from types.py
for more information, see https://pre-commit.ci
|
Just a quick comment: "If fields do not have a description, they do not appear in attributes (maybe ok), and so they don't appear in TOC on the right" - this sounds good to me actually, since it prevents |
Hm maybe... I just don't like the mismatch with the TOC on the right hand side. If you scan that you could think that this attribute just doesn't exist. But I guess that's just taste. The type I got rid of completely with the the extension |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements mkdocstrings to automatically generate Pydantic docstrings from model field definitions, removing the need for manual Args: sections in docstrings. The changes clean up documentation by removing redundant "Defaults to X" text from field descriptions and add support for better automatic API documentation generation.
Changes:
- Implemented griffe-pydantic extension and FilterPrivateAttrs custom extension for automatic Pydantic docstring generation
- Removed manual
Args:sections from model docstrings across all model files - Removed "Defaults to X" text from field descriptions to avoid redundancy with auto-generated documentation
- Added constants API documentation page
Reviewed changes
Copilot reviewed 38 out of 39 changed files in this pull request and generated 21 comments.
Show a summary per file
| File | Description |
|---|---|
| mkdocs.yml | Added griffe-pydantic plugin configuration and new constants documentation page |
| griffe_extensions.py | Added FilterPrivateAttrs extension to filter private attributes from generated docs |
| hatch.toml | Added griffe-pydantic dependency |
| constants.md | New documentation page for constants |
| Multiple model files | Removed Args sections, updated field descriptions, commented out validators |
| 0.1.51.dev0.json | Updated schema to reflect docstring changes |
| changelog.d/*.md | Empty changelog fragment |
| .gitignore | Added .playwright-mcp/ entry |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
antonymilne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is super exciting 😁 Just skimmed through and left a couple of random comments and will review properly tomorrow!
View the example dashboards of the current commit live on PyCafe ☕ 🚀Updated on: 2026-01-28 10:59:21 UTC Compare the examples using the commit's wheel file vs the latest released version: vizro-core/examples/scratch_devView with commit's wheel vs View with latest release vizro-core/examples/dev/View with commit's wheel vs View with latest release vizro-core/examples/visual-vocabulary/View with commit's wheel vs View with latest release vizro-core/examples/tutorial/ |
Co-authored-by: Copilot <[email protected]>
for more information, see https://pre-commit.ci
…ocs/mkdocstring_2
Closes https://github.com/McK-Internal/vizro-internal/issues/1345
Description
PR is now based on a custom
jinjatemplate, essentially overwriting a fair bit of what thegriffe-pydanticextension does/should do.For lack of time, most of this was originally LLM created, but the results look stable and good.
New in the PR
table, which is (in my eyes) a lot clearerSome quirks:
default_factoryand the default of fields that have been excluded from the schemaFor review
Mainly check the API docs reference - models and actions have changed the most.
Not soved
I could not get the table to highlight on hover for the pydantic fields, unlike the normal table for docstring parameters
Screenshot
Notice
I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":