Skip to content

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

Closed

Description

@jku

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

Activity

  1. jku commented on Apr 7, 2021

    @jku
    MemberAuthor

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

  2. joshuagl commented on Apr 7, 2021

    @joshuagl
    Member

    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.

  3. self-assigned this
    on May 11, 2021
  4. jku commented on May 11, 2021

    @jku
    MemberAuthor

    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

  5. added
    backlog
    and removed on May 21, 2021
  6. added this to the weeks22-23 milestone on May 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

backlog

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions