You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
brew install poetry
poetry completions fish >~/.config/fish/completions/poetry.fish
# run this once to create venv and install poe
poetry install
# run to (re)install everything--this is the main install command
poe install
The Big Idea: run Python scripts in Blender from the CLI
# run with UI to work visually
blender -P headless_mode.py # `poe blend`# run without UI to debug (fast)
blender -P headless_mode.py -b # `poe bblend`
butils module
butils abstracts common Blender scripting code and provides CLI commands.
# General help
python -m butils --help
# Install dependencies into Blender's Python environment and symlink `butils`# Run this when new dependencies are added to `butils`.
python -m butils install
# (Alias: poe install-butils)# Create a new Blender starter script
python -m butils create -i my_new_script.py
# (Alias: poe create)# The -i/--input-file flag specifies the name for the new script.# Compress output images and videos# Supported image formats: .png, .jpg, .jpeg# Supported video formats: .mkv, .mp4
python -m butils compress -i path/to/your/file.png
python -m butils compress -i path/to/your/file.mkv --crf 23
# (Alias: poe compress)# Options for 'compress':# -i, --input-file: (Required) Path to the image or video file to compress.# --analyze: (For images only) Get image attrs and metadata. Skips compression.# --crf: Constant Rate Factor. Sets bitrate (e.g., 18-28). Lower is better.# profile GPU performance
pipx run nvitop
# module structure
butils/
├── animation/
│ ├── fcurve.py # Utilities for F-Curves
│ └── keyframe.py # Utilities for keyframes
├── blend_file.py # Work with .blend files
├── btyping/
│ ├── animation.py # Type hints for animation module
│ └── render.py # Type hints for render module
├── commands/ # CLI commands
│ ├── compress/
│ │ ├── image.py # Image compression commands
│ │ └── video.py # Video compression commands
│ ├── install/
│ │ ├── pythonpath.py # Command to set up Python path for Blender
│ │ └── requirements.py # Command to install deps in Blender's Python
│ └── starter/
│ ├── create.py # Command to create a new starter script
│ └── starter_script.py # Boilerplate for scripting a Blender scene
├── mesh.py # Simplify working with meshes
├── render/
│ ├── config.py # Rendering configuration utilities
│ ├── optimize.py # Utilities for optimizing render performance
│ ├── render.py # Core rendering utilities
│ └── update_mask.py # Utilities for updating render masks
├── scene.py # Clean scenes, work with collections
└── ui.py # Work with the Blender UI: get contexts, control viewport
Pre-commit Hooks & Code Quality
This project uses the pre-commit python module to ensure code quality and
consistency. These hooks are automatically installed when you run poe install,
and can be run on demand withnormal maps and texture painting poe pre-commit.
lint and format using ruff, shfmt, shellcheck, and markdownlint,
yamllint, actionlint.
check spelling, trim trailing spaces, add final newline to files.
validate links, scan for large files, warn about any added secrets.
validate json, yaml and toml files.
Unit tests
This project uses Python's built-in unittest module for testing. Tests are
executed within a Docker container that includes Blender, ensuring a consistent
testing environment. This setup is defined in the GitHub Actions workflow file
(.github/workflows/blender_tests.yml).
Running Tests
There are several ways to run the tests:
Locally with act: You can simulate the GitHub Actions environment
locally using act. The pyproject.toml defines a poe task for this:
Refer to the tool.poe.tasks.act section in pyproject.toml and the
workflow_dispatch inputs in .github/workflows/blender_tests.yml for more
details on available parameters.
GitHub Actions: Tests are automatically executed in GitHub Actions on
every push and pull_request to the main branch. You can also manually
trigger the "Blender Tests" workflow from the Actions tab in your GitHub
repository, providing inputs for specific test cases, verbosity, etc.
gh workflow run "Blender Tests" --input testcase=your_test_case --input verbosity=2