Python UX

The Python SDK API has a few differences from the Node.js version:

The ux module does not contain the url, table, tree, and wait functions. Table and tree are currently provided through JS libraries, wait is not necessary in Python since it has a native facility that can be used.

  • The spinner and progress bar APIs in ux are top-level functions: spinner_start, spinner_stop, progress_bar_start, progress_bar_advance, and progress_bar_stop.


ux.print(text: string): Promise<void>

Display text to the user. Locally, prints to the terminal.


Hello, welcome to the example command


prompt(questions: Question | Question[]): Promise<any>

Request input from the user. A variety of prompt types are available for different kinds of user input, as described on this page. A single call to ux.prompt may be passed a single prompt object or an array of objects; the result will contain answers to all of the prompts passed.


start(text: string): Promise<void>

Start a spinner accompanied with the given message.


stop(text: string): Promise<void>

Stop the currently running spinner, replacing the message with the given text.


See ux.spinner.start above.


init(): ProgressBar

Create a progress bar object representing a single progress bar.


start(length: number, initial: ?number, message: ?string): Promise<void>

Display a progress bar, with length increments of which initial are already ready, and with an accompanying optional message.


increment(amount?: number): Promise<void>

Increments the value of a progress bar by amount increments, or by 1 increment if no argument is provided.


stop(message?: string): Promise<void>

Completes the progress bar, incrementing it to 100% and optionally replacing the message with the given one.