Repository navigation
PYTHON-6265 Opt into ruff markdown and docstring code formatting - #3239
Merged
Merged
Conversation
sleepyStick
marked this pull request as ready for review
November 19, 2026 15:30
sleepyStick
requested review from
blink1073
and
a balanced review from Copilot
November 19, 2026 15:30
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the Ruff formatting and documentation updates.
No open issues 🎉
What changed in this PR
This PR extends PyMongo’s Ruff formatting workflow to Markdown and code examples within Python docstrings. The remaining changes apply that formatting across documentation and generated synchronous counterparts, without changing runtime logic.
Changes:
- Includes Markdown files in the Ruff pre-commit formatting hook.
- Enables docstring code formatting in Ruff.
- Normalizes example spacing, quoting, line wrapping, and console prompts.
| File | Description |
|---|---|
test/utils_shared.py |
Adjusts spacing in a docstring example. |
README.md |
Removes empty continuation prompts from examples. |
pyproject.toml |
Enables Ruff docstring code formatting. |
pymongo/synchronous/mongo_client.py |
Updates generated client documentation examples. |
pymongo/synchronous/encryption.py |
Updates the generated TLS configuration example. |
pymongo/synchronous/database.py |
Updates generated database documentation examples. |
pymongo/synchronous/collection.py |
Updates generated collection documentation examples. |
pymongo/synchronous/client_session.py |
Updates the generated transaction callback example. |
pymongo/synchronous/change_stream.py |
Updates generated change-stream examples. |
pymongo/read_preferences.py |
Normalizes spacing in tag-set examples. |
pymongo/monitoring.py |
Reformats listener and logging examples. |
pymongo/encryption_options.py |
Formats encryption configuration examples. |
pymongo/cursor_shared.py |
Formats sorting and query examples. |
pymongo/asynchronous/mongo_client.py |
Formats client configuration and bulk-write examples. |
pymongo/asynchronous/encryption.py |
Formats the TLS configuration example. |
pymongo/asynchronous/database.py |
Formats database and encryption examples. |
pymongo/asynchronous/collection.py |
Formats collection operation examples. |
pymongo/asynchronous/client_session.py |
Reformats the transaction callback example. |
pymongo/asynchronous/change_stream.py |
Formats change-stream recovery examples. |
pymongo/__init__.py |
Adjusts inline-comment spacing in timeout documentation. |
gridfs/synchronous/grid_file.py |
Updates generated GridFS documentation examples. |
gridfs/asynchronous/grid_file.py |
Formats GridFS documentation examples. |
CODING-STANDARDS.md |
Replaces tab indentation in a Python example. |
bson/raw_bson.py |
Removes an empty continuation prompt. |
bson/decimal128.py |
Normalizes quoting in an encoding example. |
.pre-commit-config.yaml |
Adds Markdown to the Ruff formatter hook. |
Review effort: Balanced
blink1073
reviewed
Nov 19, 2026
|
|
||
| if TYPE_CHECKING: | ||
| from pymongo.collection import Collection | ||
| from pymongo.collection import Collection |
Member
There was a problem hiding this comment.
This change is hilariously ironic. 😂
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-6265
Changes in this PR
Test Plan
Checklist
Checklist for Author
Checklist for Reviewer