Skip to content

Preserving existing annotations in stubgen #2106

@JukkaL

Description

@JukkaL

If code has annotations, it would be nice if stubgen would preserve them instead of filtering them out. Example (input -> output):

from mod import Thing
import mod2

def f(x: Thing) -> int:
    mod2.do_stuff()
    # more implementation

->

from mod import Thing

def f(x: Thing) -> int: ...

Maybe we should also (optionally) run type inference so that we could output inferred types for module-level variables and attributes.

See also discussion in #1899.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions