nutti / fake-bpy-module

Fake Blender Python API module collection for the code completion.
MIT License
1.32k stars 95 forks source link

Make single file modules PEP 561 compliant #138

Closed WannesMalfait closed 9 months ago

WannesMalfait commented 11 months ago

Description about the feature

Currently when installing fake-bpy-module via pip it creates some modules which are folders (like bpy or bl_rna_utils) and some which are just a single file, like rna_keymap_ui. The problem is that mypy doesn't like these single-file modules. Because of this, I am not able to do type-checking with these modules.

Proposed fix

Change all the single file modules to folder modules. For example, going from rna_keymap_ui.py to

rna_keymap_ui/
  __init__.py
  py.typed

where __init__.py contains the exact same code as rna_keymap_ui.py and py.typed is an empty file. So, this is an extension of #92

I tested this locally on my machine, and making this change makes mypy start typechecking the module. I also tested it with vs code, and the type checker of the pylance extension didn't complain about the new structure either.

Are you willing to contribute about this feature. (Yes/No)

No. I hope that it would not be too difficult, since something similar was already done for #92 . In any case, thank you for all the work you have already put into this project!

nutti commented 9 months ago

The patch is now merged. Thanks for your request.