โ๏ธ Approximate time to complete: 10 min.
In this tutorial you will scaffold a new Nextmv application from a template using nextmv init, run it locally, and inspect the results. Complete this tutorial if you:
- Are new to Nextmv and want the fastest path to a working app.
- Are fluent using Python ๐.
At a high level, this tutorial will go through the following steps:
- Install the Nextmv CLI.
- Scaffold an app with
nextmv init. - Inspect the scaffolded files.
- Run the app locally.
- Get the results.
Let's dive right in ๐คฟ.
1. Install the CLI
Install the Nextmv CLI:
To verify the installation, run:
2. Run nextmv init
The nextmv init command interactively scaffolds a new Nextmv application. Run it from the directory where you want to create your app:
Walk through the prompts as follows:
- Template โ start from a pre-built template (vs. wrapping an existing model).
- Python โ the language for your app. Go and Java are also available.
- JSON โ the content format for input and output. Multi-file is also available for CSV/Excel workflows.
.โ the path where files will be created (default is the current directory).
The command scaffolds the app, installs dependencies, and registers it as a local application.
The nextmv init command is interactive and uses prompts to guide you. Each step can be skipped with "Maybe later" if you want to come back to it.
3. Inspect the scaffolded files
After running nextmv init, you should see the following files:
The two most important files are:
app.yamlโ the app manifest. It tells the Nextmv CLI which files belong to your app, the runtime to use, and what options are available.main.pyโ the entrypoint. The default template reads data frominput.jsonand returns a solution. Replace this logic with your own decision model.
4. Run locally
Use the Nextmv CLI to run your app locally. Make sure you are in the directory that contains app.yaml:
The CLI executes main.py with the provided input, stores the result locally, and returns a run ID.
Local runs are tracked in ~/.nextmv/runs/ and can be synced to Nextmv Cloud later.
5. Get results
Use the run ID from the previous step to retrieve the output:
The output follows the standard Nextmv result schema:
optionsโ the configuration used for the run.solutionโ the result produced by your model.metricsโ run metrics or KPIs about your result.assetsโ visualizations or other files produced by the run (see the custom visualizations tutorial).
6. Next steps
You now have a working Nextmv application running locally. From here you can:
- Replace the template logic in
main.pywith your own decision model. - Sync local runs to the cloud with
nextmv local app sync. - Push your app to run remotely with
nextmv cloud app push.
For more detailed walkthroughs, check out these tutorials:
๐๐๐ Congratulations, you have finished this tutorial!