question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add type hints for all packages

See original GitHub issue

Type hints allow us to perform static type checking, among other things. We could benefit a lot from using them.

This stackoverflow answer does a great job at describing their main benefits.

pyannotate would come in handy if it had support for py3-style annotations, but meanwhile we can add them manually

monkeytype may actually be more useful than pyannotate as it generates py3-style annotations

Definition of done

  • type hints for all of evm, p2p, and trinity modules.
  • individual mypy CI runs for each of these modules using mypy --follow-imports=silent --ignore-missing-imports --check-untyped-defs --disallow-incomplete-defs -p <module>

This should not be done as a single pull request, but rather many small ones to iteratively add type hints, slowly expanding the mypy coverage as hints are added.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:29 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
cburgdorfcommented, Mar 7, 2018
1reaction
pipermerriamcommented, Apr 30, 2018

I don’t want to take this away from anyone (so speak up if you happen to be halfway through this or something). I am going to close this. We’ll still be adding type hints, but it will now be something iterative after some of the incoming refactors happen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Type Hints: How to Gradually Add Types for Third ...
One place you can apply graduality with Mypy is in the type hints for third party packages. The default course of action is...
Read more >
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 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 >
Type hinting in PyCharm - JetBrains
Select a code element. · Press Alt+Enter . · Select Add type hint for .... · Press Enter to complete the action or...
Read more >
Automatically add Type Hints in Python - Shreyas' Blog
Type hints help document your code. Traditionally, you would use docstrings if you wanted to document the expected types of a function's ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found