Example for running a Python application on the Nextmv Platform using the Hexaly solver. We solve a knapsack Mixed Integer Programming problem.
If you have a Hexaly license, remove the .template extension from the
license.dat.template file and replace the contents with your actual license
key. Modify the app.yaml file to include the license.dat in the files list.
-
Install packages.
-
With
pippip install -r requirements.txt
-
With
uvuv sync
-
-
Run the app.
-
With
pythoncat input.json | python main.py -
With
uvcat input.json | uv run main.pyOr with custom options:
cat input.json | uv run main.py -duration 30
-
Docker needs to be installed.
To run the application in the same Docker image as the one used on Nextmv Cloud, you can use the following command:
docker run -i --rm \
-v $(pwd):/app ghcr.io/nextmv-io/runtime/python:3.11 \
sh -c 'pip install -r /app/requirements.txt && python3 /app/main.py -input input.json -output output.json -duration 30'You can also debug the application by running it in a container by
using the command Dev Containers: Reopen in Container.