Skip to content

CHORE: Setting up ruff #1233

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

CHORE: Setting up ruff #1233

wants to merge 4 commits into from

Conversation

ecoussoux-ansys
Copy link

@ecoussoux-ansys ecoussoux-ansys commented May 20, 2025

This PR corresponds to the first step towards using ruff for linting and formatting in the pyedb project, as described in #1237.
As such, completion of this PR should not result in closing #1237.
The present changes aim at providing pyedb with a similar basic ruff configuration as the one implemented for pyaedt in ansys/pyaedt#6157, removing isort, black and flake8 at the same time.

It should be noted that ruff does not replace the following tools, whose use in the project is therefore not affected by the changes introduced here:

  • blacken-docs (used for formatting Python code blocks in documentation files): ruff does not support formatting/linting of embedded code (particularly in .rst or .md files). Similarly, blacken-docs does not support the ruff formatter as an alternative for black. This tool is therefore retained (as a pre-commit hook), despite the remaining dependency on black,
  • codespell (fixes common misspellings in source code and other files), which is not integrated into ruff,
  • numpydoc (used for formatting docstrings), which is also not integrated into ruff.

The changes in this PR are limited to the definition of a minimal configuration for ruff (in the pyproject.toml file) with only a small set of rules (namely "I"(sort) rules) applied to the code base, together with the introduction of pre-commit hooks for linting and formatting with ruff. Python files fixed by ruff are updated. Configurations for isort, black and flake8 are removed and the associated pre-commit hooks are also dropped.
The currently ignored rules (exhaustive list provided) shall be gradually applied to the project in subsequent PRs.

It is also worth mentioning that the list of rules selected until now for linting in the .flake8 file is not regarded as a reference for defining the implemented ruff configuration. Instead, this config is based on the recommendations from the pyansys-dev-guide, as introduced in ansys/pyansys-dev-guide#592.

@ecoussoux-ansys ecoussoux-ansys self-assigned this May 20, 2025
@github-actions github-actions bot added maintenance Package and maintenance related dependencies Related with project dependencies grpc-transition Changes that need to be included in gRPC transition labels May 20, 2025
@codecov-commenter
Copy link

codecov-commenter commented May 20, 2025

Codecov Report

Attention: Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.

Project coverage is 77.59%. Comparing base (6060325) to head (99be75d).

❌ Your patch status has failed because the patch coverage (42.85%) is below the target coverage (85.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1233      +/-   ##
==========================================
+ Coverage   77.58%   77.59%   +0.01%     
==========================================
  Files         163      163              
  Lines       24042    24037       -5     
==========================================
- Hits        18652    18651       -1     
+ Misses       5390     5386       -4     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added the testing Anything related to testing label May 20, 2025
@ecoussoux-ansys ecoussoux-ansys removed dependencies Related with project dependencies testing Anything related to testing grpc-transition Changes that need to be included in gRPC transition labels May 20, 2025
@ecoussoux-ansys ecoussoux-ansys marked this pull request as ready for review May 20, 2025 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Package and maintenance related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants