Install Writer Framework and run the demo app

Writer Framework works on Linux, Mac, and Windows. Python 3.9.2 or higher is required. We recommend using a virtual environment.

1

Install Writer Framework

Use the following command to install the Writer Framework using pip. Open your command line interface and type:

pip install writer

This will download and install Framework and all its required dependencies.

2

Start demo application

Once the installation is complete, you can create a demo application and start the Framework. To do this, navigate to your desired directory and run:

writer hello

This command creates a subfolder named hello and initiates the Framework, which opens a visual editor accessible through a local URL displayed in your command line.

Create an app

You can use the command writer create, which will create a placeholder app in the path provided.

writer create [path]

# Creates a new app in folder "testapp"
writer create testapp

A Framework app is a folder with the following items.

  1. main.py - The entry point for the app. You can import anything you need from here.
  2. .wf/ - This folder contains the UI component declarations. Maintained by the Writer Framework’s visual editor.
  3. static/ - This folder contains front-end static files which you might want to distribute with your app. For example, images and stylesheets.

Start the editor

You can use the command writer edit.

writer edit [path]

# Edit the application in subfolder "testapp"
writer edit testapp

This command will provide you with a local URL which you can use to access the Builder.

It’s not recommended to expose Framework to the Internet. If you need to access the Builder remotely, we recommend setting up an SSH tunnel. By default, requests from non-local origins are rejected, as a security measure to protect against drive-by attacks.

If you need to disable this protection, use the flag --enable-remote-edit.

The editor starts by default on port 4005. If you launch multiple editors in parallel and do not specify a port, Writer Framework will automatically assign the next port until reaching the limit of 4099.

Run an app

When your app is ready, execute the run command, which will allow others to run, but not edit, your Framework app.

writer run my_app

Your app starts by default on port 3005. If you launch multiple apps in parallel and do not specify a port, Writer Framework will automatically assign the next port until reaching the limit of 3099.

You can specify a port and host. Specifying --host 0.0.0.0 enables you to share your application in your local network.

writer run my_app --port 5000 --host 0.0.0.0

Run as a module

If you need to run Framework as a module, you can use the writer.command_line module.

python -m writer.command_line run my_app

Deploying to Writer cloud

Writer provides a quick and fast way to deploy your apps via the Writer cloud.

writer deploy <my_app_name>

You’ll be asked to enter your API key. To find your key, log in to your AI Studio account and either create a new framework app by going through the create app workflow or choose an existing framework app from your home screen. For other deployment options, see Deploy with Docker.