Skip to content

PYTHON-6265 Opt into ruff markdown and docstring code formatting - #3239

Merged
sleepyStick merged 2 commits into
mongodb:mainfrom
sleepyStick:PYTHON-6265
Nov 19, 2026
Merged

sleepyStick merged 2 commits into
mongodb:mainfrom
sleepyStick:PYTHON-6265

Conversation

@sleepyStick

Copy link
Copy Markdown
Contributor

PYTHON-6265

Changes in this PR

Test Plan

Checklist

Checklist for Author

  • Did you update the changelog (if necessary)?
  • Is there test coverage?
  • Is any followup work tracked in a JIRA ticket? If so, add link(s).

Checklist for Reviewer

  • Does the title of the PR reference a JIRA Ticket?
  • Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
  • Is all relevant documentation (README or docstring) updated?

@sleepyStick
sleepyStick marked this pull request as ready for review November 19, 2026 15:30
@sleepyStick
sleepyStick requested a review from a team as a code owner November 19, 2026 15:30
@sleepyStick
sleepyStick requested review from blink1073 and a balanced review from Copilot November 19, 2026 15:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

Comment thread CODING-STANDARDS.md

if TYPE_CHECKING:
from pymongo.collection import Collection
from pymongo.collection import Collection

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is hilariously ironic. 😂

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nods 😂

@blink1073 blink1073 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@sleepyStick
sleepyStick merged commit 73f852c into mongodb:main Nov 19, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants