Skip to content

Repo checks: check documented methods exist#32320

Merged
gante merged 3 commits intohuggingface:mainfrom
gante:check_documented_methods
Sep 3, 2024
Merged

Repo checks: check documented methods exist#32320
gante merged 3 commits intohuggingface:mainfrom
gante:check_documented_methods

Conversation

@gante
Copy link
Contributor

@gante gante commented Jul 30, 2024

What does this PR do?

Adds a check to confirm that publicly documented methods exist. For instance, commenting out a publicly documented method like DynamicCache.to_legacy_cache triggers this check, which in essence is a reminder to be extra careful with methods tagged as documented.

In the process, also removed some old, unused logic.

@gante gante requested a review from LysandreJik July 30, 2024 10:43
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we've changed the model structure since 4 years ago, when this list was first created: transformers.models exclusively contains folders with models.

As such, we don't need to manually ignore these files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

redundant check in our current folder structure

Comment on lines 910 to 922
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't have rst doc files for quite a long time

Copy link
Contributor Author

@gante gante Jul 30, 2024

Choose a reason for hiding this comment

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

We don't have rst doc files for quite a long time

Copy link
Contributor Author

@gante gante Jul 30, 2024

Choose a reason for hiding this comment

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

nit: with the addition of spacing, we can clearly see that these prints belong to check_repo.py in make fixup, as opposed to a blob of text 🤗

Screenshot 2024-07-30 at 11 48 10

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: I intend to use this new mapping in check_docstrings, to perform basic quality checks on the docstring of publicly documented methods

@gante gante force-pushed the check_documented_methods branch from 252a056 to cd2e601 Compare July 30, 2024 11:02
@gante
Copy link
Contributor Author

gante commented Jul 30, 2024

arf, this is getting docker image issues due to imports

@gante gante closed this Jul 30, 2024
@HuggingFaceDocBuilderDev

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.

@gante gante reopened this Aug 2, 2024
@gante gante force-pushed the check_documented_methods branch 2 times, most recently from 9230164 to 69ef594 Compare August 7, 2024 15:36
@gante gante force-pushed the check_documented_methods branch 2 times, most recently from a72b443 to 2846753 Compare August 22, 2024 10:22
@LysandreJik
Copy link
Member

Cool tool @gante! LMK when you want me to take a look!

@gante gante force-pushed the check_documented_methods branch from 2846753 to eba80cf Compare September 2, 2024 09:15
@gante
Copy link
Contributor Author

gante commented Sep 2, 2024

@LysandreJik the PR is now ready 🙌 (it was failing before because the check repository CI image didn't have all needed dependencies to check methods in objects)

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

Nice, clean! And love the indentation, I agree it makes everything cleaner.

Thanks for the comments, helped understanding how the code work.

@gante gante merged commit d6534f9 into huggingface:main Sep 3, 2024
@gante gante deleted the check_documented_methods branch September 3, 2024 16:40
BernardZach pushed a commit to BernardZach/transformers that referenced this pull request Dec 5, 2024
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