Skip to content
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

Remove unintentional GeoDjango re-exports #1308

Merged

Conversation

intgr
Copy link
Collaborator

@intgr intgr commented Jan 5, 2023

Follow-up from discussion on #1299.

Stub files with from ... import SomeSymbol as SomeSymbol are explicit re-exports (https://typing.readthedocs.io/en/latest/source/stubs.html#imports)

Django does employ intentional re-exports to make imports shorter and more convenient (usually in __init__.py files). But many of these re-exports were under longer module paths. And these unintentional re-exports are likely to be less stable over Django releases. E.g.

# Instead of:
from django.contrib.gis.geos.geometry import hex_regex
from django.contrib.gis.sitemaps.kml import Sitemap
# Use:
from django.contrib.gis.geometry import hex_regex
from django.contrib.sitemaps import Sitemap

Now mypy will warn users when using these re-exports.

@intgr
Copy link
Collaborator Author

intgr commented Jan 5, 2023

@ciscorn would be great if you could take a look at this PR.

@ciscorn
Copy link
Contributor

ciscorn commented Jan 5, 2023

@intgr Looks good to me. We shouldn't rely on these re-exports.

@intgr intgr added the help wanted Extra attention is needed label Feb 7, 2023
Copy link
Contributor

@christianbundy christianbundy left a comment

Choose a reason for hiding this comment

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

this is great, thank you!

@intgr intgr merged commit 6ea1eaf into typeddjango:master Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Development

Successfully merging this pull request may close these issues.

3 participants