Skip to content

reportMissingModuleSource on import bpy #437

Description

@Andrej730

It seems as a consequence of #433, now a warning pops up in VS Code ("Import "bpy" could not be resolved from source Pylance[reportMissingModuleSource]"):

Image

What do you think is the best workaround to avoid it?

Options that came to mind:

  1. # pyright: ignore[reportMissingModuleSource] on the same line - fixes it, but it might get noisy
  2. # pyright: reportMissingModuleSource=none at the top of the file/project - might disable this warning for other imports where it can be useful
  3. installing some older version of fake-bpy-module in parallel that doesn't have -stubs, but then it defies the puprose of Follow "Distributing type information" by renaming modules to *-stubs (such as bpy-stubs) #433

Thinking about it more, I can't find any scenario where reportMissingModuleSource might actually help in case of a Blender addon, since all the imports will be inside Blender's context either way, so their concrete sources shouldn't be discoverable inside VS Code project. So reportMissingModuleSource should become a new disabled setting in all Blender related projects, along the reportInvalidTypeForm we disable due to Blender API quirks.

Does it makes sense, any caveats to this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions