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

Sorry about my question as I am a complete noob, but, I opened my “C:\Users\evand\AppData\Roaming\Code\User\settings.json”
It already has:

{

"python.pythonPath": "C://Users//evand//AppData//Local//Programs//Python//Python37//python.exe"

}

If I try to add

{

"python.autoComplete.extraPaths": [

"C:/Users/evand/AppData/Local\Programs/Python/Python37/Lib/site-packages/fake_bpy_module_2.80"]

}

It gives an error “End of File Expected”.
If I try to add to the same bracket:

What am I doing wrong? Wrong settings.json file? Wrong formatting? Wrong everything?

Mixed separators. Always use \\ on windows withing commas in vscode. So your paths should turn

“C:\\Users\\evand\\AppData\\Local\\Programs\\Python\\Python37…”

If I’m not mistaken. Moved to windows just recently.

1 Like

Thanks! I indeed missed the double slash.
I also saw how a json file is formatted and managed to do it. I had to add a comma after the pythonpath adress bracket.

{

"python.pythonPath": "C://Users//evand//AppData//Local//Programs//Python//Python37//python.exe",

"python.autoComplete.extraPaths": "C://Users//evand//AppData//Local//Programs//Python//Python37//Lib//site-packages//fake_bpy_module_2.80"

}

@Nutti Is there going to be a fake-bpy-module-2.83 soon? I’m using 2.82 for now but there are things like bpy.context.workspace that are missing from 2.83.

@obsurveyor

Sorry for late response.
We’re preparing the release for 2.83.

Recently, I launched the slack channel for fake-bpy-module.
If you’re interested in this, you can join this channel.
We’re going to announce the release at this channel.
https://fake-bpy-module.slack.com/

Recently, we moved to blender.chat.
fake-bpy-module channel can be found in below link.
https://blender.chat/channel/fake-bpy-module

Feel free to join this channel.

1 Like

The derived project of fake-bpy-module (fake-bge-module ) is now launched.
fake-bge-module project focuses on UPBGE.

I tried using this again, but there is not much info to work with. I tried the link to visual studio code, but its dead. Simply opened a console and use the pip install command on the rout, i guess. it was at c:\ but i dont see anything there???

edit
okay found it, it installed in python39 lib folder?!?! Not sure what to do with it now.

Windows is a nightmare with those double backslashes. Whats wrong with single forward slahes. I see on windows you can you both, lots of apps can read those double backslashes but also the forward. I prefer forward since thats also compatible with OSX.

just tried both and again both work. Why is it that its explorer uses single backslash but that never used in code since that comments characters in strings?! Sorry just find Windows frn weird.

I got it working again.

Perhaps Nutti could add some more info on his GitHub

Yes, it’s not clear at all. Moreover escaping them is difficult. Windows is terrible for programming.

1 Like

What’s not clear on the following page? https://github.com/nutti/fake-bpy-module/blob/master/docs/setup_visual_studio_code.md

Here’s what my config looks like - fwd slashes work fine, it took me 2 seconds to test when I first started using the module as I agree backslashes suck too:

  "python.autoComplete.extraPaths": [
    "D:/premade_modules/2.92"
  ],

Would also be handy if we now the path where it is installed when using pip. all i see is a file in some cache folder. No paths nothing?!

after some google on OSX its /usr/local/lib/ python2.7/site-packages. I got a old machine so its an old python version

Hi there! How come I dont see any suggestions when I type:
image

But do see them when I type:

Isnt this kinda the exact same thing lol?

Or is this because Python isnt statically typed?

I do not think that will work. VSCode can’t parse that since it needs to interpret the above line first and that is generally possible with the regular Python distribution not with Blender’s Python.

You will need to compile Blender as Python module and install it under system’s Python to get a bit more sophistication with the autocompletion, instead of using the Fakebpy module ( as its name implies, it is fake).

I’m sorry to ask, but I installed fake-bpy with pip in VSCode.

I think "python.analysis.extraPaths": [ "C:/Users/MYNAME/AppData/Local/Programs/Python/Python37/Lib/site-packages/fake_bpy_module_3.1-20221006.dist-info" ]
should be fine (tried it out with \ as well…) but it still gives me “could not resolved” issues.

Any ideas so far? I’m using the most recent version of VSC and I’m on Win10

It shouldn’t be necessary to modify the extraPaths property.
Make sure your vscode workspace is using the same interpreter that you installed the fake-bpy package to.

MAAAAN! That was the point! Thanks a thousand times!

Released non-regular update.

Notice

From this version, fake-bpy-module requires Python 3.12.

Updated Features

  • Support fake-bpy-module-4.2
  • Use Python 3.12 syntax for type annotations on the generated modules
  • Support type alias for RNA enums

Other Updates

  • Enable Ruff lint on CI against both generation code and generated code
  • Fix bugs
1 Like

Released non-regular update.

Notice

From this version, fake-bpy-module supports Python 3.8 to 3.11 again.

Updated Features

  • Support fake-bpy-module-4.3

Other Updates

  • Fix bugs
3 Likes

People found this super useful. Any chance to get Blender 5.0 working?

1 Like