-
Notifications
You must be signed in to change notification settings - Fork 25
Updating docstring output format to use Google doc style #49
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
Conversation
…eptions line-by-line like we do when writing them out.
|
Tagging @henryiii for review. Noting also that the In addition to unit tests, I also ran this on a rather large codebase at work (which is where I found the missing |
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 converts the docstring output format from a custom style to Google-style docstrings, implementing issue #25. The changes restructure how Doxygen-style comments (@param, @return, @throws, etc.) are parsed and reformatted into Google-style sections (Args:, Returns:, Raises:, etc.).
Key changes include:
- Refactored docstring parsing to use regex patterns for extracting parameter, return, and exception documentation
- Implemented new paragraph wrapping logic to properly handle indentation and list formatting
- Added the missing MKD_DOC6 macro definition
- Migrated tests to use truth files for easier maintenance of expected outputs
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pybind11_mkdoc/mkdoc_lib.py | Core implementation of Google-style docstring formatting with new regex patterns and paragraph wrapping logic |
| tests/sample_header_test.py | Refactored to use truth files and added test_generate_headers_2 for new test case |
| tests/sample_header_docs/sample_header_truth.h | Truth file for sample_header test with MKD_DOC6 added and improved list formatting |
| tests/sample_header_docs/sample_header_2.h | New test input file with comprehensive Doxygen-style comments |
| tests/sample_header_docs/sample_header_2_truth.h | Expected output for sample_header_2 demonstrating Google-style formatting |
| tests/long_parameter_test.py | Updated expected output to match new Google-style format (Args: instead of Parameter) |
| tests/cli_test.py | Refactored to use truth file instead of inline string for expected output |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
henryiii
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.
A couple of optional nitpicks. Format might have to be rerun if applied.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Henry Schreiner <[email protected]>
Co-authored-by: Henry Schreiner <[email protected]>
@henryiii These all look good to me. I've approved them, made some minor tweaks, and all checks are passing. |
|
Thank you! |
This PR implements #25. It modifies how docstrings are parsed/formatted so that the output for the parameters, return type, and exceptions comes out as a Google-style docstring. In addition, it contains a few other fixes:
MKD_DOC6, which seems to be missinguvx hatch fmterrors from to get CI working again