Skip to content
New issue

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

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

Already on GitHub? # to your account

ci: ruff format, isort, and lint #409

Merged
merged 14 commits into from
Nov 30, 2024

Conversation

kiyoon
Copy link
Collaborator

@kiyoon kiyoon commented Nov 26, 2024

Instead of black/flake8/pylint, use ruff format, isort and lint as mentioned briefly in #406.

Changes:

  1. precommit.sh to use ruff
  2. github actions CI to check if ruff format and isort are applied. If not, show the diff in the summary.
  3. ruff check --config ruff_essential.toml . to check essential syntax errors. (E9, F63, F7, F82)
  4. Some settings in pyproject.toml, setup.cfg, ...
    a. move pytest config from pytest.ini to pyproject.toml
    b. move coverage config from setup.cfg to pyproject.toml
    c. use ruff format line-length of 79
    d. ruff lint rules
    e. pyright/basedpyright config (standard settings) to develop with a type checker

Build:

  1. Correctly set python_requires (3.5 -> 3.8)
  2. CI uses uv pip to install packages instead of pip for improved speed

Advantages:

  • fast
  • less dependencies (only one package compared to black, isort, flake8, pylint and extra dependencies they have)
  • generally easier to config (sane defaults and good documentation in one place)

@kiyoon kiyoon force-pushed the ci/ruff-format branch 4 times, most recently from 16ef45d to b809792 Compare November 26, 2024 02:49
@kiyoon kiyoon changed the title ci: check ruff format and isort ci: check ruff format, isort, and lint Nov 26, 2024
@kiyoon
Copy link
Collaborator Author

kiyoon commented Nov 26, 2024

Applying ruff format and isort will change many files. Once you approve this PR, I will apply them all so it's easier to see what has actually changed!

So please don't merge just yet.

EDIT: The PR includes ruff format and isort now.

@kiyoon kiyoon changed the title ci: check ruff format, isort, and lint ci: ruff format, isort, and lint Nov 26, 2024
@kiyoon
Copy link
Collaborator Author

kiyoon commented Nov 28, 2024

by the way, I plan to add more type information in the next PR.

If you mind having annotations import, we can remove the lint rule

@sobolevnrm
Copy link
Member

by the way, I plan to add more type information in the next PR.

If you mind having annotations import, we can remove the lint rule

Yes, I do not want to import unused modules. Thank you!

@kiyoon
Copy link
Collaborator Author

kiyoon commented Nov 29, 2024

I removed from __future__ import annotations and uv. Anything else?

@sobolevnrm
Copy link
Member

Thank you for all of your work on this!

@sobolevnrm sobolevnrm merged commit be4e943 into Electrostatics:master Nov 30, 2024
4 checks passed
@kiyoon
Copy link
Collaborator Author

kiyoon commented Nov 30, 2024

Thanks for reviewing! And I've rebased the #410 so it should be ready now as well :)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants