Skip to content

03_Status

Thomas Byr edited this page Jun 2, 2026 · 2 revisions

Rich status

  1. Use the global status
    1. Create a new status
    2. Start / stop
    3. Update
  2. Interact directly with each status

This module exposes the rich.status.Status class with some additional functions to make it easier to work with one status at a time (which we will call the global status).

Here, we will import the status module the following way, to still be able to use variable named status:

import nob.status

Use the global status

The global status is not thread-safe.

Create a new status

Use new() to create a new status and set it as the global status.

nob.status.new()

You can also specify the following parameters when creating a new status:

  • text: The text to display in the status. Defaults to "Loading...".
  • spinner: The spinner to use. Defaults to "dots".
  • style: The style of the status text. Defaults to "status.spinner".
  • refresh_per_second: The number of times to refresh the status per second. Defaults to 12.5.
  • speed_factor: The factor by which to adjust the speed of the spinner. Defaults to 1.0.

Start / stop

nob.status.start()
# do some work
nob.status.stop()

or enter a context upon creation:

with nob.status.new():
    # do some work

Update

You can update each status field with new values, except for refresh_per_second.

nob.status.update("New status message")

Interact directly with each status

Upon creation:

status = nob.status.new()

Then, you can interact with the status directly:

with status:
    # do some work
    status.update("New status message")

Or shorter:

with nob.status.new() as status:
    # do some work
    status.update("New status message")

Clone this wiki locally