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