Skip to content

Installing

If you are familiar with setting up a Python environment, then run the following command in your terminal:

$ pip install mesop

If you're not familiar with setting up a Python environment, follow one of the options below.

Colab is a free hosted Jupyter notebook product provided by Google.

Try Mesop on Colab: Open In Colab

B. Command-line

If you'd like to run Mesop locally on the command-line, follow these steps.

Pre-requisites: Make sure you have Python version 3.10 or later installed by running:

python --version

If you don't, please download Python.

Create a venv environment

  1. Open the terminal and navigate to a directory: cd foo

  2. Create a virtual environment by using venv, which will avoid Python environment issues. Run:

python -m venv .venv
  1. Activate your virtual environment:

    • macOS and Linux:

      source .venv/bin/activate
      
    • Windows command prompt:

      .venv\Scripts\activate.bat
      
    • Windows PowerShell

      .venv\Scripts\Activate.ps1
      

Once you've activated the virtual environment, you will see ".venv" at the start of your terminal prompt.

  1. Install mesop:
$ pip install mesop

Make sure your Python environment is setup correctly by running a hello world app.

Copy the following hello world code into a file hello_world.py:

hello_world.py
import mesop as me


@me.page()
def app():
  me.text("Hello World")

Then run the following command in your terminal:

$ mesop hello_world.py

Open the URL printed in the terminal (i.e. http://localhost:32123) in the browser to see your Mesop app loaded.

If you make changes to the code (e.g. change "Hello World" to "Hi"), the Mesop app should be automatically hot reloaded.