Skip to content

Conversation

@Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Feb 7, 2023

Related to transformers's PR (see related internal discussion)

This updates the quality tools for 2023. Mainly:

  • use black 23
  • replace isort and flake8 by ruff, which is faster and merges imports contrarily to isort
  • change default line length to 119 instead of 88
  • make the update in Makefile, pre-commit and CI

Basically: align with transformers's settings. Goal is to get a consistent coding experience for contributors.


@sgugger I listed the few changes compared to transformers config.

  • add .ruff_cache/ to .gitignore => cache folder that is generated by ruff
  • removed isort from the dependencies => I don't think it's useful anymore (at least for hfh as it's all done by ruff)
  • completely removed flake8 and isort configuration (except [tool.ruff.isort]) => same here. Haven't seen any different with or without those configs (since we removed flake8/isort from makefile)

Bonus: here is the vscode settings that I now use.

  "[python]": {
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
      "source.fixAll": true,
    },
  },
  "ruff.fixAll": true,
  "ruff.path": ["(...)/path/to/ruff"], // to complete
  "editor.rulers": [119],

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Feb 7, 2023

The documentation is not available anymore as the PR was closed or merged.

Copy link
Contributor

@sgugger sgugger 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!

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.

Great, thank you for the change @Wauplin!
LGTM

@Wauplin Wauplin merged commit b1fd1a4 into main Feb 7, 2023
@Wauplin Wauplin deleted the update-formatting-tooling branch February 7, 2023 17:45
@Wauplin
Copy link
Contributor Author

Wauplin commented Feb 7, 2023

Thanks both for the reviews and thanks @sgugger for pushing for it :)

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