Add type hinting
See original GitHub issueI would suggest (though it is again stylist and not required) to start adding type hints as it is being moved into the standard python world. This helps many code editors with completion and allows for robust tests using type checkers such as mypy
.
Though this is not my field, I can see this code as being a framework where other researchers import it and build future models, thus type hinting would keep them from stumbling over the various inputs and outputs related to theano
and pymc3
which are vital to the functionality of the code. I note that neither of these frameworks are typed, but the size of exoplanet
is manageable enough (with lots of contributors) to slowly add this in.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
typing — Support for type hints — Python 3.11.1 documentation
This module provides runtime support for type hints. The most fundamental support consists of the types Any , Union , Callable , TypeVar ......
Read more >Type Hinting - Real Python
In this lesson, you'll learn about type hinting in Python. Type hinting is a formal solution to statically indicate the type of a...
Read more >Type hinting in PyCharm - JetBrains
To add a type hint, follow these steps: · Select a code element. · Press Alt+Enter . · Select Add type hint for...
Read more >Type hints cheat sheet - mypy 0.991 documentation
Type hints cheat sheet#. This document is a quick cheat sheet showing how to use type annotations for various common types in Python....
Read more >12 Beginner Concepts About Type Hints To Improve Your ...
Type hints are performed using Python annotations (introduced since PEP 3107). They are used to add types to variables, parameters, function arguments as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Great - yes, it really is awesome for code completion, etc. I have a few other projects (that don’t depend on numpy) where I’ve loved using Python typing.
I’m going to remove the
joss
label on this issue and leave it open as a future feature request. Hopefully sooner rather than later!@grburgess: If you don’t mind, I propose splitting this into two issues: (1) Fill in some missing docstrings and (2) type annotations.
I would argue that type hinting is out of scope for now since the underlying libraries (numpy and theano/aesara) only have very limited support for typing at the moment (e.g. https://github.com/numpy/numpy/issues/7370 & https://github.com/pymc-devs/aesara/issues/200). Since these are the main return types of all of the
exoplanet
methods, I’ve found that the added benefit is currently somewhat limited. In the long run, I would very much like to add this so I’m following the conversations closely! What do you think about that @grburgess?