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

Uploaded Source

Built Distribution

nextmv-0.1.0-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nextmv-0.1.0.tar.gz
  • Upload date:
  • Size: 30.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for nextmv-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2858fb3ff5fe82606c5128fc86caf373a62647cb39e8fa693af110e72b0a283e
MD5 d20c67fb6baed502f72f42a666a109b6
BLAKE2b-256 d060c4cb51555bd760a57e995a7b16fbfd3a9cf3de669e64715a5cc3e298fc46

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nextmv-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for nextmv-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4b5315304a2056d9650d98645303a576049bfa209e26df65dc69b16cdf1a66a
MD5 3d34717c9d18df1a78c45393b01bdf7f
BLAKE2b-256 f750bef5a54e1be2e97c7a6a6deb2ad58e487c936cef69e5e30d99eb40fb7e93

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