Skip to content

PYTHON-5314 Fix default imports #2300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ShaneHarvey
Copy link
Member

@ShaneHarvey ShaneHarvey commented Apr 21, 2025

PYTHON-5314 Fix default imports

Oddly, ruff complained about the existing code

# Public module compatibility imports
import pymongo.uri_parser  # noqa: F401 # isort: skip
import pymongo.change_stream  # noqa: F401 # isort: skip
...

precommit fails:

ruff.....................................................................Failed
- hook id: ruff
- exit code: 1
pymongo/__init__.py:110:28: RUF100 Unused `noqa` directive (unused: `F401`)
...
pymongo/__init__.py:116:26: RUF100 Unused `noqa` directive (unused: `F401`)
(edited)
4 replies

But if I remove the noqa comment, ruff will delete the imports because it thinks they're unused...

The only way I found to avoid this was to change the imports to from pymongo import uri_parser.

@ShaneHarvey ShaneHarvey marked this pull request as ready for review April 21, 2025 19:36
@ShaneHarvey ShaneHarvey requested a review from NoahStapp April 21, 2025 19:36
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.

1 participant