Repository navigation
PYTHON-6261 Opt into ruff D rules for whitespace and escapes - #3213
Merged
Merged
Conversation
NoahStapp
requested review from
sleepyStick
and
a balanced review from Copilot
November 11, 2026 20:58
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain to be resolved.
No open issues 🎉
What changed in this PR
This PR standardizes docstrings across PyMongo, BSON, GridFS, and supporting tests by enabling additional Ruff checks. Changes are limited to lint configuration, docstrings, and whitespace; executable logic is unchanged.
Changes:
- Enable Ruff rules D202, D209, D301, and D403 with the PEP 257 convention.
- Normalize docstring spacing, closing quotes, and capitalization.
- Use raw docstrings for escape sequences and correct a Sphinx version directive.
| File | Description |
|---|---|
test/test_ssl.py |
Remove blank line after a test docstring. |
test/test_raw_bson_shared.py |
Place closing docstring quotes on their own line. |
test/test_monitor.py |
Normalize multiline docstring closing quotes. |
test/test_index_management.py |
Remove blank lines after test docstrings. |
test/test_bson.py |
Remove blank line after a test docstring. |
test/test_bson_binary_vector.py |
Normalize class docstring closing quotes. |
test/asynchronous/test_ssl.py |
Remove blank line after a test docstring. |
test/asynchronous/test_monitor.py |
Normalize multiline docstring closing quotes. |
test/asynchronous/test_index_management.py |
Remove blank lines after test docstrings. |
pyproject.toml |
Enable four docstring rules and the PEP 257 convention. |
pymongo/topology_description.py |
Rewrite docstring summary with initial capitalization. |
pymongo/synchronous/mongo_client.py |
Remove blank lines after method docstrings. |
pymongo/synchronous/database.py |
Use a raw docstring for the regex example. |
pymongo/pool_options.py |
Normalize multiline docstring closing quotes. |
pymongo/asynchronous/mongo_client.py |
Remove blank lines after method docstrings. |
pymongo/asynchronous/database.py |
Use a raw docstring for the regex example. |
pymongo/_asyncio_lock.py |
Normalize module docstring closing quotes. |
gridfs/synchronous/grid_file.py |
Use a raw docstring for the newline example. |
gridfs/grid_file_shared.py |
Remove blank line after a helper docstring. |
gridfs/asynchronous/grid_file.py |
Use a raw docstring for the newline example. |
fuzz/build_corpus.py |
Normalize multiline docstring closing quotes. |
bson/json_util.py |
Make the module docstring raw. |
bson/errors.py |
Correct Sphinx directive syntax and closing quotes. |
bson/codec_options.py |
Use a raw docstring and simplify example escapes. |
bson/binary.py |
Remove blank line after a method docstring. |
bson/__init__.py |
Use a raw docstring and remove extra spacing. |
.evergreen/scripts/test_generate_config.py |
Normalize multiline test docstring closing quotes. |
Review effort: Balanced
sleepyStick
previously approved these changes
Nov 11, 2026
sleepyStick
approved these changes
Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PYTHON-6261
Changes in this PR
Opt into the ruff
Drules D202, D209, D301, and D403 and make the required docstring changes to pass them.Test Plan
Checklist
Checklist for Author
Checklist for Reviewer