Skip to content

Commit 250c855

Browse files
committed
Using ruff for linting
1 parent 3a43dc9 commit 250c855

File tree

5 files changed

+51
-12
lines changed

5 files changed

+51
-12
lines changed

pyproject.toml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,46 @@ exclude = [
222222
"grpc_test_service_pb2.py",
223223
"grpc_test_service_pb2_grpc.py",
224224
]
225+
226+
#
227+
# Tool: Ruff (replaces Black + Flake8 + plugins)
228+
#
229+
230+
[tool.ruff]
231+
# Target Python 3.6+ (minimum supported version)
232+
target-version = "py36"
233+
234+
# Exclude files and directories (from black + flake8)
235+
extend-exclude = [
236+
"*_pb2.py", # Protocol Buffer files
237+
"*_pb2_grpc.py", # Protocol Buffer files
238+
"checkouts", # From flake8
239+
"lol*", # From flake8
240+
"grpc_test_service_pb2.py",
241+
"grpc_test_service_pb2_grpc.py",
242+
]
243+
244+
[tool.ruff.lint]
245+
# Enable flake8-bugbear (B) and pep8-naming (N) rules to match old plugins
246+
select = [
247+
"E", # pycodestyle errors
248+
"F", # Pyflakes
249+
"W", # pycodestyle warnings
250+
"B", # flake8-bugbear
251+
"N", # pep8-naming
252+
]
253+
254+
# Ignore the same rules as flake8 config
255+
ignore = [
256+
"E203", # Handled by formatter (was handled by black)
257+
"E501", # Handled by formatter (was handled by black)
258+
"E402", # Module level import not at top of file
259+
"E731", # Do not assign a lambda expression, use a def
260+
"B014", # Redundant exception types (doesn't apply to Python 2)
261+
"N812", # Lowercase imported as non-lowercase
262+
"N804", # First argument of classmethod should be named cls
263+
]
264+
265+
[tool.ruff.format]
266+
# Match black's behavior
267+
# ruff format already excludes the same files as specified in extend-exclude

requirements-linting.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
mypy
2-
black
3-
flake8==5.0.4
4-
flake8-pyproject # Flake8 plugin to support configuration in pyproject.toml
5-
flake8-bugbear # Flake8 plugin
6-
pep8-naming # Flake8 plugin
2+
ruff
73
types-certifi
84
types-protobuf
95
types-gevent

scripts/populate_tox/releases.jsonl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
{"info": {"classifiers": ["Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7"], "name": "boto3", "requires_python": "", "version": "1.12.49", "yanked": false}}
4747
{"info": {"classifiers": ["Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9"], "name": "boto3", "requires_python": ">= 3.6", "version": "1.20.54", "yanked": false}}
4848
{"info": {"classifiers": ["Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9"], "name": "boto3", "requires_python": ">= 3.7", "version": "1.28.85", "yanked": false}}
49-
{"info": {"classifiers": ["Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", "Programming Language :: Python :: 3.9"], "name": "boto3", "requires_python": ">=3.9", "version": "1.40.38", "yanked": false}}
49+
{"info": {"classifiers": ["Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", "Programming Language :: Python :: 3.9"], "name": "boto3", "requires_python": ">=3.9", "version": "1.40.39", "yanked": false}}
5050
{"info": {"classifiers": ["Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries", "Topic :: Internet :: WWW/HTTP :: HTTP Servers", "Topic :: Internet :: WWW/HTTP :: WSGI", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", "Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware", "Topic :: Internet :: WWW/HTTP :: WSGI :: Server", "Topic :: Software Development :: Libraries :: Application Frameworks"], "name": "bottle", "requires_python": "", "version": "0.12.25", "yanked": false}}
5151
{"info": {"classifiers": ["Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries", "Topic :: Internet :: WWW/HTTP :: HTTP Servers", "Topic :: Internet :: WWW/HTTP :: WSGI", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", "Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware", "Topic :: Internet :: WWW/HTTP :: WSGI :: Server", "Topic :: Software Development :: Libraries :: Application Frameworks"], "name": "bottle", "requires_python": null, "version": "0.13.4", "yanked": false}}
5252
{"info": {"classifiers": ["Development Status :: 5 - Production/Stable", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Object Brokering", "Topic :: System :: Distributed Computing"], "name": "celery", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "version": "4.4.7", "yanked": false}}

scripts/populate_tox/tox.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,6 @@ commands =
196196
197197
[testenv:linters]
198198
commands =
199-
flake8 tests sentry_sdk
200-
black --check tests sentry_sdk
199+
ruff check tests sentry_sdk
200+
ruff format --check tests sentry_sdk
201201
mypy sentry_sdk

tox.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ envlist =
9191
{py3.6,py3.7}-boto3-v1.12.49
9292
{py3.6,py3.9,py3.10}-boto3-v1.20.54
9393
{py3.7,py3.11,py3.12}-boto3-v1.28.85
94-
{py3.9,py3.12,py3.13}-boto3-v1.40.38
94+
{py3.9,py3.12,py3.13}-boto3-v1.40.39
9595

9696
{py3.6,py3.7,py3.8}-chalice-v1.16.0
9797
{py3.9,py3.12,py3.13}-chalice-v1.32.0
@@ -396,7 +396,7 @@ deps =
396396
boto3-v1.12.49: boto3==1.12.49
397397
boto3-v1.20.54: boto3==1.20.54
398398
boto3-v1.28.85: boto3==1.28.85
399-
boto3-v1.40.38: boto3==1.40.38
399+
boto3-v1.40.39: boto3==1.40.39
400400
{py3.7,py3.8}-boto3: urllib3<2.0.0
401401

402402
chalice-v1.16.0: chalice==1.16.0
@@ -823,6 +823,6 @@ commands =
823823

824824
[testenv:linters]
825825
commands =
826-
flake8 tests sentry_sdk
827-
black --check tests sentry_sdk
826+
ruff check tests sentry_sdk
827+
ruff format --check tests sentry_sdk
828828
mypy sentry_sdk

0 commit comments

Comments
 (0)