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.10. 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.3.0.tar.gz (30.5 kB view details)

Uploaded Source

Built Distribution

nextmv-0.3.0-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nextmv-0.3.0.tar.gz
  • Upload date:
  • Size: 30.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for nextmv-0.3.0.tar.gz
Algorithm Hash digest
SHA256 5b176a94bb24d8e9b191825a7b50f53f10fc8d11c1193949a487106864c8b9d6
MD5 260dbe6524412984fb558d547e820526
BLAKE2b-256 beca3bf4fbc8494497213044309b97e6d10e61a8e2f71687fef37dc52448cbb3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nextmv-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 27.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for nextmv-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 080166d3a2662f4d4fa701b8c6a3bbfdbfdf1f58a37a467a54888b251e06a0e0
MD5 f2a372bdc26f6bfce3df893b9b41a5c8
BLAKE2b-256 594ff442118c029b5715b6d24af9b9c9fff10936a80d0907d44f30514de6118a

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