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

Add type hinting #193

Open
grburgess opened this issue May 20, 2021 · 7 comments
Open

Add type hinting #193

grburgess opened this issue May 20, 2021 · 7 comments
Labels
documentation Missing docs or mistakes in existing ones enhancement New feature or request help wanted Extra attention is needed

Comments

@grburgess
Copy link

grburgess commented May 20, 2021

I 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.

@grburgess grburgess added the enhancement New feature or request label May 20, 2021
@grburgess
Copy link
Author

linking: openjournals/joss-reviews#3285

@dfm dfm self-assigned this May 20, 2021
@dfm dfm added the joss Issues related to JOSS review label May 20, 2021
@dfm dfm added the documentation Missing docs or mistakes in existing ones label May 20, 2021
@dfm
Copy link
Member

dfm commented May 20, 2021

@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. numpy/numpy#7370 & pymc-devs/pytensor#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?

@grburgess
Copy link
Author

I will split it up.

@grburgess
Copy link
Author

@dfm I agree that for the time being it is only icing on the cake at the moment and can be ignored for the review. The real power for now is when using editors that support LSP. The code completion and code hinting become a very powerful tool for real time code and syntax checking.

@dfm
Copy link
Member

dfm commented May 20, 2021

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!

@dfm dfm changed the title JOSS Review: Type hinting Add type hinting May 20, 2021
@dfm dfm removed the joss Issues related to JOSS review label May 20, 2021
@dfm dfm removed their assignment May 20, 2021
@dfm dfm added the help wanted Extra attention is needed label May 20, 2021
@grburgess
Copy link
Author

I can also take a stab at putting some hinting in as PRs.

@dfm
Copy link
Member

dfm commented May 20, 2021

That would be very awesome if you're keen, but no pressure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Missing docs or mistakes in existing ones enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants