Contribute¶
If you want to contribute to the development of BlenderNC, please submit a pull request to the master branch or dev branch.
Development workflow¶
Download and install Visual Studio Code.
Install Visual Studio Code Add-On
jacqueslucke.blender-development
by searching at the Extensions in Marketplace.Set up your
Blender
executable by pressingctrl+shift+P
->Blender Start
->Choose new blender executable
.Clone BlenderNC source code (BlenderNC repo):
git clone https://github.com/blendernc/blendernc.git
Set up your remotes (i.e.
origin
andupstream
).Initiate a new workspace in the cloned folder.
Voalà! Now you can develop, debug, and modify BlenderNC.
Testing¶
In order to merge into any branch of the BlenderNC repository, all test must pass. Locally testing BlenderNC is really simple, as it uses docker containers by nytimes/rd-blender-docker. Execute the following code from the cloned repository root directory:
docker pull nytimes/blender:latest
docker run -w /addon/blendernc -it --rm --mount type=bind,source="$(pwd)",target=/addon/blendernc -t nytimes/blender:latest /bin/sh -c
If you want more control on each test, you can run an interactive docker container:
docker pull nytimes/blender:latest
docker run -w /addon/blendernc --rm -it --mount type=bind,source="$(pwd)",target=/addon/blendernc -t nytimes/blender:latest /bin/bash
and then run the following code in sections:
#!/bin/sh
$BLENDERPY -m ensurepip --default-pip
$BLENDERPY -m pip install -r requirements.txt --progress-bar off
$BLENDERPY -m pip install coverage --progress-bar off
$BLENDERPY -m pip install -e . --progress-bar off
COVERAGE_PROCESS_START=${PWD}"/.coveragerc"
export COVERAGE_PROCESS_START=$COVERAGE_PROCESS_START
export PYTHONPATH=$PYTHONPATH:${PWD}
cd tests
echo -e "import coverage \n\ncov=coverage.process_startup()\n"> sitecustomize.py
echo -e "print('Initiate coverage')" >> sitecustomize.py
echo -e "print(cov)" >> sitecustomize.py
export PYTHONPATH=$PYTHONPATH:${PWD}
$BLENDERPY run_tests.py
coverage combine
coverage report
coverage xml
Important
Note the flag --mount type=bind,source="$(pwd)"
when using the docker run
command. The source path will be the current working directory. Make sure it corresponds to the root of the cloned repository (i.e. /parent/path/to/blendernc/blendernc
, where /parent/path/to/blendernc
is the parent directory where github clone
created the repository.
Linting¶
BlenderNC currently uses Black , Flake8 and Isort for linting and formatting conformance. These can be applied before committing code on the developer machine using pre-commit. Follow these steps to set up your development environment.
Git commits after this trigger git hooks and perform necessary code-quality checks.