-
Notifications
You must be signed in to change notification settings - Fork 557
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
DOC:Add proper type annotations and consolidate documentation into top level functions #1687
base: main
Are you sure you want to change the base?
Conversation
84b7b33
to
a0374ae
Compare
array like
+ usage examples17e9cb3
to
3451bf6
Compare
@jorisvandenbossche any comments on this PR please? |
Thank you for your work on this @idanmiara and apologies for the slow review of PRs. Your effort toward improving Shapely is appreciated! Adding type annotations is a big addition that needs to be weighed carefully and needs buy-in from several of the Shapely maintainers, because this adds to the overall maintenance burden of the project as well as potentially making it harder for new contributors, especially for those of us that don't use them on a regular basis. This is big enough that it probably warrants taking it up first as a discussion in order to get buy-in, rather than via PR review here. Even without a close review of the changes here, I think this needs to be split up a bit differently into smaller, more focused PRs. Specifically, documentation changes that are unrelated to type annotations should be addressed in a separate PR; those should theoretically be easier to review / merge. I'd recommend focusing on the documentation changes first; I'm hoping those are easy to copy / paste out of here. Apologies that this involves extra work for you. In general, small & focused PRs are more manageable to review given limited resources; big & complex PRs are very challenging to review and often take more time to review than folks have available - which means that they don't get reviewed at all for long periods of time. I can't speak for other Shapely contributors here, but my experience has been that if I can't review a PR within a narrow window of time that I have available, I often can't get to it at all in a reasonable amount of time - which is surely frustrating to folks that are actively trying to make the project better like yourself. |
Hi @brendan-ward, In this PR I've added type annotation to practically all of shapely functions. |
… and examples and add some more details from `libgeos` and postgis docs
Pull Request Test Coverage Report for Build 4026491040
💛 - Coveralls |
As @brendan-ward mentioned, I think it would be good to first have some discussion about type annotations in an issue, to see how the other maintainers think about it (I personally also have reservations, but won't object). And also if we are adding type annotation, I would highly recommend starting with annotating a small part so that it is easier to review (I expect that the first PRs will generate quite some back and forth about the exact form of the type annotations that we want, and once that is somewhat agreed upon, subsequent PRs expanding the coverage should go much smoother). |
FWIW I personally also prefer that we keep annotation syntax just for annotations, and not start using it in docstrings (IMO a docstring with semi-fluent text like "Geometry or array-like of geometries" reads much easier and is more understandable than "MaybeGeometryArrayNLike") |
@jorisvandenbossche thanks for this pointer! |
I think annotations and documentation changes are completely orthogonal? (assuming we don't use annotation-like syntax in the docs)
I would start with a single file, and base.py might be the easiest to start with (and also the one with potentially most value) |
Sure, no problem.
Agree, but there would be many conflicts to solve if we handle both issues concurrently (editing sections close to each other). How would you advise to split the consolidation PR?
@jorisvandenbossche - What do you think? Although this PR is not directly related to #1682, the edits are also close to each other and also the doctests consolidation work is effected by #1711, so it would make my work much easier if we could solve that issue first, so if you are thinking we could close that one soon then I'll wait for it. Thanks! |
@idanmiara I don't understand why you take on very big new efforts in this project instead of working on the many smaller issues? We have 100+ open issues in this project. |
Hi @sgillies,
Many times I take smaller existing issues and contribute for the following reasons:
So to summarize - for me - this issue is one of the most important one to solve (right after solving regressions), and worths my time spending on solving it. |
This is fantastic work imo. |
Discussion: #721
This PR will be broken down into multiple pieces, first piece is #1741
Closes #1683
Closes #1688
Related to #1673
Related to #1316
This PR is adding proper type annotations for almost all of shapely functions (including the vectorized functions).
And consolidating documentation into top level functions for all relevant functions and replacing duplicated documentation in reference to the relevant functions.
I think this is a very big step in direction of better documentation of Shapely 2.
This is a huge PR, and I could break it down to pieces if required 😵💫 upon initial review of the general ideas and as per your suggestions and comments.
@jorisvandenbossche @caspervdw
I'd really appreciate your review.