Skip to content

CLI Plugins

CLI Plugins provide default handling for the most common lifecycle events during Mountaineer development. Import these if convenient, otherwise you can follow our implementation approaches to implement your own.

Webapp CLI

mountaineer.cli.handle_runserver

handle_runserver(
    *,
    package,
    webservice,
    webcontroller,
    host="127.0.0.1",
    port,
    subscribe_to_mountaineer=False
)

Start a local development server. This will hot-reload your browser any time your frontend or backend code changes.

PARAMETER DESCRIPTION
package

Ex. "ci_webapp"

TYPE: str

webservice

Ex. "ci_webapp.app:app"

TYPE: str

webcontroller

Ex. "ci_webapp.app:controller"

TYPE: str

port

Desired port for the webapp while running locally

TYPE: int

subscribe_to_mountaineer

See handle_watch for more details.

TYPE: bool DEFAULT: False

mountaineer.cli.handle_watch

handle_watch(
    *,
    package,
    webcontroller,
    subscribe_to_mountaineer=False
)

Watch the file directory and rebuild auto-generated files. This only creates the frontend files necessary to get server-side typehints. It doesn't build the package for production use.

PARAMETER DESCRIPTION
package

Ex. "ci_webapp"

TYPE: str

webcontroller

Ex. "ci_webapp.app:controller"

TYPE: str

subscribe_to_mountaineer

If True, will subscribe the local build server to changes in the mountaineer package. This is useful when doing concurrent development in mountaineer and a client package. Rarely used otherwise.

TYPE: bool DEFAULT: False

mountaineer.cli.handle_build

handle_build(*, webcontroller, minify=True)

Creates a production bundle of frontend files that is ready for service.

Building your app will compile your TypeScript into the client-side bundle that will be downloaded by the browser. It also ahead-of-time generates the server code that will be run as part of SSR. You'll want to do it before deploying your application into production - but since a full build can take up to 10s, handle_runserver provides a better workflow for daily development.

PARAMETER DESCRIPTION
webcontroller

Ex. "ci_webapp.app:controller"

TYPE: str

minify

Minify the JS bundle, strip debug symbols

TYPE: bool DEFAULT: True

Building your app will compile your TypeScript into the client-side bundle that will be downloaded by the browser. It also ahead-of-time generates the server code that will be run as part of SSR. You'll want to do it before deploying your application into production - but since a full build can take up to 10s, handle_runserver provides a better workflow for daily development.

Database CLI

mountaineer.database.cli.handle_createdb async

handle_createdb(*args, **kwargs)

Strictly speaking, passing a list of models isn't required for this function. We'll happily accept being called with handle_createdb(). We just encourage an explicit passing of either the models module or the SQLModels themselves to make sure they are in-scope of the table registry when this function is run. This is how we determine which tables to create at runtime.

PARAMETER DESCRIPTION
model_module

The module containing the SQLModels to create

models

An explicit list of SQLModels to create