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

Improve GeoDjango type-hints #1299

Merged
merged 7 commits into from
Jan 4, 2023
Merged

Improve GeoDjango type-hints #1299

merged 7 commits into from
Jan 4, 2023

Conversation

ciscorn
Copy link
Contributor

@ciscorn ciscorn commented Dec 25, 2022

I have made things!

  • Provide more specific type-hints for GeoDjango modules.
  • Fixed some missing exports in contrib/gis/**/__init__.py
  • Removed unintentional re-exports in many modules.

Related issues

No

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Oh wow! Thanks a lot! This is amazing!

But, I literally have 0 experience with gis.
Maybe @intgr or @adamchainz have more knowledge?

@intgr
Copy link
Collaborator

intgr commented Dec 25, 2022

Nope, I have no experience with Django GIS.

Copy link
Collaborator

@intgr intgr left a comment

Choose a reason for hiding this comment

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

Looks good on a cursory read. As noted above, the TypedDjango team doesn't use GeoDjango. I'm inclined to just merge this as is, it's filling out types that used to be just Any.

Changes like this are rarely perfect and we shouldn't expect them to be. If it causes regressions for users, they will be reported and can be improved.

@intgr
Copy link
Collaborator

intgr commented Jan 4, 2023

There was some overlap between this PR and #1265 (which just got merged to master).

I have pushed a merge with the latest master.

Copy link
Collaborator

@intgr intgr left a comment

Choose a reason for hiding this comment

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

After looking into this some more, there are lots of re-exports that look like they shouldn't be re-exports.

Usually Django only has re-exports in __init__.py files. Also items in explicit module __all__ = [...] should be re-exported. The remaining typically should not be.

django-stubs/contrib/gis/gdal/datasource.pyi Outdated Show resolved Hide resolved
django-stubs/contrib/gis/gdal/feature.pyi Outdated Show resolved Hide resolved
django-stubs/contrib/gis/gdal/geometries.pyi Outdated Show resolved Hide resolved
@intgr
Copy link
Collaborator

intgr commented Jan 4, 2023

PS: I don't expect you to fix all the pre-existing incorrect re-exports. Just fix the new ones you have added in this PR.

Copy link
Collaborator

@intgr intgr left a comment

Choose a reason for hiding this comment

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

Thanks! Waiting for the CI to finish.

@intgr
Copy link
Collaborator

intgr commented Jan 4, 2023

Maybe @mjakob can try this out and share some feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants