This repository serves as a "starter" repository for creating a new block.
- Clone this repository:
git clone https://github.com/nio-blocks/block_template.git --depth=1 --single-branch -b <branch_name> <new_block_name>
<branch_name>is either "master" or "nio2" depending on the target version for nio
- Go into the directory:
cd <new_block_name> - Remove to template origin:
git remote remove origin - Take ownership of the initial commit:
git commit --amend --reset-author -m 'Initial Commit' - Add new block repo as remote:
git remote add origin [new_block_repo] - Push:
git push --set-upstream origin <remote_branch_name>:<local_branch_name>
- Rename
example_block.pyto whatever your block name will be. We like to keep_blockat the end of filenames that contain blocks. - In your new block Python file, rename the class to the new block's name. Do not put
Blockin the class name - this is implied. - Rename
test_example_block.pyto match your new block's class name. Always submit accompanying unit tests in thetestsfolder. - Rename
BLOCK_README.mdtoREADME.mdand update the documentation accordingly.
- example_block.py : This is the block code. Additional Python classes and files are definitely welcome. If the file contains a Block class, make sure the filename ends with
_block.py. If the file represents a Base Block that is not discoverable by itself, have the filename end with_base.py. - requirements.txt : List out any Python dependencies this block requires. This file will be installed by pip when the block is installed. The command for installing the dependencies is
pip install -r requirements.txt.