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

Type hinting for the code #170

Closed
samgans opened this issue Oct 27, 2020 · 7 comments
Closed

Type hinting for the code #170

samgans opened this issue Oct 27, 2020 · 7 comments

Comments

@samgans
Copy link

samgans commented Oct 27, 2020

Hello!

I think it'll be useful to add type hints to the python code here to make it more self-documented and clearly expressed. If you think that this is a good idea, I can take the task and make this myself.

@hobu
Copy link
Member

hobu commented Oct 27, 2020

I'm enthusiastic about the type hints, but I don't know what minimum Python version that would end up causing Rtree to be limited to. Does support degrade smoothly back to Python 3.6?

@samgans
Copy link
Author

samgans commented Oct 27, 2020

@hobu, I think yes, the compatibility with older versions will be dropped upon the creation of the hinting system. Maybe if the support of older python needed, the string hints can be written (which are compatible with type checkers such as mypy).

@adamjstewart
Copy link
Collaborator

adamjstewart commented Jan 28, 2022

Type hints were first added to Python 3.5. There have been a lot of improvements since then, but if you need to maintain support for Python 3.5 or 3.6, it shouldn't be hard to do. There are ways to support older versions of Python too by adding the type hints in comments.

@hobu
Copy link
Member

hobu commented Feb 4, 2022

If someone wants to make a PR adding these, I would be happy to merge it.

This was referenced Feb 5, 2022
@adamjstewart
Copy link
Collaborator

@samgans I'm adding type hints to many (but not all) functions/classes in #215. Let me know if you want to help. I can also finish the major classes and let you handle the details in a follow-up PR if that works better.

@adamjstewart
Copy link
Collaborator

#215 has now been merged. There's definitely still a lot of functions that need type hints added to them, but the majority of user-facing functions now have type hints. @samgans feel free to add more and I'll review!

@oderby
Copy link
Contributor

oderby commented Apr 18, 2022

I'm very excited for type annotations for Rtree - thanks for all the work so far. Unfortunately I noticed that Mypy gave some warnings with the v1.0.0 Rtree. I just opened #243 as I think would fix that issue - @hobu @adamjstewart let me know what you think or if you have other thoughts on how to ensure Rtree type annotations work properly in user projects. Thanks!

@mwtoews mwtoews closed this as completed Jan 18, 2024
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

No branches or pull requests

5 participants