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.2.0.dev0.tar.gz (30.3 kB view details)

Uploaded Source

Built Distribution

nextmv-0.2.0.dev0-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file nextmv-0.2.0.dev0.tar.gz.

File metadata

  • Download URL: nextmv-0.2.0.dev0.tar.gz
  • Upload date:
  • Size: 30.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for nextmv-0.2.0.dev0.tar.gz
Algorithm Hash digest
SHA256 e651c67dfd3423cc64459413893870d351e88737a31908f646a85684d44d25c8
MD5 65a451c71fe2c22a7f21c0abe7a7b065
BLAKE2b-256 67748f593744b4c2e40d0d044268261dc3aa69b85d0c11df2562b991cec94f0c

See more details on using hashes here.

File details

Details for the file nextmv-0.2.0.dev0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for nextmv-0.2.0.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 b130a6276dc4dfc0bdd74389f72d3b1546bbedfa9ef979837f6f52f2639437ce
MD5 33b365551de9deccc84b60a0b1d0cc00
BLAKE2b-256 18f4d6478dad1b79d29c785135045cd3890ef85f4f2a78ba0de2bac664e231f4

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