Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ruff instead of black, isort, flake8, autoflake, pyupgrade #219

Merged
merged 3 commits into from
Oct 31, 2023

Conversation

sbidoul
Copy link
Member

@sbidoul sbidoul commented Oct 28, 2023

From the docs: An extremely fast Python linter and code formatter, written in Rust..

The goal is multiple

  • better pre-commit performance
  • less dependencies
  • ruff being a static executable it will be less senstive to python upgrades
  • basic set of rules enabled by default, a copier question let PSC add additional rules if they want to

I tried to configure rules that are compatible with the current flake8 and isort config.

To test this on a repo, run

pipx run copier copy git+https://github.com/acsone/oca-addons-repo-template --vcs-ref=use-ruff --trust .

and answer yes to the "use ruff" question.

@sbidoul
Copy link
Member Author

sbidoul commented Oct 28, 2023

Here is an example of what this PR does: OCA/mis-builder#577

I would not enable this by default on existing branches but I think it's ok for 17.0.

What do people think?

@sbidoul sbidoul marked this pull request as ready for review October 28, 2023 17:00
@pedrobaeza
Copy link
Member

OK, let's go with it by default in v17.

copier.yml Outdated
@@ -126,6 +126,18 @@ generate_requirements_txt:
Generate requirements.txt from addons manifests and optional overrides in setup.py
files.

use_ruff:
default: no
Copy link
Member

Choose a reason for hiding this comment

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

Since this requires a manual template upgrade and ruff is a better default, I think we should enable it by default.

Suggested change
default: no
default: yes

Copy link
Member Author

Choose a reason for hiding this comment

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

Would that not enable ruff by default when we apply the template on existing repos?

copier.yml Show resolved Hide resolved
src/.pre-commit-config.yaml.jinja Show resolved Hide resolved
copier.yml Show resolved Hide resolved
src/.pre-commit-config.yaml.jinja Outdated Show resolved Hide resolved
src/.pre-commit-config.yaml.jinja Show resolved Hide resolved
copier.yml Outdated Show resolved Hide resolved
@sbidoul
Copy link
Member Author

sbidoul commented Oct 30, 2023

I have handled the review comments and replied to some. @yajo can you update your review?

Copy link
Member

@yajo yajo left a comment

Choose a reason for hiding this comment

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

Thanks!

copier.yml Show resolved Hide resolved
src/.pre-commit-config.yaml.jinja Show resolved Hide resolved
@yajo yajo merged commit 49b350f into OCA:master Oct 31, 2023
7 checks passed
@sbidoul sbidoul deleted the use-ruff branch October 31, 2023 08:56
celm1990 added a commit to celm1990/doodba-copier-template that referenced this pull request Nov 12, 2023
celm1990 added a commit to celm1990/doodba-copier-template that referenced this pull request Nov 12, 2023
celm1990 added a commit to celm1990/doodba-copier-template that referenced this pull request Nov 12, 2023
celm1990 added a commit to celm1990/doodba-copier-template that referenced this pull request Nov 13, 2023
…-addons-repo-template

- because into oca-addons-repo-template now use ruff and this files are delete on commit, see PR OCA/oca-addons-repo-template#219
OCA/oca-addons-repo-template@299cb36
celm1990 added a commit to celm1990/doodba-copier-template that referenced this pull request Nov 13, 2023
…-addons-repo-template

- because into oca-addons-repo-template now use ruff and this files are delete on commit, see PR OCA/oca-addons-repo-template#219
OCA/oca-addons-repo-template@299cb36
celm1990 added a commit to celm1990/doodba-copier-template that referenced this pull request Nov 13, 2023
…-addons-repo-template

- because into oca-addons-repo-template now use ruff and this files are delete on commit, see PR OCA/oca-addons-repo-template#219
OCA/oca-addons-repo-template@299cb36
celm1990 added a commit to celm1990/doodba-copier-template that referenced this pull request Nov 19, 2023
…-addons-repo-template

- because into oca-addons-repo-template now use ruff and this files are delete on commit, see PR OCA/oca-addons-repo-template#219
OCA/oca-addons-repo-template@299cb36
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.

4 participants