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

replace black, flake8, and isort with ruff #2222

Merged
merged 3 commits into from
Mar 12, 2024
Merged

replace black, flake8, and isort with ruff #2222

merged 3 commits into from
Mar 12, 2024

Conversation

natestemen
Copy link
Member

@natestemen natestemen commented Mar 7, 2024

Description

Does what it says on the 🥫.

Motivation

It's what the cool kids are using... jk

Ruff consolidates both linting (flake8) and formatting (black and isort) into a single tool which is configurable via the pyproject.toml file (flake8 refuses to support this feature, despite it becoming the defacto standard). This PR also consolidates the makefile so only one command is needed for linting/formatting checks and one command for fixing those problems (if possible).

Request from reviewer

I want to make sure that the formatting that was done is required, given the ruff configuration. As part of the review, can you

  1. Be on master
  2. Install ruff
  3. Copy the ruff config in pyproject.toml to your local machine
  4. run make format
  5. Ensure the changes are the same as what are in this PR

Copy link

codecov bot commented Mar 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.28%. Comparing base (244d52a) to head (787cab2).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2222      +/-   ##
==========================================
- Coverage   98.28%   98.28%   -0.01%     
==========================================
  Files          90       90              
  Lines        4259     4257       -2     
==========================================
- Hits         4186     4184       -2     
  Misses         73       73              

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

@natestemen natestemen requested a review from bdg221 March 8, 2024 00:41
@natestemen natestemen self-assigned this Mar 8, 2024
@natestemen natestemen requested a review from bdg221 March 11, 2024 18:36
Copy link
Collaborator

@bdg221 bdg221 left a comment

Choose a reason for hiding this comment

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

Nate, there are more arrays and tuples that are expanded into multiple lines, as well as arithmetic lines that are condensed into a single line.

Also, there is a question about running make format before, rather than after make check-format.

.github/pull_request_template.md Outdated Show resolved Hide resolved
mitiq/observable/tests/test_observable.py Outdated Show resolved Hide resolved
mitiq/observable/tests/test_observable.py Outdated Show resolved Hide resolved
mitiq/observable/tests/test_observable.py Outdated Show resolved Hide resolved
mitiq/observable/tests/test_observable.py Outdated Show resolved Hide resolved
mitiq/rem/tests/test_post_select.py Outdated Show resolved Hide resolved
mitiq/rem/tests/test_post_select.py Outdated Show resolved Hide resolved
mitiq/tests/test_utils.py Outdated Show resolved Hide resolved
mitiq/tests/test_utils.py Outdated Show resolved Hide resolved
mitiq/zne/inference.py Outdated Show resolved Hide resolved
@natestemen
Copy link
Member Author

@bdg221 Thanks for finding those additional examples of exploded lists/tuples/args. I've now split the original commit into two (one for adding ruff, and another for running it) and rerun ruff on our codebase ensuring we have the correct config. All the unnecessary changes should be gone now!

@natestemen natestemen requested a review from bdg221 March 11, 2024 21:25
Copy link
Collaborator

@bdg221 bdg221 left a comment

Choose a reason for hiding this comment

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

Looks good!

@natestemen natestemen merged commit 4c66456 into master Mar 12, 2024
18 checks passed
@natestemen natestemen deleted the nts-ruff branch March 12, 2024 15:01
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.

2 participants