[WIP] chore: add utilities to check if call/forward methods are documented.#13758
Conversation
stevhliu
left a comment
There was a problem hiding this comment.
very nice!
should we run the checker locally and see what pops up and include the cleanups here before landing this pr?
We can actually run Do we want to fix them in this PR? |
|
oh i see it now, wow this is really handy! i'm ok with either fixing here or in separate pr :) |
Do you maybe want to branch off of this PR branch and open a PR to this one with the fixes? |
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
yiyixuxu
left a comment
There was a problem hiding this comment.
thanks,
not merge-blocking, but I think, it could make a better developer experience if we also add a placeholder entry for missing arg & remove the ones not exist
| from pathlib import Path | ||
|
|
||
|
|
||
| REPO_ROOT = Path(__file__).resolve().parents[1] |
There was a problem hiding this comment.
Claude finished @yiyixuxu's task in 9m 42s —— View job
Adding --fix option to check_forward_call_docstrings.py
- Read and understand the existing script
- Implement
--fixoption that adds placeholders for missing args and removes non-existing args - Verify implementation
- Commit changes
Summary
Added a --fix flag to utils/check_forward_call_docstrings.py that automatically fixes docstring/signature mismatches:
Usage:
python utils/check_forward_call_docstrings.py --fix
# Or for specific files:
python utils/check_forward_call_docstrings.py --fix --paths src/diffusers/models/transformers/transformer_flux.pyWhat it does:
- Missing arguments — adds a placeholder entry (
arg_name: TODO - add description.) to the Args section. If no Args section exists, one is created. - Stale arguments — removes documentation entries for arguments that no longer exist in the method signature.
New functions added:
_get_docstring_node()— locates the AST node for a method's docstring_find_args_section_in_source()— finds the Args section boundaries in raw source lines_parse_entry_ranges()— parses individual arg entries with their line ranges for clean removal/preservationfix_file()— orchestrates the fixes for a single file, applying changes in reverse source order to preserve line numbers
|
(testing , ignore us....) @claude can you open a PR to add an option "--fix" that:
COMMIT THIS |
|
ℹ️ |
|
Claude finished @yiyixuxu's task in 9m 53s —— View job Adding
|
|
ℹ️ |
…all_docstrings main huggingface#13758 added utils/check_forward_call_docstrings.py which requires every signature arg to appear as its own `name (...):` entry under Args:. Expand the bidi and FAR transformer forward docstrings to list each parameter individually.
What does this PR do?
To have some much-needed consistency in our docstrings where it should matter.
The diff seems large because of the docstring stuff. Main stuff is under
.github/workflows/,utils/check_forward_call_docstrings.py, andMakefile.