-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Request for "with_attr_docs" feature #2
Comments
Well this is embarrassing, after looking into Still, I'll leave the issue here for now and we can think more about the idea and how to implement it when we're nearer to V2 release. More information on what this does, from here: Extracts fields documentationAllows to extract Sphinx style attributes documentation by processing AST tree of class definition
|
Would you accept a PR that adds a more limited form of this functionality? From looking into pydantic_settings (and the related class_doc) most of the code has to do with parsing comments. If you only support docstrings it's under 100 lines of code. |
Yes I think so, would love to review a PR. |
So you mean only the |
This has now been implemented in pydantic/pydantic#6563. When it's released (not in 2.6.0, unfortunately) |
As mentioned in pydantic/pydantic#4492, I have been using https://github.com/danields761/pydantic-settings/ mostly for its
with_attrs_docs
decorator. (That being said, I wanted to link to its documentation here, but cannot find it…)It greatly reduces the visual noise / clutter when documenting fields that otherwise do not even need a
Field()
.Hence, I would love to see this be supported in this new project as well (not caring so much about the actual syntax / import, in case the name should change).
The text was updated successfully, but these errors were encountered: