Skip to content

Commit

Permalink
chore: move to ruff-format
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Oct 26, 2023
1 parent 1efccd0 commit 48df44d
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 57 deletions.
6 changes: 1 addition & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,12 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.10.1
hooks:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.2
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format

- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.5.0
Expand Down
6 changes: 2 additions & 4 deletions bin/update_pythons.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,8 @@ def update_version_macos(
unsorted_versions = spec.filter(self.versions_dict)
sorted_versions = sorted(unsorted_versions, reverse=True)

if version <= Version("3.8.9999"):
file_ident = "macosx10.9.pkg"
else:
file_ident = "macos11.pkg"
macver = "10.9" if version <= Version("3.8.9999") else "11"
file_ident = f"macosx{macver}.pkg"

for new_version in sorted_versions:
# Find the first patch version that contains the requested file
Expand Down
5 changes: 1 addition & 4 deletions cibuildwheel/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,10 +619,7 @@ def virtualenv(
python,
venv_path,
)
if IS_WIN:
paths = [str(venv_path), str(venv_path / "Scripts")]
else:
paths = [str(venv_path / "bin")]
paths = [str(venv_path), str(venv_path / "Scripts")] if IS_WIN else [str(venv_path / "bin")]
env = os.environ.copy()
env["PATH"] = os.pathsep.join([*paths, env["PATH"]])
return env
Expand Down
8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ requires = [
build-backend = "setuptools.build_meta"


[tool.black]
line-length = 100
target-version = ['py38', 'py39', 'py310', 'py311']


[tool.pytest.ini_options]
minversion = "6.0"
addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"]
Expand Down Expand Up @@ -116,6 +111,8 @@ messages_control.disable = [

[tool.ruff]
target-version = "py38"
line-length = 100


[tool.ruff.lint]
extend-select = [
Expand Down Expand Up @@ -147,6 +144,7 @@ ignore = [
"PT004", # Rename suggested for returnless fixtures
"PT007", # False positive
"PYI025", # Set as AbstractSet
"ISC001", # Conflicts with formatter (in 0.1.2)
]
typing-modules = ["cibuildwheel._compat.typing"]
flake8-unused-arguments.ignore-variadic-names = true
Expand Down
4 changes: 1 addition & 3 deletions test/test_before_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
from . import test_projects, utils

before_test_project = test_projects.new_c_project()
before_test_project.files[
"test/spam_test.py"
] = r"""
before_test_project.files["test/spam_test.py"] = r"""
import sys
import os
from unittest import TestCase
Expand Down
4 changes: 1 addition & 3 deletions test/test_cpp_standards.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ def test_cpp14(tmp_path):
cpp17_project.template_context["extra_compile_args"] = [
"/std:c++17" if utils.platform == "windows" else "-std=c++17"
]
cpp17_project.template_context[
"spam_cpp_top_level_add"
] = r"""
cpp17_project.template_context["spam_cpp_top_level_add"] = r"""
#include <utility>
auto a = std::pair(5.0, false);
"""
Expand Down
4 changes: 1 addition & 3 deletions test/test_dependency_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ def test_dependency_constraints_file(tmp_path, build_frontend_env):
wheel=={wheel}
virtualenv=={virtualenv}
importlib-metadata<3,>=0.12; python_version < "3.8"
""".format(
**tool_versions
)
""".format(**tool_versions)
)
)

Expand Down
4 changes: 1 addition & 3 deletions test/test_emulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

project_with_a_test = test_projects.new_c_project()

project_with_a_test.files[
"test/spam_test.py"
] = r"""
project_with_a_test.files["test/spam_test.py"] = r"""
import spam
def test_spam():
Expand Down
4 changes: 1 addition & 3 deletions test/test_pep518.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
)
)

basic_project.files[
"pyproject.toml"
] = """
basic_project.files["pyproject.toml"] = """
[build-system]
requires = [
"setuptools >= 42",
Expand Down
8 changes: 2 additions & 6 deletions test/test_pure_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
from . import utils

pure_python_project = test_projects.TestProject()
pure_python_project.files[
"setup.py"
] = """
pure_python_project.files["setup.py"] = """
from setuptools import Extension, setup
setup(
Expand All @@ -20,9 +18,7 @@
)
"""

pure_python_project.files[
"spam.py"
] = """
pure_python_project.files["spam.py"] = """
def a_function():
pass
"""
Expand Down
4 changes: 1 addition & 3 deletions test/test_same_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
from . import utils

basic_project = test_projects.new_c_project()
basic_project.files[
"repair.py"
] = """
basic_project.files["repair.py"] = """
import shutil
import sys
from pathlib import Path
Expand Down
12 changes: 3 additions & 9 deletions test/test_subdir_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
subdir_package_project.template_context["spam_c_top_level_add"] = ""
subdir_package_project.template_context["spam_c_function_add"] = ""

subdir_package_project.files[
"src/spam/setup.py"
] = r"""
subdir_package_project.files["src/spam/setup.py"] = r"""
from setuptools import Extension, setup
setup(
Expand All @@ -26,15 +24,11 @@
)
"""

subdir_package_project.files[
"src/spam/test/run_tests.py"
] = r"""
subdir_package_project.files["src/spam/test/run_tests.py"] = r"""
print('run_tests.py executed!')
"""

subdir_package_project.files[
"bin/before_build.py"
] = r"""
subdir_package_project.files["bin/before_build.py"] = r"""
print('before_build.py executed!')
"""

Expand Down
8 changes: 2 additions & 6 deletions test/test_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
)
)

project_with_a_test.files[
"test/spam_test.py"
] = r'''
project_with_a_test.files["test/spam_test.py"] = r'''
import os
import platform
import sys
Expand Down Expand Up @@ -115,9 +113,7 @@ def test_extras_require(tmp_path):


project_with_a_failing_test = test_projects.new_c_project()
project_with_a_failing_test.files[
"test/spam_test.py"
] = r"""
project_with_a_failing_test.files["test/spam_test.py"] = r"""
from unittest import TestCase
class TestSpam(TestCase):
Expand Down

0 comments on commit 48df44d

Please sign in to comment.