Skip to content

Adequate to newly introduced Ruff checks #5042

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

Merged
merged 1 commit into from
Jun 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.9
rev: v0.12.0
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand pre-commit (the tool) can be useful to some devs to install git pre-commit hooks. But considering we don't use it on the CI, we should really consider just making it run a "tox autofix" command to avoid having to duplicate versions here.

Then if we want CI autofixes, https://autofix.ci/ and https://pre-commit.ci/lite both do more or less the same job (pushes any local changes during a CI run)

At that point, .pre-commit-config.yaml would only be provided out of convenience for those who enjoy pre-commit hooks and don,t want to manually setup a hook to run said "tox autofix" command.

Ref: jaraco/skeleton#109 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, I added reported this to skeleton and added a note to the PR saying that I don't have many strong opinions about it.

hooks:
- id: ruff
args: [--fix, --unsafe-fixes]
Expand Down
1 change: 1 addition & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ ignore = [
# Suppress nuisance warnings about module-import-not-at-top-of-file (E402) due to workaround for #4476
"setuptools/__init__.py" = ["E402"]
"pkg_resources/__init__.py" = ["E402", "ANN204"]
"pkg_resources/tests/test_resources.py" = ["PT031"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Given pkg_resources is planned for removal, I'm not even gonna bother checking what this triggered on ^^


[lint.isort]
combine-as-imports = true
Expand Down
6 changes: 4 additions & 2 deletions setuptools/tests/config/test_pyprojecttoml_dynamic_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ def test_mixed_extras_require_optional_dependencies(tmp_path):
path.build(files, prefix=tmp_path)
pyproject = tmp_path / "pyproject.toml"

dist = Distribution({"extras_require": {"hello": ["world"]}})

with pytest.warns(SetuptoolsWarning, match=".extras_require. overwritten"):
dist = Distribution({"extras_require": {"hello": ["world"]}})
dist = apply_configuration(dist, pyproject)
assert dist.extras_require == {"docs": ["sphinx"]}

assert dist.extras_require == {"docs": ["sphinx"]}
2 changes: 1 addition & 1 deletion setuptools/tests/test_build_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def test_excluded_subpackages(tmpdir_cwd):
build_py = dist.get_command_obj("build_py")

msg = r"Python recognizes 'mypkg\.tests' as an importable package"
with pytest.warns(SetuptoolsDeprecationWarning, match=msg):
with pytest.warns(SetuptoolsDeprecationWarning, match=msg): # noqa: PT031
Copy link
Contributor

Choose a reason for hiding this comment

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

Given the TODO comment I find this acceptable

# TODO: To fix #3260 we need some transition period to deprecate the
# existing behavior of `include_package_data`. After the transition, we
# should remove the warning and fix the behavior.
Expand Down
Loading