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

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.10.0.dev1.tar.gz (38.7 kB view details)

Uploaded Source

Built Distribution

nextmv-0.10.0.dev1-py3-none-any.whl (34.9 kB view details)

Uploaded Python 3

File details

Details for the file nextmv-0.10.0.dev1.tar.gz.

File metadata

  • Download URL: nextmv-0.10.0.dev1.tar.gz
  • Upload date:
  • Size: 38.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for nextmv-0.10.0.dev1.tar.gz
Algorithm Hash digest
SHA256 281fcccea3b07e6a730686339294fcc50c6fd8e5b7ba00ca023bbe7f61566baf
MD5 ff98a264c8a8c835cd98a0901edfb21f
BLAKE2b-256 4b90416e3efe37b362ad83a1e59fe4f658850a6575d282859d1d0115d5b74bd4

See more details on using hashes here.

File details

Details for the file nextmv-0.10.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: nextmv-0.10.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 34.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for nextmv-0.10.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 13dd73949668cea8c19eb2164304a5e1270e83184f9274fb2ace81e0b995e269
MD5 af556db5fe606b5de6c0baab1532e4dc
BLAKE2b-256 2f816d4661251f9d23241e83fd6cd1d743a354b724e0cbb329a5de5c473fc0ee

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