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

Uploaded Source

Built Distribution

nextmv-0.10.0.dev8-py3-none-any.whl (38.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nextmv-0.10.0.dev8.tar.gz
Algorithm Hash digest
SHA256 963751e569b31f15e610751ab25584df9219f99df9a5592a9fef0a3097f44bf3
MD5 f842d17c0a257aec11b738bfa91a9ff7
BLAKE2b-256 ff6ec3a02a7a22ea21f3d2eaeab64eeddd489a8b5b2115b91fd31b22a607a185

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nextmv-0.10.0.dev8-py3-none-any.whl
Algorithm Hash digest
SHA256 ba61c822a3509466abbec30f089636038cf88a227a79c588f464e2359974614f
MD5 0e32d0ba67251d8413a71922d33f54ee
BLAKE2b-256 3bbaefbaa14d1c63e06399ede5ae00f6930596df5c1c57455ef253dfbffd03b7

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