Fake bpy module (For Code Auto-completion on IDE)

Hi,

Blender does not python API as python files, so only few APIs can be completed code automatically by IDE (PyCharm, Eclipse).
Therefore, I made a fake python modules for a code auto-completion on IDE.

I will show you an example in PyCharm.


PyPI package is also available.
Only you need to do is executing pip install fake-bpy-module-<blender_version>.

Any requests and comments are welcome.

fake-bpy-module channel (https://blender.chat/channel/fake-bpy-module) at blender.chat is also usable for the discussion of fake-bpy-module.

Have a fun for bpy coding!!

4 Likes

You’re so awesome for this. :yes:

In Pycharm you can add it as a “Path For The Selected Interpreter”, so you don’t have to copy folder to your project directory.

Does this work with Brackets?

Do i need to follow the steps in the gitHub page and then add "from gen.py import * orso? Not sure what to do with the gen.py file

No homo, but I love you…

Interesting addon(?)! It seems like there’s some stuff missing though, like scene, data, things under context.

1 Like

@cmomoney

Thanks.
You are right.

@rombout

sorry, the procedure in GitHub is for module generation.
if you want to fake bpy module, you only need to add modules on https://github.com/nutti/fake-bpy-module/tree/master/modules/2.79 to the path on IDE’s project .

@antoni4040

you are welcome :slight_smile:

@Cyaoeu

ah…, you are right.
but we can not get these things from Blender’s documentation.
If there is idea to get them, please tell me…

Yeah I’m not sure either. Besides it’s pretty obvious that stuff like context won’t work because there’s no Blender scene anyway. :stuck_out_tongue: Still it would be interesting if you could “fake” objects too. But I guess I do things like this in the python console anyway (and then copy paste) so it doesn’t matter too much.

@Cyaoeu

yes, it’s future tasks about it.
Anyway, thanks for your pointing out.

I will need to dive into this and see if this is helpfull.

I dont compelte understand what the benefit of this addon is. Does this addon autocomplete you code in PyCharm and also check for possible errors in the code and functions, classes etc etc?

@rombout

I dont compelte understand what the benefit of this addon is

No, it is not add-on.
it is modules for only add-on developers.

we can auto-complete add-on codes in PyCharm or VSCode.
I was in trouble about that there is no module which can auto-complete bpy code.
so, i use this modules for auto-completion and make the development faster.

We did something similar !

Pycharm is really great with template and auto complete !

Thanks, this worked great. Would have been easier with an english video though. :stuck_out_tongue:

@pitiwazou

nice tutorial !!
my module can be adapted same way

I got it working now using Pitiwazou method. Quite nice actually, no i need to get used to PyCharm, i used brackets always. So i need to check how i can get my colors the same to that theme. Im almost there but some parts wont color.

Love Pycharm, templates makes life so easy !

I use Script Watcher addon to update in blender on single file addons, don’t really work on multi files addons.
F8 works too but we have a lot of error messages from other addons.

3 solutions :

1 - Restart blender
2 - Use script watcher or F8
3 - Use F8 on clean blender with no addons

Yea i noticed the error with script watcher. I got a addon which consist of multiple script, this causes for errors about some script which cant load. So i guess im back at using F8, also causes errors sometimes for km stuff. So restart is only option. Was always working like that so i had hoped this would work.

I need to start learning about all them plint and pep8 warning, its looks messy due to that. Some of those warnings arent relevant i guess

Don’t know why bu I can’t get it to work…


Hi, I juste used the process discribed here : https://github.com/nutti/fake-bpy-module
but can you explain how to use these generated files in vs code for auto completion ?

About VSCode:

In your setting.json add the following line:

{
“python.autoComplete.extraPaths”: [
“/Path-to-the-bpy-definition-folder”
],

Mind the path is absolute. HTH.

1 Like

I added the documents and tutorials about this module.

Please refer above page if you try to use this module.
And it is welcomed to give me other tutorials.
If you have any tutorial for other IDE, you can send me through Pull Request.

Thanks.