Skip to main content

The Python SDK for Nextmv

Project description

Nextmv Python SDK

This is the Python SDK for the Nextmv Platform. Before starting:

  1. Sign up for a Nextmv account.
  2. Get your API key. Go to Team > API Key.

Visit the docs for more information.

Installation

Requires Python >=3.8. Install using pip:

pip install nextmv

Usage

Make sure that you have your API key set as an environment variable:

export NEXTMV_API_KEY="<YOUR-API-KEY>"

Additionally, you must have a valid app in Nextmv Cloud.

  • Make a run and get the results.
import os

from nextmv.cloud import Application, Client, PollingOptions

input = {
    "defaults": {"vehicles": {"speed": 20}},
    "stops": [
        {
            "id": "Nijō Castle",
            "location": {"lon": 135.748134, "lat": 35.014239},
            "quantity": -1,
        },
        {
            "id": "Kyoto Imperial Palace",
            "location": {"lon": 135.762057, "lat": 35.025431},
            "quantity": -1,
        },
    ],
    "vehicles": [
        {
            "id": "v2",
            "capacity": 2,
            "start_location": {"lon": 135.728898, "lat": 35.039705},
        },
    ],
}

client = Client(api_key=os.getenv("NEXTMV_API_KEY"))
app = Application(client=client, id="<YOUR-APP-ID>")
result = app.new_run_with_result(
    input=input,
    instance_id="latest",
    run_options={"solve.duration": "1s"},
    polling_options=PollingOptions(),  # Customize the polling options.
)
print(result.to_dict())

Project details


Release history Release notifications | RSS feed

This version

0.5.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nextmv-0.5.0.tar.gz (30.8 kB view details)

Uploaded Source

Built Distribution

nextmv-0.5.0-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

Details for the file nextmv-0.5.0.tar.gz.

File metadata

  • Download URL: nextmv-0.5.0.tar.gz
  • Upload date:
  • Size: 30.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for nextmv-0.5.0.tar.gz
Algorithm Hash digest
SHA256 a22f1e5b0ee14f672bbe2d80a5f8ac78a748b67e99170fe3fb55e73cf9d3f75e
MD5 2eeae640fe45c294e8118dad7a0cf6b9
BLAKE2b-256 aa678daca81a4e7c926f4886ca9e326b93d2b40e632f5a83a8b98e0a633103f2

See more details on using hashes here.

File details

Details for the file nextmv-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: nextmv-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 28.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for nextmv-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f944e3fdf3fbeec6c7b0a6de6bbb1281bb7b2be5780a4c3b2f2f460e072bd71e
MD5 3b16d37439428c1ff0b2db204d9e8f88
BLAKE2b-256 85747cb7193a59bc3dc0b0194a69848f322397d77d35a661163443b7eb10f77c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page