Assembly provides a CLI tool and framework based on Click library

Extension: Click


Upon installing Assembly via pip install assembly, two commands will be available for the command line:

  • asm: for custom command list
  • asm-admin: for Assembly specific commands

Admin CLI: asm-admin

This command allows you to access Assembly specific commands


To initialize Assembly for the first time in the current directory

cd my-dir
asm-admin init


To run the development server.

asm-admin serve

or changing environment

export ASSEMBLY_ENV=Staging 
asm-admin serve

or changing environment and app

export ASSEMBLY_ENV=Testing
export ASSEMBLY_APP=api
asm-admin serve


To sync database models to create new tables. Models that extended db.Model will be created.

asm-admin sync-models


To create a view that can be used as API endpoint

asm-admin gen-api-view $view-name


asm-admin gen-api-view api

It will create a new view at the root.


To create a view that contains template

asm-admin gen-template-view $view-name


asm-admin gen-api-view admin

It will create a new view admin at the root.


If you are serving your assets via CDN or S3, you need to upload them before deploying the application.

When config.ASSETS_DELIVERY_METHOD is S3, this util will allow you to upload your assets to S3, and the application will automatically point all your assets to S3.

asm-admin upload-assets-s3


Return the version of Assembly

asm-admin version

Custom CLI: asm

Assembly also allows you to create your own CLI scripts, to use with your application.

You probably need CLI to run some routines and setup outside of the web environment, ie: setup database, run worker/task, cronjob, scheduler, etc...

1. Create CLI Functions

Assembly CLI is based on Click library.

Inside of your view, create (named so for discoverability).

NOTE: @command is the alias to the custom command. Use it, otherwise your CLI scripts won't be available.

Learn more about Click

# main/

from assembly.cli import (command, option, argument, click)

def hello():
  print("Hello world!")

def do_something(name):
  print("Hello %s" % name)

2. Import in


from assembly import Assembly

#->>> Import your CLI in the
import admin.cli

APPS = {
    "default": [

app = Assembly.init(__name__, APPS)

3. Execute Commands

Commands can easily be executed by invoking asm followed by the name of the function that had @command


# main/

from assembly.cli import (command, option, argument, click)

def hello():
  print("Hello world!")

>> asm hello

def do_something(name):
  print("Hello %s" % name)

>> asm do-something Assembly

it will print out: `Hello Assembly`