Skip to content

Add CI rule to prevent type annotation regressions #1102

@scotts

Description

@scotts

PR #1100 updated our type annotations to the modern syntax and types. We should have a CI rule to enforce no regressions. From @NicolasHug:

I think we'll want a linter rule now, to enforce the new style? pyupgrade looks like what we'd want. It comes with pre-commit hooks too, so we can put it on the CI.

I ran it locally on this PR with:

find src -type f | grep ".py$" | xargs pyupgrade --py310-plus

and the good news is that your PR is spot-on, the only added changes were:

from typing import Generator  # before
from collections.abc import Generator  # now

There were a few more minor changes in the test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorImproves code itself, but does not fix a bug or add new functionality.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions