Giter Club home page Giter Club logo

bpy_lambda's Introduction

bpy_lambda

๐ŸŽฅ A compiled binary of Blender-as-a-Python-Module (bpy) for use in AWS Lambda

PyPI version

Installation

pip install bpy_lambda

Works great with Zappa!

Usage

bpy_lambda is a simple wrapper around the bpy. You can read more about bpy usage in the Blender Documentation.

from bpy_lambda import bpy

# bpy can be used normally!
bpy.ops.mesh.primitive_cube_add(location=(0, 0, 0))
cube = bpy.context.scene.objects.active
cube.scale = (1, 2, 3)
bpy.ops.export_scene.obj(filepath='my_model.obj')

bpy_lambda will only work in a Lambda environment (perhaps some linux distros as well, if you have a similar set of library versions to AWS Lambda).

For local development, it will be useful to install bpy normally with the instructions on the Blender website. (Unfortunately, this requires building from source).

With a local version of bpy installed, you can use this code to switch seamlessly between your local environment and Lambda:

try:
    import bpy
except ImportError:
    from bpy_lambda import bpy

Contribution / Building from Source

The Dockerfile is the easiest way to create a version of bpy that works on Lambda. Building this docker image will download the necessary libraries and compile a minimal version of Blender that works in a Lambda environment.

For easy installation / local setup, run ./build.sh. This will create a directory called bpy_lambda that contains all the necessary package files.

Running ./test.sh will spin up a test Lambda invocation (using the excellent lambci/docker-lambda). Any import or dependency errors should be caught by this test.

bpy_lambda's People

Contributors

bcongdon avatar dix-icomys avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.