Skip to content

nio-blocks/block_template

Repository files navigation

Block template

The block template is a base template used to create a new block type with the recommended files and file structure.


How to use

The nio-cli newblock command creates a custom block from this repository. This command clones the project, renames all of the example files, and sets the initial commit for your new block.

Run this command from the blocks/ directory of your nio project.

nio newblock <new_block>

If you need to first create a nio project, use the nio-cli nio-new command

nio new <new_project>

For more information about your project directory, refer to the project_template repository at https://github.com/niolabs/project_template


File reference

<new_block>_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 (a block type that is not intended to be discoverable by itself), rename the filename to end with _base.py.

BLOCK_README.md
This readme should include requirements, installation notes, and other information that a developer may need, to be displayed on the block's repository on github. Documentation on block usage should be inside docs/. Before pushing your block code to github, rename to README.md overwriting this readme.

docs/example_block.md
Every discoverable block class should have a matching README file here.

requirements.txt
Lists required Python dependencies. The file is installed by pip when the block is installed. To install the dependencies manually, enter pip install -r requirements.txt.

release.json
Contains release data for one or more blocks.

spec.json
Defines the specification for a block type. This is the metadata which is used for block discovery.

tests/test_<new_block>_block.py
The tests folder contains a sample test file. Be sure to submit accompanying unit tests with your blocks.

About

A template for creating new blocks

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages