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

lint/CI: Use mypy for static type checking #1335

Closed
jku opened this issue Apr 7, 2021 · 3 comments · Fixed by #1395
Closed

lint/CI: Use mypy for static type checking #1335

jku opened this issue Apr 7, 2021 · 3 comments · Fixed by #1395
Assignees
Labels
backlog Issues to address with priority for current development goals
Milestone

Comments

@jku
Copy link
Member

jku commented Apr 7, 2021

We should start running mypy in CI (probably in tox "lint" environment). This would enforce type annotation use and would check types at compile time.

Possibly we only want to do this to "new code" like api/ but it might be worth it to add annotations to everything (I'm not sure how much work this is).

Current behavior:

  • type annotation use is not enforced
  • types are not checked at compile time

Expected behavior:

  • new code without type annotations fails CI
  • types are statically checked: type check failure leads to CI failure
@jku
Copy link
Member Author

jku commented Apr 7, 2021

I'm not sure if this is a "good first issue" but getting started should not require deep knowledge of tuf.

@joshuagl
Copy link
Member

joshuagl commented Apr 7, 2021

Some good pointers in the mypy docs, such as Using mypy with an existing codebase and the import cycles section of the runtime troubles document.

@jku jku self-assigned this May 11, 2021
@jku
Copy link
Member Author

jku commented May 11, 2021

I've got a branch, currently blocked on #1378 (it happens to correctly fail a mypy check): https://github.com/jku/tuf/tree/initial-mypy-integration

@jku jku added backlog Issues to address with priority for current development goals and removed up for grabs labels May 21, 2021
@sechkova sechkova added this to the weeks22-23 milestone May 26, 2021
@jku jku closed this as completed in #1395 Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Issues to address with priority for current development goals
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants