docker-py icon indicating copy to clipboard operation
docker-py copied to clipboard

Automatically add many type hints, with ruff

Open adamtheturtle opened this issue 5 months ago • 1 comments

If this library is to ship type hints, it is important that those type hints are valid. A type checker (e.g. mypy or pyright) can check that those type hints are valid.

This PR is one small step towards that goal.

I ran:

ruff --extend-select=ANN201,ANN202,ANN204,ANN205,ANN206 --fix --unsafe-fixes docker

and I did not make any manual changes.

I chose not to also type other directories (such as tests) as that is a decision I'd first like to hear from core maintainers on.

adamtheturtle avatar Jan 26 '24 19:01 adamtheturtle

https://github.com/JelleZijlstra/autotyping, https://github.com/orsinium-labs/infer-types, https://github.com/instagram/MonkeyType could be used to add more types (but they'll require more hand-holding and manual review).

akx avatar Feb 08 '24 12:02 akx