Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Blender] Deploy in ZIP format for Blender-friendly addon installation #59

Open
archibate opened this issue Sep 4, 2020 · 1 comment · May be fixed by #60
Open

[Blender] Deploy in ZIP format for Blender-friendly addon installation #59

archibate opened this issue Sep 4, 2020 · 1 comment · May be fixed by #60

Comments

@archibate
Copy link
Contributor

The traditional addon installation manner for Blender is via ZIP files instead of PyPI.

I recently succeed to deploy taichi_blend as a ZIP file, without using pip, which make the installation easier and less error-prone.

I use the following command for creating a ZIP archive that contains all the requried dependencies:

mkdir Taichi-Blend
pip install taichi taichi_blend -t Taichi-Blend  # install all dependencies of `taichi_blend` to that directory
cp bundle.py Taichi-Blend/__init__.py
zip -r Taichi-Blend.zip Taichi-Blend

The content of Taichi-Blend is:

astor                     easy_install.py           __pycache__
astor-0.8.1.dist-info     include                   setuptools
bin                       __init__.py               setuptools-50.1.0.dist-info
colorama                  numpy                     sourceinspect
colorama-0.4.3.dist-info  numpy-1.19.1.dist-info    sourceinspect-0.0.3.dist-info
dill                      numpy.libs                taichi
dill-0.3.2.dist-info      pkg_resources             taichi-0.6.31.dist-info
_distutils_hack           pybind11                  taichi_blend
distutils-precedence.pth  pybind11-2.5.0.dist-info  taichi_blend-0.0.1.dist-info

And the content of bundle.py is:

import sys
import os

bl_info = {
        ...
}

for p in sys.path:
    bundle_path = os.path.join(p, 'Taichi-Blend')
    if os.path.exists(bundle_path):
        break
else:
    raise Exception('Cannot find Taichi-Blend!')

def register():
    print('Found Taichi-Blend at', bundle_path)
    if bundle_path not in sys.path:
        sys.path.insert(0, bundle_path)  # add our Taichi-Blend to import path so that people can `import taichi`

def unregister():
    if bundle_path in sys.path:
        sys.path.remove(bundle_path)

So, maybe we can apply the same to taichi_elements by:

pip install taichi taichi_elements -t Taichi-Elements

and release the generated Taichi-Elements.zip?

The only difficulty is that different OS use different taichi_core.so, we may have 3 buildbots for Taichi-Elements-linux.zip, Taichi-Elements-win.zip, Taichi-Elements-osx.zip.

@archibate archibate linked a pull request Sep 4, 2020 that will close this issue
@EaryChow
Copy link

EaryChow commented Oct 7, 2020

Why didn't I see this when I made that video ( ̄ェ ̄;)
https://www.bilibili.com/video/BV1rt4y1S7PJ
I made this video without the knowledge of this taichi_blend thing (; ̄д ̄)
I should have included this in that video ( ̄ェ ̄;)

My method in that video was to make use of the pip that comes with Blender instead of downloading another version of pip online.

For taichi_elements , I simply extracted the blender folder and the engine folder, put engine in blender , zip the blender folder and rename it to "taichi_elements", and now this zip file can already be installed using the standard blender-addon way.

I still think my method is useful though. If people want the latest version, they still need to do it manually. My method is simpler than the method described in taichi elements' README.md nevertheless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants