run command
Run a single-file Tethys component app with zero configuration ("express mode"). Inspired by tools like shiny run and streamlit run, this command lets you go from a single Python file to a running app in one step — no portal configuration, no database setup, no pip install, and no login required.
Important
This command only supports Component Apps. Classic template-based apps are not supported.
Quick Start
Create a file called app.py:
from tethys_sdk.components import ComponentBase
class App(ComponentBase):
name = "My Dashboard"
@App.page
def home(lib):
return lib.tethys.Display(
lib.tethys.Map()
)
Then run it:
tethys run
The first run initializes an isolated environment for the app (a few seconds); then your default browser opens directly to the running app. Edits to app.py are picked up automatically while the server is running.
As your app grows, you can move its page code into the app.py of a scaffolded component app project and add the normal app metadata required by a full Tethys Portal (see scaffold command and the Component App Basics tutorial).
How It Works
tethys run reuses the standard Tethys Portal runtime, configured down to serve a single app:
An isolated
TETHYS_HOMEis created for each app at~/.tethys/express/<package>_<hash>/, keyed by the absolute path of the app file. It contains a generatedportal_config.yml(single-app mode withENABLE_OPEN_PORTAL) and a SQLite database that is migrated automatically. Your normal portal configuration inTETHYS_HOMEis not touched.The app file is loaded directly into the
tethysappnamespace at server startup — it does not need to be installed as a package.The app is served at the site root with no login required (open portal mode). State is preserved between runs of the same file; use
--cleanto start fresh.
Because the standard portal machinery is used unchanged, an app developed with tethys run behaves identically when installed in a full Tethys Portal.
Arguments
usage: tethys run [-h] [-p PORT] [--host HOST] [--no-browser] [--no-reload]
[--clean]
[app_file]
Positional Arguments
- app_file
Path to the single-file app to run. Defaults to "app.py" in the current directory.
Default:
'app.py'
Named Arguments
- -p, --port
Port on which to serve the app. Defaults to 8000.
Default:
8000- --host
Host on which to serve the app. Defaults to 127.0.0.1.
Default:
'127.0.0.1'- --no-browser
Do not open the app in a web browser after starting the server.
Default:
False- --no-reload
Do not restart the server when the app file changes.
Default:
False- --clean
Discard the app's saved state (database and generated config) before running.
Default:
False
Examples
# Run app.py from the current directory
tethys run
# Run a specific file on a specific port without opening a browser
tethys run my_dashboard.py -p 8080 --no-browser
# WARNING: Express mode enables DEBUG and an open portal; use this only on a trusted network.
# Serve on all interfaces (e.g. to share on a local network)
tethys run --host 0.0.0.0 -p 8080
# Discard the app's saved state (database and generated config) and start fresh
tethys run --clean
# Disable automatic restart on file changes
tethys run --no-reload