Add plotly run command
Add a command to run dash app from the terminal.
The command can be run two methods:
plotly run app:app --debugpython -m dash run app:app --debug
The arguments follow Dash.run, run help:
$ plotly run --help
usage: plotly run [-h] [--host HOST] [--port PORT] [--proxy PROXY] [--debug | --no-debug | -d] [--dev-tools-ui | --no-dev-tools-ui] [--dev-tools-props-check | --no-dev-tools-props-check]
[--dev-tools-serve-dev-bundles | --no-dev-tools-serve-dev-bundles] [--dev-tools-hot-reload | --no-dev-tools-hot-reload] [--dev-tools-hot-reload-interval DEV_TOOLS_HOT_RELOAD_INTERVAL]
[--dev-tools-hot-reload-watch-interval DEV_TOOLS_HOT_RELOAD_WATCH_INTERVAL] [--dev-tools-hot-reload-max-retry DEV_TOOLS_HOT_RELOAD_MAX_RETRY]
[--dev-tools-silence-routes-logging | --no-dev-tools-silence-routes-logging] [--dev-tools-disable-version-check | --no-dev-tools-disable-version-check] [--dev-tools-prune-errors | --no-dev-tools-prune-errors]
app
Run a local development server for a Dash app.
positional arguments:
app The Dash app to run, in the format "module:variable".
options:
-h, --help show this help message and exit
--host HOST Host IP used to serve the application (Default: "127.0.0.1").
--port PORT, -p PORT Port used to serve the application (Default: "8050").
--proxy PROXY Proxy configuration string, e.g., "http://0.0.0.0:8050::https://my.domain.com".
--debug, --no-debug, -d
Enable/disable Flask debug mode and dev tools.
dev tools options:
--dev-tools-ui, --no-dev-tools-ui
Enable/disable the dev tools UI.
--dev-tools-props-check, --no-dev-tools-props-check
Enable/disable component prop validation.
--dev-tools-serve-dev-bundles, --no-dev-tools-serve-dev-bundles
Enable/disable serving of dev bundles.
--dev-tools-hot-reload, --no-dev-tools-hot-reload
Enable/disable hot reloading.
--dev-tools-hot-reload-interval DEV_TOOLS_HOT_RELOAD_INTERVAL
Interval in seconds for hot reload polling (Default: 3).
--dev-tools-hot-reload-watch-interval DEV_TOOLS_HOT_RELOAD_WATCH_INTERVAL
Interval in seconds for server-side file watch polling (Default: 0.5).
--dev-tools-hot-reload-max-retry DEV_TOOLS_HOT_RELOAD_MAX_RETRY
Max number of failed hot reload requests before failing (Default: 8).
--dev-tools-silence-routes-logging, --no-dev-tools-silence-routes-logging
Enable/disable silencing of Werkzeug's route logging.
--dev-tools-disable-version-check, --no-dev-tools-disable-version-check
Enable/disable the Dash version upgrade check.
--dev-tools-prune-errors, --no-dev-tools-prune-errors
Enable/disable pruning of tracebacks to user code only.
@T4rk1n What do you think about using app as the default variable name if no variable name is provided? So e.g. if you had a file named my_dash_app.py containing an app variable called app, you could just run
plotly run my_dash_app --debug
@T4rk1n For the flags, is there a way to make the helptext clearer to the user about which option is the default? I.e. if I can pass --debug or --no-debug, how do I know what is the default behavior if I pass neither?
For that matter (since I do know that no-debug is the default), what is the use case for the --no-debug flag?
We should be able to detect the app object automatically given a Python file. Here's a pattern to do this: https://github.com/plotly/de-client/blob/main/src/de_client/cli/root.py#L302-L306
@T4rk1n What do you think about using
appas the default variable name if no variable name is provided? So e.g. if you had a file namedmy_dash_app.pycontaining an app variable calledapp, you could just run
plotly run app --debug
Yes that might be more convenient :+1:
@T4rk1n For the flags, is there a way to make the helptext clearer to the user about which option is the default? I.e. if I can pass
--debugor--no-debug, how do I know what is the default behavior if I pass neither?For that matter (since I do know that no-debug is the default), what is the use case for the
--no-debugflag?
Oh, the --no-<option> is added by argparse.BooleanOptionalAction, I didn't notice them before but they don't make much sense since those are flags, I'll see how to remove them.
FYI @LiamConnors , the basic run command will be available in OSS Dash, not exclusive to installing the extension.
@T4rk1n is this still relevant?