-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Type hinting in code #1749
Comments
@fafhrd91 Please comment decision, if possible. |
Personally, I do not use type annotations. But I am fine with type annotations on public methods |
I'm about requirements on |
That's fine |
I personally dislike type annotations in performance sensitive code in python. Any footprint bloat would slow things down, especially in interpreted languages. |
I thought there should be no runtime penalty? |
the annotations are accessible at runtime through |
Ah, but compared to overall speed of python that doesn't really matter. I guess it is possible to come up with method how to strip annotations data at startup |
The annotations are not necessarily for type hints and are runtime visible. It's just the IDEs using them for type hints. I have used annotation for other things in my programs, such as param sanitizing. |
Annotations are perfect concept but before applying it to aiohttp we need reliable type checker tool. At least I had big problems when tried to check annotations for smaller aio-libs projects. |
extra datapoint: all the code I write has type hints as it greatly helps finding issues in pycharm while developing |
I also had negative experience with type hints as annotations. Tools are not ready indeed and you have to choose between two evils: do additional imports for getting types and accidentally end with circular ones or double number of files to maintain. So far good old sphinx docstrings are more handy and PyCharm can use it for type hinting. You still have to write docs anyway. However, I think you can start make annotations today as typeshed part or as standalone project with stubs like pyspark and contribute back fixes of any problems you found. |
python/typing#84 is a blocker: without support for third-party libs in mypy type annotations are useless for aiohttp users. |
I don't want to support aiohttp stubs in typeshed but want to add annotations into aiohttp itself |
I have requirements concern: |
I think we'll drop 3.4 before adding type hints |
Can the "on hold" status be revoked now that 3.0 is out the door? |
@chrisimcevoy is fairly hard to add typing everywhere instantly, but you are welcome to help with this by adding bit of type annotations in PRs ;) |
How aiohttp 3.0 release is related to PEP 561 implementation? |
@webknjaz Agreed. Gradual typing would be best. I would like to find time for a small-ish PR if it would aid discussion and get the ball rolling. @asvetlov Apologies, I should have been more clear. I was referring to your earlier comment, that dropping Python 3.4 support was a prerequisite for type hinting aiohttp. If mypy support for PEP 561 is also a blocker, then so be it. |
I hope mypy issue will be solved soon. |
Blockers: python/mypy#4255 and python/mypy#4403 |
python/mypy#4693 is a new blocker |
awesome |
We need to wait for mypy 0.590 release, after that setup mypy tool on travis and start adding annotations. |
v0.590 and v.600 are both released, what's the next step for this? |
I have a #3049 Others should be fixed in the branch before merging. The branch has a limited typing support, but after the merge we can do the rest in separate iterations. |
The challenge is huge. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
Long story short
While working on big project, typing check helps to exclude shot in the leg scenario.
Expected behaviour
Type annotations on public methods.
Actual behaviour
No any type annotations, including the most docstrings.
Note
Need a decision: typing in global requirements or use version-specific requirements (PEP496/PEP508)
The text was updated successfully, but these errors were encountered: