pylops icon indicating copy to clipboard operation
pylops copied to clipboard

Add typing annotations

Open cako opened this issue 3 years ago • 4 comments

Typing annotations are quickly becoming ubiquitous in Python. They improve readability, documentation, and when paired with a modern IDE, can improve autocomplete suggestions and supply advanced warnings.

I propose that we incorporate type hinting as much as possible in a future release, at the very least for function/class signatures in user-facing code core library code.

Definition of done

  1. Type hinting in all user-facing function and class signatures. Anything which is exported should be type hinted.
  2. Type hinting should use either standard library hinting (native in Python 3.8 and later, provided by the typing-extensions package in earlier versions) or NumPy typing when appropriate (provided under numpy.typing in NumPy versions 1.20 and higher). For example, a function which takes a numpy.ndarray should be annotated with numpy.typing.NDArray.

cako avatar Dec 28 '21 18:12 cako

@mrava87 I put this as a To do for v2.0.0, I hope that's ok!

cako avatar Dec 28 '21 18:12 cako

Sounds good! It is a lot of work but worth for a big release :) we can aim for it in coming months also to remove the various deprecated parameters here and there

mrava87 avatar Dec 28 '21 19:12 mrava87

@mrava87 could we upgrade to NumPy 1.20?

cako avatar Apr 15 '22 23:04 cako

I guess you mean as minimal allowed numpy version?

For v2, sounds like a good idea :)

mrava87 avatar Apr 16 '22 05:04 mrava87