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.4.1.tar.gz (30.7 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nextmv-0.4.1.tar.gz
Algorithm Hash digest
SHA256 97b8388ea7df080ec7ed8086cbacdf42a111fb0c953eff4d03a1db0e2f69eed4
MD5 b118b922e96174b519d6432d14131e38
BLAKE2b-256 16803494a7a847b555abff0e39c6bd898f9b3c3852c33913a8fbbba48750feb4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nextmv-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 27.9 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.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 32e1844eb9a20217bb1aef7db9b9ae878ca450e26bc22e884778def7793b44b5
MD5 7bc67a3ce909e09c2f6abb8be4b8496d
BLAKE2b-256 a6b0b4ff96d1be482049fc55a73d63cba1d99b325d27d920d488e5bbad0ff7b3

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