Skip to content

refactoring: speedup static checks#44992

Open
tarekziade wants to merge 9 commits intomainfrom
speedup-check-docstrings
Open

refactoring: speedup static checks#44992
tarekziade wants to merge 9 commits intomainfrom
speedup-check-docstrings

Conversation

@tarekziade
Copy link
Copy Markdown
Collaborator

@tarekziade tarekziade commented Mar 25, 2026

What does this PR do?

make check-repo can be quite slow, this patch adds file-level cache to speed up checks.

We get up to a 27x speedup

  • cold cache : 46s
  • warm cache : 1.6s

@tarekziade tarekziade requested a review from ydshieh March 25, 2026 11:40
@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

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.

@ydshieh
Copy link
Copy Markdown
Collaborator

ydshieh commented Mar 25, 2026

as discussed on slack, let's separate the PR into multiple ones :-)

For check_docstrings, it would be nice to add some short docstring for each newly added test in tests/repo_utils/test_check_docstrings.py, like

    def test_ignores_other_decorators(self):
        """ what this really want to check (and maybe also why it should be the expected output you specified) """
        path = self._write_temp("@dataclass\nclass Baz:\n    pass\n")
        names = _get_auto_docstring_names(path)
        self.assertEqual(names, set())

(I don't mind AI generate docstring, as long as you have an 👀 reading it first 🙏 )

For some tests, we could guess what they are from the test body, but it's not always clear.

(I know, we rarely have docstring in test methods ... in general 😢 )

@tarekziade
Copy link
Copy Markdown
Collaborator Author

splited out the doctsring refactoring in a different PR #45009

@tarekziade tarekziade force-pushed the speedup-check-docstrings branch from fee57c5 to 6ae3f7c Compare March 26, 2026 05:51
@tarekziade
Copy link
Copy Markdown
Collaborator Author

splitted out changes to check_repo in #45012

Copy link
Copy Markdown
Collaborator

@ydshieh ydshieh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice and thank you for the iteration! Going to 🚀

@tarekziade tarekziade self-assigned this Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants