Skip to content
Open
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
8 changes: 5 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ repos:
hooks:
- id: pyupgrade
args: [--py37-plus]
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.4
hooks:
- id: flake8
- id: ruff
args: [--fix]
- id: ruff-format
35 changes: 35 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,41 @@ profile = "black"
src_paths = ["src/requests", "test"]
honor_noqa = true

[tool.ruff]
# Match black's line length
line-length = 88

# Target Python 3.9+ (project minimum version)
target-version = "py39"

# Enable flake8 equivalent rule sets
select = ["E", "W", "F"]

# Ignore rules to match existing flake8 configuration:
# E203: whitespace before ':'
# E501: line too long (black handles this)
# W503: line break before binary operator
ignore = ["E203", "E501", "W503"]

# Exclude patterns
exclude = [
".git",
".ruff_cache",
".venv",
"__pycache__",
"*.pyc",
"build",
"dist",
"docs",
"ext",
]

# Per-file ignores migrated from setup.cfg [flake8]
[tool.ruff.per-file-ignores]
"src/requests/__init__.py" = ["E402", "F401"]
"src/requests/compat.py" = ["E402", "F401"]
"tests/compat.py" = ["F401"]

[tool.pytest.ini_options]
addopts = "--doctest-modules"
doctest_optionflags = "NORMALIZE_WHITESPACE ELLIPSIS"
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ pytest-httpbin==2.1.0
httpbin~=0.10.0
trustme
wheel
ruff>=0.1.0
7 changes: 0 additions & 7 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,3 @@ requires-dist =
charset_normalizer>=2,<4
idna>=2.5,<4
urllib3>=1.21.1,<3

[flake8]
ignore = E203, E501, W503
per-file-ignores =
src/requests/__init__.py:E402, F401
src/requests/compat.py:E402, F401
tests/compat.py:F401
Loading