Skip to main content

Python bindings for the osrm-backend project

Project description

osrm-bindings

Push Master osrm-bindings version

osrm-bindings is a Python package that binds to osrm-backend using nanobind.

[!WARNING] osrm-bindings on Windows might not support map matching. See this issue on progress.


PyPI

pip install osrm-bindings

[!NOTE] On PyPI we only distribute abi3 wheels for each platform, i.e. one needs at least Python 3.12 to install the wheels. Of course it'll fall back to attempt an installation from source.

Platform Arch
Linux x86_64
MacOS x86_64
Windows x86_64

From Source

osrm-bindings is (likely, didn't check) supported from CPython 3.10+ on, and can be installed from source via running the following command in the source folder:

pip install .

OSRM Version

When building from source, the OSRM upstream version is controlled by OSRM_GIT_REPO & OSRM_GIT_TAG in pyproject.toml:

[tool.scikit-build.cmake.define]
OSRM_GIT_REPO = "https://github.com/nilsnolde/osrm-backend"
OSRM_GIT_TAG = "de8a9da93aa09a4943d3964f0fb378a01a66af49"

This accepts any git commit hash, branch name, or tag. To override it without editing the file, pass it as a config setting at install time:

pip install . --config-settings cmake.define.OSRM_GIT_TAG=<commit/tag/branch>

Example

The following example will showcase the process of calculating routes between two coordinates.

First, import the osrm library, and instantiate an instance of OSRM:

import osrm

# Instantiate osrm_py instance
osrm_py = osrm.OSRM("./tests/test_data/ch/monaco.osrm")

Then, declare RouteParameters, and then pass it into the osrm_py instance:

# Declare Route Parameters
route_params = osrm.RouteParameters(
    coordinates = [(7.41337, 43.72956), (7.41546, 43.73077)]
)

# Pass it into the osrm_py instance
res = osrm_py.Route(route_params)

# Print out result output
print(res["waypoints"])
print(res["routes"])

Type Stubs

The file src/osrm/osrm_ext.pyi contains auto-generated type stubs for the C++ extension module. These are used by IDEs for autocompletion and by mkdocstrings to build documentation without compiling the extension.

After changing C++ bindings, rebuild the project to regenerate the stubs:

pip install -e .

Then commit the updated .pyi file. CI will verify that committed stubs are up to date.

Documentation

Documentation Page

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

osrm_bindings-0.3.0-cp312-abi3-win_amd64.whl (4.7 MB view details)

Uploaded CPython 3.12+Windows x86-64

osrm_bindings-0.3.0-cp312-abi3-manylinux_2_28_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ x86-64

osrm_bindings-0.3.0-cp312-abi3-manylinux_2_28_aarch64.whl (5.8 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ ARM64

osrm_bindings-0.3.0-cp312-abi3-macosx_15_0_arm64.whl (19.7 MB view details)

Uploaded CPython 3.12+macOS 15.0+ ARM64

File details

Details for the file osrm_bindings-0.3.0-cp312-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for osrm_bindings-0.3.0-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 5e2c3698b99ec48d964b6410f90779c4b5f807f3d14c4a1f97f139ed9847472d
MD5 1ed639b16912f9be88fb78328ca97cb8
BLAKE2b-256 58c7ffc551a6a3c4ac1f42399dc79d8857e57e00f51cc0ea220a2347ee2da856

See more details on using hashes here.

Provenance

The following attestation bundles were made for osrm_bindings-0.3.0-cp312-abi3-win_amd64.whl:

Publisher: publish_wheels.yml on nilsnolde/osrm-bindings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file osrm_bindings-0.3.0-cp312-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for osrm_bindings-0.3.0-cp312-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e3aba9a3ed81c7574049d88a7a7fabebe3cdd32a02595b5dbe2c1f030384b9c8
MD5 0b74bf2b71ea67a2a0359625370f93cf
BLAKE2b-256 5476882963991f99ab1ca71b0d9b6d99e9f6064e74818b2b475480bd7f7ab912

See more details on using hashes here.

Provenance

The following attestation bundles were made for osrm_bindings-0.3.0-cp312-abi3-manylinux_2_28_x86_64.whl:

Publisher: publish_wheels.yml on nilsnolde/osrm-bindings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file osrm_bindings-0.3.0-cp312-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for osrm_bindings-0.3.0-cp312-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f36a8078ca0eb8af78cbe6f71ef1f9b9f61e1ac33aaee0abfed0c58737fde293
MD5 6ab9e7dbad4c0e48b4b6111bcc9d374c
BLAKE2b-256 2c5392cc69768d875e2edab44a75561babbca4af5a9f9238f3c010f4503451ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for osrm_bindings-0.3.0-cp312-abi3-manylinux_2_28_aarch64.whl:

Publisher: publish_wheels.yml on nilsnolde/osrm-bindings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file osrm_bindings-0.3.0-cp312-abi3-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for osrm_bindings-0.3.0-cp312-abi3-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 35ebdbfb6dd3f5d20771c6088e515d391a803f9273311d1079b98679bea17cf3
MD5 e25254de92d6e7be2910de00336157e3
BLAKE2b-256 b675111920801c9d2175dbdac8c806351edf6c81cd4ca110e0e8951dec2cc019

See more details on using hashes here.

Provenance

The following attestation bundles were made for osrm_bindings-0.3.0-cp312-abi3-macosx_15_0_arm64.whl:

Publisher: publish_wheels.yml on nilsnolde/osrm-bindings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page