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
Implement Type Hints #441
Implement Type Hints #441
Conversation
Deprecated since version 1.5.0: iteritems is deprecated and will be removed in a future version. Use .items instead.
remove api changes since they are generated automatically
I spent a lot of time in public transport this Christmas so this is the end result 🎁. I did not implement the type annotation in the read functions since they will be deprecated in the future. |
8e82b9c
to
00e987b
Compare
dc55043
to
f488c96
Compare
capital error
af1ad33
to
3743419
Compare
The read the docs test fails because it uses a
It is being worked on: For now I'll try and fix it in the requirements by forcing |
numpy < 1.24, due to numba support
numpy < 1.24, due to numba support
This can be merged into the dev branch after a new version of Pastas is released (at the latest next Tuesday) by @raoulcollenteur. Maybe @dbrakenhoff can check this PR? |
See comments on Numba Support of Numpy 1.24 in #441
Nice catch. Should we not directly change this in the dev-version, rather than in every single PR? |
I don't have permission to write directly to the dev branch :), so I'd just merge the #420 PR to the dev and everything will be solved. I'll remove the change from this PR #441 afterwards. I only fixed the same bug in #420 because it can't be merged otherwise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking much better already. Nice move with the quoted annotations in typing.py and the mypy trick.
I think we should replace Tminmax with a normal Timestamp (or Union[str, Timestamp]), because those are functionally the same types.
Also nitpicking, but perhaps rename Array_Like to ArrayLike (more in line with Python class naming conventions)?
I agree on the black formatting style for functions with lots of input parameters. Whether we should apply it to the whole code base is a separate discussion maybe.
- remove None default arguments that are not needed - add Optional[Series] if need be
- rename Array_Like to ArrayLike - rename Tminmax to TimestampType
I was crazy enough to format the functions and methods by hand. Leaving the rest of the code (and thus git blame) intact which is one the arguments @dbrakenhoff raises in #448 |
fdae4a0
to
db9576a
Compare
Don't know how to rerun all GH action jobs without 3.11. |
All changes were made by @martinvonk
Finally after 5 years fix issue #441
Short Description
This pull request implements Type Hints into Pastas. Python does not enforce function and variable type annotations. However they can be used by third party tools such as type checkers, IDEs, linters, etc. This helps the Pastas users and developers to write better code.
Checklist before PR can be merged: