A Visual Studio Code project to develop, test, and profile Blender add-ons
blenderaddons-ng focuses on modern, automated testing of Blender add-ons, with an emphasis on creating and running unit tests for core add-on functionality, rather than just interactive testing. The repository provides a clean, reproducible development environment for building, testing, profiling, and benchmarking Blender add-ons.
This project is the next generation of the blenderaddons repo, designed for better structure, automation, and developer experience.
pytest
and pytest-cov
, integrated with GitHub
Actions.line_profiler
and
pytest-benchmark
.
__init__.py
.pytest
-discoverable tests, prefixed with test_
.git clone https://github.com/varkenvarken/blenderaddons-ng.git
cd ./blenderaddons-ng
Open the folder in VS Code. If prompted, rebuild the DevContainer, or select "Rebuild Container" from the command palette to begin developing.
bpy
module from PyPI (headless Blender)fake-bpy-module
for VS Code type checkingpytest-cov
for test coveragepytest-benchmark
for benchmarkingline_profiler
for profilingSee requirements.txt and the Dockerfile for details.
add_ons/example_simple.py
to add_ons/<new_name>.py
as a starting
point.bl_info
dictionary and OPERATOR_NAME
variable.
tests/test_example_simple.py
to tests/test_<new_name>.py
and write
thorough tests.Use line_profiler to profile operators. Example:
LINE_PROFILE=1 python3 add_ons/example_simple.py
Expensive code should be factored out from execute()
for profiling.
Use pytest-benchmark to measure performance. Example:
pytest-benchmark compare 0001 0002
Example benchmarks are in tests/test_example_simple.py
. Results are stored in
.benchmarks
(gitignored).
Pull requests for improvements or new add-ons are welcome! Please ensure that your contributions:
See the GitHub repository for more details and to get involved.
This project is open source and available under the GPL v3 or later.