All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Fixed
- Bug where non-ASCII characters would mess up auto formatting
- Full diff
- Fixed
- Multiline annotations now normalize without inserting spaces inside
Literal[...]or other bracketed signatures, even when they span several lines. - A bug where bare
*args/**kwargssignature lines (typed or untyped) would be merged into previous descriptions - NumPy signature syncing left the
:class:/:meth:role prefixes behind, producing mismatched annotations like: MyClass
- Multiline annotations now normalize without inserting spaces inside
- Full diff
- Fixed
- A bug where
Generator[XXX, YYY, ZZZ]in the return type annotation is not parsed correctly (the Yields section should have been XXX)
- A bug where
- Full diff
- Fixed
- A bug where 2nd pair of backticks can't be added for dunder names (such as
__init__) - A bug where input args named
defaultwould get treated incorrectly (the tool would confuse it with the default values)
- A bug where 2nd pair of backticks can't be added for dunder names (such as
- Full diff
- Added
- A lot more linters
- Formatters for TOML and INI config files
- Changed
- A lot of code changes to pass the linter checks
- Removed
- Unnecessary pre-commit hooks
- Full diff
- Added
- Formatting support for type hints and default values in class docstrings
- Full diff
- Fixed
- A bug where raised exceptions in docstrings are incorrectly changed
- Full diff
- Added
- AST-driven synchronization of NumPy
ParametersandReturnssignature lines with the function signature, including tuple element expansion for multi-line return blocks
- AST-driven synchronization of NumPy
- Full diff
- Added
- A "
# no-format-docstring" directive to ignore certain docstring - Verbose diff output via
--verbose diffand[tool.format_docstring] verbose - Normalize NumPy section headings that include trailing colons (e.g.,
Parameters:); also, fix Google-style "Arg" header into "Parameters"
- A "
- Changed
- Added "self format" pre-commit hook to format docstrings within this repo with its own formatting logic
- Full diff
- Fixed
- Bug in
_fix_rst_backticks()where backtick pairs spanning multiple lines (e.g., multi-line external links) were incorrectly processed - Added
(?!_)lookahead to regex pattern to prevent matching trailing backticks from cross-references (e.g.,`text`_)
- Bug in
- Changed
- Moved backtick fixing from line-by-line processing to whole-docstring processing to correctly handle multi-line constructs
- REPL lines (starting with
>>>or...) are now protected with placeholders during backtick fixing to preserve backticks in Python examples
- Added
- Test cases for multi-line external links in
test_fix_rst_backticks_cases() - Test cases for REPL lines with backticks in
test_fix_rst_backticks_cases()
- Test cases for multi-line external links in
- Full diff
- Fixed
- Backtick fixing logic to properly distinguish between inline literals and
external links (e.g.,
`Python <https://example.org>`_) - Refactored
_fix_rst_backticks()to use pre-compiled regex pattern for better performance
- Backtick fixing logic to properly distinguish between inline literals and
external links (e.g.,
- Full diff
- Added
- New
--fix-rst-backticksoption to automatically convert single backticks to double backticks per rST syntax
- New
- Full diff
- Added
- Support for
...(continuation of REPL lines) in the Examples section
- Support for
- Full diff
- Added
- Support for detecting misspelled section title: "Example"
- Full diff
- Fixed
- A bug in counting line length for single-line docstrings
- Full diff
- Added
- Support for 1 blank line after
::
- Support for 1 blank line after
- Full diff
- Fixed
- A bug where single-line docstrings exceeding length limit aren't handled
- Full diff
- Added
- Initial release of format-docstring
- Support for NumPy-style docstring formatting
- Limited support for Google-style docstrings
- CLI tools:
format-docstringandformat-docstring-jupyter - Configuration via
pyproject.tomlwith[tool.format_docstring]section - Options for line length, docstring style, and file exclusion patterns
- Pre-commit hooks for Python files and Jupyter notebooks
- Comprehensive test suite with pytest
- Type checking with mypy
- Support for Python 3.10-3.12
- Full diff
- N/A