feat: add Attributes section support and configurable docstring style#33
Merged
feat: add Attributes section support and configurable docstring style#33
Conversation
Fixes #32: The `Attributes:` section in Google-style class docstrings is now properly rendered in the generated MDX output, matching the behavior of `Args:`, `Returns:`, and `Raises:` sections. Addresses #31: Added `--docstring-style` CLI option to configure the docstring parsing style. Supports "google" (default), "numpy", and "sphinx" styles. Changes: - Add handler for `attributes` section kind in `format_docstring_with_griffe()` - Add `style` parameter to `format_docstring_with_griffe()` (defaults to "google") - Add `docstring_style` parameter to `generate_mdx()` function - Add `--docstring-style` CLI argument with choices: google, numpy, sphinx - Add comprehensive unit tests for both features 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds support for rendering Attributes: sections in Google-style class docstrings and introduces a configurable --docstring-style CLI option to support multiple docstring formats (Google, NumPy, and Sphinx).
- Added handler for
attributessection in the Griffe-based docstring formatter - Introduced
--docstring-styleCLI argument with validation for three supported styles - Added comprehensive test coverage with 6 new unit tests
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/mdxify/formatter.py |
Added style parameter to format_docstring_with_griffe() function and implemented attributes section handler with colon escaping |
src/mdxify/generator.py |
Added docstring_style parameter to generate_mdx() and propagated it to all format_docstring_with_griffe() calls for functions, classes, and methods |
src/mdxify/cli.py |
Added --docstring-style CLI argument with choices validation and ensured parameter is passed through both serial and parallel processing paths |
tests/test_formatter.py |
Added 6 comprehensive tests covering attributes section rendering, multiple docstring styles (Google, NumPy, Sphinx), and default behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Attributes:section in Google-style class docstrings is now properly rendered in the generated MDX output--docstring-styleCLI option to configure the docstring parsing styleChanges
Issue #32 - Attributes section not rendered
Added handler for
attributessection kind informat_docstring_with_griffe(). Attributes are now rendered identically to howArgs:,Returns:, andRaises:sections are rendered:Issue #31 - Docstring style configurability
Added
--docstring-styleCLI option with three choices:google(default) - Google-style docstringsnumpy- NumPy-style docstringssphinx- Sphinx-style docstringsExample usage:
Test plan
stack_datalibrary (has Google-style Attributes in class docstrings)--docstring-styleoption with numpy-style docstrings🤖 Generated with Claude Code