Skip to content
This repository was archived by the owner on Nov 15, 2021. It is now read-only.

Commit c8cf46c

Browse files
committed
Updated README
1 parent 9b90c67 commit c8cf46c

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

README.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,49 @@
11
# bpy_lambda
2-
A compiled binary of Blender-as-a-Python-Module (bpy) for use in AWS Lambda
2+
🎥 A compiled binary of Blender-as-a-Python-Module (bpy) for use in AWS Lambda
3+
4+
[![PyPI version](https://badge.fury.io/py/bpy_lambda.svg)](https://badge.fury.io/py/bpy_lambda)
5+
6+
## Installation
7+
8+
```sh
9+
pip install bpy_lambda
10+
```
11+
12+
Works great with [Zappa](https://github.com/Miserlou/Zappa/)!
13+
14+
## Usage
15+
16+
`bpy_lambda` is a simple wrapper around the `bpy`. You can read more about `bpy` usage in the [Blender Documentation](https://docs.blender.org/api/current/).
17+
18+
```python
19+
from bpy_lambda import bpy
20+
21+
# bpy can be used normally!
22+
bpy.ops.mesh.primitive_cube_add(location=(0, 0, 0))
23+
cube = bpy.context.scene.objects.active
24+
cube.scale = (1, 2, 3)
25+
bpy.ops.export_scene.obj(filepath='my_model.obj')
26+
```
27+
28+
`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).
29+
30+
For local development, it will be useful to install `bpy` normally with the [instructions](https://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule) on the Blender website. (Unfortunately, this requires building from source).
31+
32+
With a local version of `bpy` installed, you can use this code to switch seamlessly between your local environment and Lambda:
33+
34+
```python
35+
try:
36+
import bpy
37+
except ImportError:
38+
from bpy_lambda import bpy
39+
```
40+
41+
### A Note about Cycles
42+
43+
The Cycles rendering engine is not included in this version of `bpy` because of the dependencies it needs to bring in. It's possible that support will be added in `bpy_lambda` for Cycles in the future if there is interest, but for now you will see an exception when you import `bpy` noting that Cycles is not found.
44+
45+
## Contribution / Building from Source
46+
47+
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.
48+
49+
This dockerfile will produce a build artifact in `/bpy_lambda`. Copy all the files in this folder, add the `__init__.py` from the `bpy_lambda` Github repo into this directory, and you have a full version of `bpy_lambda`.

0 commit comments

Comments
 (0)