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 flake8, isort, black and pyupgrade #202

Merged
merged 5 commits into from
Feb 7, 2024
Merged

Conversation

danielhollas
Copy link
Contributor

aiida-core recently switched to ruff, and I've been using it for my app for some time. IMO we should consider slowly switching AiiDAlab repos as well. @unkcpz @yakutovicha LMK what you think.

I've enabled a couple more rules than there were before, based on my judgment and previous experience. More might be useful, but this is a reasonable start IMO.

I've also removed a couple of hooks that did not seem as useful, now that the codebase and its configuration is quite stable. But I am happy to revert.

.pre-commit-config.yaml Show resolved Hide resolved
.pre-commit-config.yaml Show resolved Hide resolved
.pre-commit-config.yaml Show resolved Hide resolved
.pre-commit-config.yaml Show resolved Hide resolved
Copy link

codecov bot commented Feb 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3d7c9d2) 85.86% compared to head (23197e3) 86.07%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #202      +/-   ##
==========================================
+ Coverage   85.86%   86.07%   +0.20%     
==========================================
  Files           9        9              
  Lines         920      919       -1     
==========================================
+ Hits          790      791       +1     
+ Misses        130      128       -2     
Flag Coverage Δ
py-3.10 85.74% <100.00%> (-0.02%) ⬇️
py-3.11 85.74% <100.00%> (-0.02%) ⬇️
py-3.12 85.96% <100.00%> (+0.20%) ⬆️
py-3.8 85.69% <100.00%> (-0.02%) ⬇️
py-3.9 85.80% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

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

Looks all good! Thanks @danielhollas

Copy link
Member

@yakutovicha yakutovicha left a comment

Choose a reason for hiding this comment

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

Thanks @danielhollas.

I have a few concerns related to the removal of additional hooks that are not related to ruff.

.pre-commit-config.yaml Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
.pre-commit-config.yaml Show resolved Hide resolved
@danielhollas
Copy link
Contributor Author

Huh, interestingly, when I added back the check-manifest file, it started failing in pre-commit bot with

['/pc/clone/LLopfktuRsCG39y1Br0Ylw/py_env-python3/bin/python', '-m', 'build', '--sdist', '.', '--outdir', '/tmp/check-manifest-64gqzu8s-sdist'] failed (status 1):
* Creating venv isolated environment...
ERROR Failed to create venv. Maybe try installing virtualenv.
  Command '/tmp/build-env-iai5zihp/bin/python3.11 -m ensurepip --upgrade --default-pip' failed with return code 1
  stdout:
    /tmp/build-env-iai5zihp/bin/python3.11: No module named ensurepip

It doesn't seem like an actual issue, just some missing dependencies. For now I've removed the build-related setup from pyproject.toml which seems to solve this. Let's deal with it in a follow-up PR.

Copy link
Member

@yakutovicha yakutovicha left a comment

Choose a reason for hiding this comment

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

LGTM

@danielhollas danielhollas merged commit 3d2cfb1 into main Feb 7, 2024
17 checks passed
@danielhollas danielhollas deleted the ruff branch February 7, 2024 15:54
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