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

Enable no-untyped-def in mypy #4399

Open
justinchuby opened this issue Aug 1, 2022 · 8 comments
Open

Enable no-untyped-def in mypy #4399

justinchuby opened this issue Aug 1, 2022 · 8 comments
Assignees
Labels
enhancement Request for new feature or operator good first issue Good for getting started

Comments

@justinchuby
Copy link
Contributor

Use no-untyped-def to encourage typing annotations.

@justinchuby justinchuby added the enhancement Request for new feature or operator label Aug 1, 2022
@jcwchen jcwchen added the good first issue Good for getting started label Aug 10, 2022
@daspartho
Copy link

Hi @justinchuby ,
I'd like to contribute to this issue, so could you please explain what the issue is about and point me to some resources to get started before I begin?

@avisinghal6
Copy link

@jcwchen , I would like to work on this enhancement, could you kindly guide me through it .

@jcwchen
Copy link
Member

jcwchen commented May 30, 2023

@jcwchen , I would like to work on this enhancement, could you kindly guide me through it .

Thank you for your interest! Please add no-untyped-def=true in this file:

[tool.mypy]

and run mypy onnx (use the latest mypy from PyPI); Fix every error related to no-untyped-def. After that, submit a PR to see whether all relevant errors have been resolved in the Lint CI.

@avisinghal6
Copy link

#self-assign

@avisinghal6
Copy link

I will create the PR by tomorrow morning.

@avisinghal6
Copy link

Created PR #5272

@avisinghal6
Copy link

@jcwchen I created the PR and "enforce styles" is failing, i checked the error, the errors are because there are a lot of functions which dont specify a type definition. The solution it shows is to add "# type: ignore[no-untyped-def]" at top of each of the files. Since there are so many files, i was wondering if this is the way to proceed or there is an efficient method. Kindly advise.

@jcwchen
Copy link
Member

jcwchen commented Jun 1, 2023

I am not aware any efficient method to apply it and thus you might need to add the type annotation one by one. Adding annotations is preferred than adding ignore at the top unless there is a strong reason not to have types. There are quite many errors around no-untyped-def and it needs huge effort to apply it entirely... This work can be broken down into several PRs if needed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Request for new feature or operator good first issue Good for getting started
Projects
Development

No branches or pull requests

4 participants