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 is coded using the following linters for formatting conformance:
Black ,
These can be applied before committing code on the developer machine using pre-commit. Follow these steps to set up your development environment.
pip install pre-commit
pre-commit install
Make sure to install commitlint is installed by doing:
npm install --save-dev @commitlint/{cli,config-conventional}
pre-commit install --hook-type commit-msg
otherwise, the pre-commit
will fail with the following error:
Error: Cannot find module "@commitlint/config-conventional" from "/blendernc"
Before commiting or creating a PR, it is recommended to execute:
pre-commit
or
pre-commit run --all-files
to skip skipping of files.
Important
Commits and PR’s pushed into branches master
, dev
or distribution
trigger github actions and perform necessary code-quality checks.
Distribution¶
Distribution of the BlenderNC is automatic updated through github actions when commits and PR’s are pushed into the branches master
, dev
or distribution
.
BlenderNC releases to PyPi are automated by using poetry, semantic-release, and python-semantic-release, through github actions that determine the next version number, generate the release notes and publishe the package to PyPi. For more information on the CI integration of semantic-release see ./github/workflows/release.yml
Aditionally, a compressed BlenderNC release is publised to blendernc-zip-install
when commits and PR’s are pushed into the branches master
, dev
or distribution
. This compressed release can be used to manually install BlenderNC in Blender. For more information on the CI integration of zip releases see ./github/workflows/ci.yml