Skip to content

Quick Start

By default, Mercury detects all Python notebooks available in the current directory and serves them as web apps. Please run the following command to start the server:

Start Mercury Server
mercury

It should open a web page at localhost:8888 with information that no notebooks were found. If there are no *.ipynb files in the current directory, you should see:

Mercury with no notebooks

Let’s create a first notebook with TextInput widget. The notebook will ask for user name and display welcome message.

# first cell with imports
from mercury import TextInput
# create interactive widget
name = TextInput(label="What is yout name?")
# display widget value
print(f"Hey {name.value}!")

In MLJAR Studio or JupyterLab editor please click on confetti icon in the top toolbar to open a live app preview.

Mercury with no notebooks

Start a server with command:

Terminal window
mercury

If you want Mercury to use a different base directory for notebooks, config.toml, and relative file access, start it like this:

Terminal window
mercury --working-dir /path/to/notebooks

You should see a card with notebook. The title in the card will be the same as notebook filename.

Mercury serving one notebook Mercury with no notebooks