-
Notifications
You must be signed in to change notification settings - Fork 134
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 Typing for Stream and Sequence #162
base: master
Are you sure you want to change the base?
Conversation
about pylint errors
what should I do next? waiting for maintainers to modify coverage and pylint rules, or do it myself, or do something else? about typing hint most typings works well with mypy and vscode( Pylanse as LSP),but not PyCharm。 in vscode, when I write but in Pycharm, it will ignore the context, it can only see the lambda itself, then treat it as A possible solution for pycharm is to use There will be no such problems when using VScode(pylance),it's smart enough. But there will be some problems when using mypy, that's all because of @overload
def _wrap(v: set) -> set: ...
@overload
def _wrap(v: Iterable[T]) -> Sequence[T]: ... but, set and Iterable overlaped, they cannot overload, it's an error in mypy. I don't know if those are what we wanted. |
I commented on the other issue, its fine if coverage goes down as long as its reasonable. All the other checks should pass and it would be a good idea to add a mypy checker on unit tests to test the types themselves. I can take a closer look at the pylint errors later today or tomorrow, its possible to disable these on a line by line basis, there should be examples in the pylint documentation as well as some scattered throughout the code. As long as its disabled on a line/function for a good reason, I'm fine with it in general. For some of the TypeVars, it would be great to give these more readable or at least traditional names (e.g., things like I'll take a closer look at the other issues when I get some time. Thanks for the quick/great work! |
@EntilZha do you mean |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Codecov Report
@@ Coverage Diff @@
## master #162 +/- ##
==========================================
+ Coverage 97.98% 98.11% +0.13%
==========================================
Files 12 12
Lines 2237 2393 +156
==========================================
+ Hits 2192 2348 +156
Misses 45 45
Continue to review full report at Codecov.
|
hey folks, how can I help u to merge this? i would love type hints on pyfunctional |
It would be great to have a type checker included to test the types themselves. I’m not sure how, but having a test to check types of a basic pipeline would be great. I’ll take a second look at the names today as well. The merge conflict should be easy to resolve, but would also need to be resolved. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@EntilZha regarding
There is a package that does exactly that: https://github.com/agronholm/typeguard I am not sure how "heavy" the typeguard package is in terms of installation and also I am not aware of the runtime overhead induced, but it could be a nice addon. I saw that some pip packages have flavors depending on what your are looking for. You could have |
@bmsan I was thinking for type checking being part of the test/lint pipeline, not part of the code that the library itself runs. Basically looking to have a way to run automated tests to make sure that (1) the types added are correct and (2) if functions change, that it forces updated type annotations |
I personally run beartype, it does good job of checking types in the runtime. Maybe you can just use beartype-d functions in the test and check if they crash? |
Hi @antonkulaga @bmsan (and others). Just to avoid any miscommunication, I'd merge this PR (or a modification of it) if it added an automatic linting step to make sure that the current types work correctly and to ensure that future PRs don't accidentally break typing. Bonus points for attaching a screenshot of VS Code working correctly :). I don't personally have time to add this and test it, but am happy to review/merge a PR that adds it. Do you think @weditor you could add mypy for static type checking as a lint step? Feel free to explore beartype for checking types during unit tests. It's not necessary, but could be nice. If you happen to be busy, perhaps @antonkulaga or @bmsan could make a parallel PR that adds mypy or beartype to the lint step (without adding new type hints), and then it would be easy for me to rebase this PR on top of that and check it. Thanks all for the input/comments/discussion and sorry for being a bit slow on this. |
I created a fork (robindorstijn/PyFunctional) with a minimal commit to the travis configuration that should run mypy. Mypy does static analysis of types which confirms proper use of types. |
@Drvanon You should be able to make a PR from that it trigger builds here I think? |
+1 |
add Typing for Stream and Sequence