Skip to content

Option to disable Python2/comment-style type annotations #13177

Open
@dfarley1

Description

@dfarley1

Our codebase (all Python3) has a few places where we ended up writing comments that look like # type: some description ... prior to adding Mypy. They're usually within a larger multiline comment block when we're describing an expected Dict layout, e.g.

❯ cat foo.py
# Each Foo has the following fields:
# name: name of the foo
# display_name: human name
# type: type of foo it is
# tags: list of tags that apply to the foo
❯ mypy foo.py
foo.py:4: error: invalid syntax
Found 1 error in 1 file (errors prevented further checking)

Since we're only using Python3 and "proper" type annotations, it'd be nice if we could stop Mypy from trying to parse these types of comments. I know we could change our comment style to use dashes or something else that won't anger Mypy but it's annoying that it's necessary; and honestly colons are the better delimter anyways.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions