Skip to content

PYTHON-6227 Enable ruff rule UP035 to remove deprecated import aliases - #3182

Merged
NoahStapp merged 1 commit into
mongodb:mainfrom
NoahStapp:PYTHON-6227
Nov 6, 2026
Merged

NoahStapp merged 1 commit into
mongodb:mainfrom
NoahStapp:PYTHON-6227

Conversation

@NoahStapp

Copy link
Copy Markdown
Contributor

PYTHON-6227

Changes in this PR

Remove suppression of ruff's UP035 rule.

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?

@NoahStapp
NoahStapp requested a review from a team as a code owner November 6, 2026 15:35
@NoahStapp
NoahStapp requested review from sleepyStick and a balanced review from Copilot November 6, 2026 15:35

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 remain for the deprecated typing-import cleanup and Ruff rule update.

No open issues 🎉

What changed in this PR

This PR enables Ruff’s UP035 rule and modernizes deprecated typing imports across PyMongo, BSON, and the test suite.

Changes:

  • Removes UP035 from Ruff’s ignored rules.
  • Replaces typing.Callable with collections.abc.Callable, including generated synchronous counterparts.
  • Changes the typing test’s NotRequired import to use typing.
File Description
test/​test_typing.py Updates Callable and NotRequired imports.
test/​test_session.py Updates the generated session test’s Callable import.
test/​asynchronous/​test_session.py Modernizes the session test’s Callable import.
test/​asynchronous/​__init__.py Modernizes test infrastructure’s Callable import.
test/​__init__.py Updates the synchronous test infrastructure’s import.
pyproject.toml Enables Ruff’s deprecated-import rule.
pymongo/​topology_shared.py Modernizes the shared topology’s Callable import.
pymongo/​topology_description.py Modernizes the topology description’s Callable import.
pymongo/​synchronous/​uri_parser.py Updates the generated URI parser’s import.
pymongo/​synchronous/​topology.py Updates the generated topology’s import.
pymongo/​synchronous/​srv_resolver.py Updates the generated SRV resolver’s import.
pymongo/​synchronous/​settings.py Updates the generated settings’ import.
pymongo/​synchronous/​mongo_client.py Updates the generated client’s import.
pymongo/​synchronous/​helpers.py Updates generated helpers’ import.
pymongo/​synchronous/​command_runner.py Updates the generated command runner’s import.
pymongo/​synchronous/​collection.py Updates the generated collection’s import.
pymongo/​synchronous/​client_session.py Updates the generated client session’s import.
pymongo/​synchronous/​auth.py Updates generated authentication’s import.
pymongo/​settings_shared.py Modernizes shared settings’ Callable import.
pymongo/​pyopenssl_context.py Modernizes the TLS context’s Callable import.
pymongo/​network_layer.py Modernizes the network layer’s Callable import.
pymongo/​mongo_client_shared.py Modernizes shared client code’s Callable import.
pymongo/​message.py Modernizes message handling’s Callable import.
pymongo/​encryption_options.py Modernizes encryption options’ Callable import.
pymongo/​common.py Modernizes common utilities’ Callable import.
pymongo/​client_session_shared.py Modernizes shared session code’s Callable import.
pymongo/​auth_shared.py Modernizes shared authentication’s Callable import.
pymongo/​auth_oidc_shared.py Modernizes OIDC authentication’s Callable import.
pymongo/​asynchronous/​uri_parser.py Modernizes the URI parser’s Callable import.
pymongo/​asynchronous/​topology.py Modernizes the topology’s Callable import.
pymongo/​asynchronous/​srv_resolver.py Modernizes the SRV resolver’s Callable import.
pymongo/​asynchronous/​settings.py Modernizes settings’ Callable import.
pymongo/​asynchronous/​mongo_client.py Modernizes the client’s Callable import.
pymongo/​asynchronous/​helpers.py Modernizes helpers’ Callable import.
pymongo/​asynchronous/​command_runner.py Modernizes the command runner’s Callable import.
pymongo/​asynchronous/​collection.py Modernizes the collection’s Callable import.
pymongo/​asynchronous/​client_session.py Modernizes the client session’s Callable import.
pymongo/​asynchronous/​auth.py Modernizes authentication’s Callable import.
pymongo/​_kms_connect_shared.py Modernizes KMS connection code’s Callable import.
pymongo/​_csot.py Modernizes timeout utilities’ Callable import.
bson/​json_util.py Modernizes JSON utilities’ Callable import.
bson/​codec_options.py Modernizes codec options’ Callable import.
bson/​__init__.py Modernizes BSON’s Callable import.

Review effort: Balanced

@NoahStapp
NoahStapp merged commit 269a552 into mongodb:main Nov 6, 2026
79 of 81 checks passed
@NoahStapp NoahStapp mentioned this pull request Nov 6, 2026
6 tasks
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