The Python SDK for Nextmv
Project description
Nextmv Python SDK
This is the Python SDK for the Nextmv Platform. Before starting:
- Sign up for a Nextmv account.
- 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.1.tar.gz
(30.4 kB
view details)
Built Distribution
nextmv-0.2.1-py3-none-any.whl
(27.8 kB
view details)
File details
Details for the file nextmv-0.2.1.tar.gz
.
File metadata
- Download URL: nextmv-0.2.1.tar.gz
- Upload date:
- Size: 30.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66a60c4749e87f63d0ae905c44b2459cd49b7fe7c5b92a5411e7d6aa9729dd0b |
|
MD5 | 9f0e1e276cc5c78d2d74949fb72e2b81 |
|
BLAKE2b-256 | 86d0431a24f4efdafa3107973f36c2f142d134e76f49d6c087aaec0886f41adb |
File details
Details for the file nextmv-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: nextmv-0.2.1-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.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cab3d0278919ee36cd99414ec7731470f5c0655076a1eab98fdcc4dead26582 |
|
MD5 | 4c86174d9f79d03728bcde78752f6c62 |
|
BLAKE2b-256 | d857b7c68d33229256b8f459c87860a5d30b93b8ff8839ed9e059fbd332b1ffb |