Login
Back to bricks list
Introduction Version

Create a brick


Creation of a brick


The skeleton brick is provided to ease the creation of new Constellab brick.


To create a new brick, please open your codelab.


In the launch section, search for Create brick launcher. Provide you brick name and its done !





A new folder (with the same name as our brick) will be created in the /lab/user/bricks folder. This is your brick ! You can start writing your tasks, resources under the src/[brick_name] folder.


The brick is created with some tasks, resources and tests example. If you are used to thoses, you can simply delete them.



You can restart you lab and check in the monitoring section that your brick is loaded. You should also see the example objects in the playground.



Source folder


Your brick must contain a src folder containing a sub folder named after your brick. This is required because all the files under sur /src/[brick_name] folder are loaded on lab start so your object are available.



Brick structure


The structure of your new brick should be


[brick_name]
    ├── LICENSE
    ├── README.md
    ├── manage.py
    ├── settings.json
    ├── src
    │   â””── [brick_name]
    │       â”œâ”€â”€ __init__.py
    ├── tests
    │   â”œâ”€â”€ __init__.py


Brick description and publication


It is highly recommended to describe your brick before publishing it. To describe your brick, you only need to fill the file README.md.



Git versioning and publication


It is currently recommended to version and publish your brick using git. Any remote git server such as Github or Gitlab is compatible with Constellab.


PIP publication


In the next future, it will be possible to publish brick using pip.



Work on an existing brick


To work on an existing brick you will need to clone it on your codelab in the /lab/user/bricks folder. If the brick already exist in your lab, don't worry the folder /lab/user/bricks is used in priority and the other will be ignored.