Gitcoin is GDPR complaint. Learn more in
Gitcoin's Terms & Conditions.
Check out the Issue Explorer
Looking to fund some work? You can submit a new Funded Issue here.
> Largely copy/pasted from https://github.com/ethereum/py-evm/issues/1398
[Type hints](https://www.python.org/dev/peps/pep-0484/) allow us to perform static type checking, among other things. They raise the security bar by catching bugs at development time that, without type support, may turn into runtime bugs.
[This stackoverflow answer](https://stackoverflow.com/questions/32557920/what-are-type-hints-in-python-3-5/32558710#32558710) does a great job at describing their main benefits.
### What is wrong?
This library currently does not have any type hints.
This needs to be fixed by:
1. Adding all missing type hints.
2. Enforcing (stricter) type checking in CI
There does exist tooling ([monkeytype](https://engineering.instagram.com/let-your-code-type-hint-itself-introducing-open-source-monkeytype-a855c7284881)) to the generation of type hints for existing code bases. From my personal experience `monkeytype` *can* be helpful but does still require manual fine tuning. Also, manually adding these type hints does serve as a great boost to the general understanding of the code base as it forces one to think about the code.
1. Run `mypy --follow-imports=silent --warn-unused-ignores --ignore-missing-imports --no-strict-optional --check-untyped-defs --disallow-incomplete-defs --disallow-untyped-defs --disallow-any-generics -p eth`
2. Eliminate every reported error by adding the right type hint
Because this library supports older versions of python, the type hints will not be able to use the modern python3.6 syntax.
### Definition of done
This issue is done when the following criteria are met:
1. `mypy` is run in CI
Add a new command to the `flake8` environment in the `tox.ini` file that runs:
mypy --follow-imports=silent --warn-unused-ignores --ignore-missing-imports --no-strict-optional --check-untyped-defs --disallow-incomplete-defs --disallow-untyped-defs --disallow-any-generics -p py_ecc`
2. Usage of `type: ignore` (silencing the type checker) is minimized and there's a reasonable explanation for its usage
### Stretch goals
When this issue is done, stretch goals can be applied (and individually get funded) to tighten type support to qualify:
1. `mypy --strict --follow-imports=silent --ignore-missing-imports --no-strict-optional -p py_ecc`