Skip to content

Remove pydocstyle and configure ruff check for D rules#3384

Open
eracah wants to merge 12 commits intomosaicml:mainfrom
eracah:ruff-pydoc
Open

Remove pydocstyle and configure ruff check for D rules#3384
eracah wants to merge 12 commits intomosaicml:mainfrom
eracah:ruff-pydoc

Conversation

@eracah
Copy link
Copy Markdown
Contributor

@eracah eracah commented Jun 7, 2024

Pydocstyle is now deprecated, so we remove it and configure ruff to do what it did.

Our pydocstyle did the following:

  • used "google" style, which enforces all D rules except D203, D204, D213, D215, D400, D401, D404, D406, D407, D408, D409 and D413
  • ignores (adds to the the "google" style ignore list) D102, D105, D107, D401
  • selects (aka removes from the "google" style ignore list) D400, D404

To enable the above functionality in ruff, we:

  • select all D rules
  • ignore: D102, D105, D107, D203, D204, D213, D215, D401, D406, D407, D408, D409, D413
  • ignore 103 and 417 since those resulted in fresh errors when we disabled pydocstyle (so that means we didn't enforce them?)

Also:

  • a couple files got minor fixes with the new setup

@eracah eracah requested a review from a team as a code owner June 7, 2024 22:22
@eracah eracah requested review from Skylion007 and dakinggg June 7, 2024 22:46
Copy link
Copy Markdown
Contributor

@mvpatel2000 mvpatel2000 left a comment

Choose a reason for hiding this comment

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

LGTM

@mvpatel2000 mvpatel2000 requested a review from b-chu June 8, 2024 02:52
Comment thread pyproject.toml
Comment thread pyproject.toml
"composer/algorithms/*" = ["D"]
"composer/datasets/*" = ["D"]
"composer/models/*" = ["D"]
"composer/trainer/activation_checkpointing.py" = ["D"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can also just add a specific noqa comment at the top of the file to disable it directly in the file.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why ignore algorithms/datasets/models?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I just used the same ignoring that pydocstyle used. See the lines removed from the the pre-commit yaml

@Skylion007
Copy link
Copy Markdown
Contributor

Our ruff version is really old, we may want to consider updating it. It may include more pydocstyle autofixes in newer versions or reduce any false positives / false negatives


Args:
Args:
module (torch.nn.Module): Source module
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Weird indenting here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

is it weird?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

module is double indented after Args

Comment thread pyproject.toml
"composer/algorithms/*" = ["D"]
"composer/datasets/*" = ["D"]
"composer/models/*" = ["D"]
"composer/trainer/activation_checkpointing.py" = ["D"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why ignore algorithms/datasets/models?

Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com>
Copy link
Copy Markdown
Contributor Author

@eracah eracah left a comment

Choose a reason for hiding this comment

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

things to change to make it work with "google" style

Comment thread pyproject.toml Outdated
Comment thread pyproject.toml Outdated
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.

5 participants