[Python] VSCode Intellisense does not suggest base class methods after installing...

Discussão em 'Python' iniciado por Stack, Abril 18, 2025.

  1. Stack

    Stack Membro Participativo

    I'm distributing a Python library compiled with Nuitka and generating .pyi stub files using:

    stubgen --parse-only --include-docstrings <my_project> -o .


    After compiling the project with Nuitka and installing the resulting .whl package, VSCode (or PyCharm) no longer provides autocompletion for base class methods when working with subclasses.

    For example:

    # parent.py
    class Parent:
    def run(self) -> None:
    print("Running Parent")

    # child.py
    from parent import Parent

    class Child(Parent):
    def configure(self) -> None:
    print("Configuring")



    After installing my compiled library in a new project:

    from my_project import Child

    child= Child()
    Child.run() # No autocompletion shown for 'run'


    • run() is inherited from Parent, but the IDE doesn’t recognize it in Child.


    • The .pyi stub for Childonly contains methods defined directly in that class.


    • Parent is declared correctly and present, and both are included in the .pyi tree.

    How can I generate or structure my .pyi files so that IDEs like VSCode or PyCharm can resolve base class methods (like run() above) in subclasses (Child) after Nuitka compilation?

    Is there a way to get stubgen to include inherited methods? Or should I modify the .pyi files manually or through a post-processing script?

    Continue reading...

Compartilhe esta Página