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

[infra] replace pycln with ruff #1485

Merged
merged 9 commits into from
Jan 5, 2025

Conversation

kevinjqliu
Copy link
Contributor

@kevinjqliu kevinjqliu commented Jan 5, 2025

pycln has an issue in CI , also see hadialqattan/pycln#249

Since we already use ruff linter, this PR replaces pycln with ruff

Commits:

@kevinjqliu kevinjqliu marked this pull request as ready for review January 5, 2025 20:44
@kevinjqliu kevinjqliu requested a review from Fokko January 5, 2025 20:44
.pre-commit-config.yaml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated
@@ -859,6 +860,310 @@ ignore_missing_imports = true
module = "tenacity.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
Copy link
Contributor

Choose a reason for hiding this comment

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

Not important, but just out of curiosity, is there a specific reason that we are not specifying modules in an array (e.g. here)? I can see pytest.* is declared twice in the file. I assume using a more compact syntax would be helpful?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is generated automatically... im actually not sure why its here and why its needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

theres 229 entries of tool.mypy.overrides in pyproject.toml

and 6 for module = "sqlalchemy.*"

i feel like this is misconfigured

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, I think we can leave it for another working item. BTW, here is a stackoverflow I found for what this ignore_missing_imports is used for in case you are interest.

Copy link
Contributor

@Fokko Fokko left a comment

Choose a reason for hiding this comment

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

I'm all for merging different tools into a single one (and I like ruff a lot). The PR looks misleading since we're also bumping other things like mypy in the same go. I'd prefer to keep them separate in the future to make the reviews easier, but we can combine this one since you already did the work for it.

.pre-commit-config.yaml Show resolved Hide resolved
@kevinjqliu
Copy link
Contributor Author

kevinjqliu commented Jan 5, 2025

The PR looks misleading since we're also bumping other things like mypy in the same go. I'd prefer to keep them separate in the future to make the reviews easier, but we can combine this one since you already did the work for it.

agreed, pre-commit autoupdate bumped all the versions. i can remove the other version upgrades

i removed ruff from poetry dev dep since we can just use per-commit's version with make lint

hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix, --preview ]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we have the --exit-non-zero-on-fix in there for the CI

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with removing --preview: https://docs.astral.sh/ruff/preview/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added back --exit-non-zero-on-fix

@@ -58,7 +58,7 @@ select = [
"I", # isort
"UP", # pyupgrade
]
ignore = ["E501","E203","B024","B028","UP037"]
ignore = ["E501","E203","B024","B028","UP037", "UP035", "UP006"]
Copy link
Contributor

Choose a reason for hiding this comment

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

UP006 makes sense to me, we can do a follow up to fix UP035: https://docs.astral.sh/ruff/rules/deprecated-import/

Copy link
Contributor

@Fokko Fokko left a comment

Choose a reason for hiding this comment

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

Some small nits, but apart from that, this looks great! Thanks for fixing this @kevinjqliu. Let me approve this to unblock the other PRs

poetry.lock Outdated
Comment on lines 1899 to 1900
{file = "jsonpath_ng-1.7.0-py2-none-any.whl", hash = "sha256:898c93fc173f0c336784a3fa63d7434297544b7198124a68f9a3ef9597b0ae6e"},
{file = "jsonpath_ng-1.7.0-py3-none-any.whl", hash = "sha256:f3d7f9e848cba1b6da28c55b1c26ff915dc9e0b1ba7e752a53d6da8d5cbd00b6"},
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to revert these as well?

@kevinjqliu kevinjqliu merged commit 59fffe3 into apache:main Jan 5, 2025
7 checks passed
@kevinjqliu kevinjqliu deleted the kevinjqliu/pre-commit branch January 5, 2025 23:32
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