My question is; How do I create a downloadable package like Python’s requests module? (it doesn’t have to be on pypi, just downloadable from a git repo)
My goal is to deploy this bpy module to a Windows server running docker with a Django Rest_Framework API. I want to be able to tell DockerFile: Download bpy3.2 at this GitHub link when deployed or possibly add it to a requirements.txt file. What I don’t understand is how the file structure of the folders above will affect the download and implementation into python310. Would it be easier to just use a Virtual Env and copy it to the container somehow?
Any help would be appreciated, thank you for your time!
I believe there are other more python oriented forms that can handle the how. There might be a dev with experience how to set it up here.
The blender as py module isn’t cross platform when using inside docker you might want to compile it in Linux against the libs of the docker container you’re using. After that if your idea is to upload the binaries to a git repro would perhaps explode in size.
What I have done for blender101 is to build the python module inside a docker container and push the created docker image to a docker repro.
In the later you can just base your docker file from the pushed image. Using requirements.txt might be a lot of work and management issues need to be overcome.
Ah thank you @ankitm and @JeroenBakker! That’s some great insight, I’ve taken a look at Tyler’s repos and some of the stuff he has there is really useful.
From the above I think the best approach is to do what @ankitm said and zip the 3.2 folder, bpy.pyd, and .dll files on a repo, then download them on the deployed server. After they are downloaded it would just be a mater of installing the appropriate files into the python310 directory.
My initial thinking was to package everything into a virtualenv, however as @ankitm mentioned, the 3.2 folder needs to be installed directly to python310. For some reason it doesn’t work if its in the venv folder.
Thank you all for your help! I’m going to give this a try and update once it’s working
It doesn’t contain any .py or bpy related files so I’m confused. If it is the right folder, could you elaborate a bit more on what I should do after it’s extracted on the server; Should the 3.2 folder and .pyd/.dll files all be in the python310 path on the server as well? Then it’s just a matter of setting the environment variable pythonpath = C:\path\to\build_folder?
Just to recap the steps I’ve done so far:
Git clone into Blender using git clone https://github.com/blender/blender.git
Build blender dependencies using cd blender then make update
Run make bpy
Run:
cd C:\blender-git\blender
cmake -C.\build_files\cmake\config\bpy_module.cmake -DWITH_INSTALL_PORTABLE=ON -DCMAKE_INSTALL_PREFIX=..\install_folder -S . -B ..\build_folder
Should my next steps be the following?
5. Upload 3.2, bpy.pyd and *.dll from C:\blender-git\build_windows_Bpy_x64_vc17_Release\bin\Release to the Windows server. (3.2 in python310, bpy.pyd and *.dll to site-packages)
6. Upload build_folder to the Windows server. Then set the pythonpath environment variable to C:\path\to\build_folder.
7. Profit
Just thought I’d lay out my plan incase anyone else finds this thread in the future. Thank you for all your help and I apologies for all the questions. I really appreciate your time!
Ok awesome, I think I got it to somewhat work. I’m making progress I guess . Pycharm is now recognizing the install_folder as a library root after I set PYTHONPATH = C:\install_folder:
So that’s good I think.
However it still doesn’t recognize bpy as a module with import bpy:
I also noticed that there was no bpy.pyd file in the install_folder, could that be an issue?