Skip to content
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

Automatically add many type hints, with ruff #3222

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adamtheturtle
Copy link
Contributor

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.

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 --fi
x --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.

Signed-off-by: Adam Dangoor <[email protected]>
@akx
Copy link
Contributor

akx commented Feb 8, 2024

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants