Skip to main content

osrm-bindings

Python bindings for osrm-backend using nanobind.

PyPI

pip install osrm-bindings
Platform Arch
Linux x86_64
Linux aarch64
MacOS arm64
Windows x86_64

From Source

osrm-bindings requires CPython 3.10+ and can be installed from source (e.g. from an sdist on PyPI) by running the following command in the repository root:

pip install .

The Python bindings are built alongside the OSRM C++ libraries. The version of the bindings matches the version of osrm-backend.

System dependencies

A source/sdist build compiles the full OSRM C++ library, so the usual C++ toolchain (CMake ≥ 3.18, a C++20 compiler, Git) plus OSRM's native dependencies must be available. Also a development Python installation has to be in the PATH.

Debian / Ubuntu

sudo apt-get install -y \
    cmake g++ git pkg-config \
    libboost-all-dev libbz2-dev liblua5.4-dev \
    libtbb-dev libxml2-dev libzip-dev

Fedora / RHEL / Rocky / AlmaLinux

sudo dnf install -y \
    cmake gcc-c++ git pkgconf-pkg-config \
    boost-devel bzip2-devel lua-devel \
    tbb-devel libxml2-devel libzip-devel

macOS (Homebrew)

brew install cmake lua tbb boost@1.90
brew link boost@1.90

Windows (vcpkg + MSVC)

Windows builds use vcpkg to provide OSRM's C++ dependencies and require a recent MSVC toolset (Visual Studio 2022 or later).

Example steps (PowerShell / Developer Command Prompt):

# Clone & bootstrap vcpkg
git clone https://github.com/microsoft/vcpkg.git C:\vcpkg
cd C:\vcpkg
.\bootstrap-vcpkg.bat

cmake --preset release
cmake --build buildß

If installing from a pip sdist, ensure CMake is configured to use the same vcpkg toolchain file (pass the toolchain via CMake args when building the wheel or use the same environment when running pip install).

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("./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/python/osrm/osrm_ext.pyi contains auto-generated type stubs for the C++ extension module. These are used by IDEs for autocompletion and by documentation tools without compiling the extension.

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

pip install -e .

Then commit the updated .pyi file.

Metadata

Release files for osrm-bindings 26.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for osrm-bindings 26.10.0
File Size Uploaded
osrm_bindings-26.10.0.tar.gz 38.3 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for osrm-bindings 26.10.0
File Interpreter ABI Platform
osrm_bindings-26.10.0-cp312-abi3-manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.28+ x86-64 Details
osrm_bindings-26.10.0-cp312-abi3-manylinux_2_28_aarch64.whl CPython 3.12 abi3 Linux glibc 2.28+ ARM64 Details
osrm_bindings-26.10.0-cp312-abi3-macosx_15_0_arm64.whl CPython 3.12 abi3 macOS 15.0+ ARM64 Details

Total release size: 86.3 MB

Release files / osrm_bindings-26.10.0.tar.gz

Download URL osrm_bindings-26.10.0.tar.gz
Size 38.3 MB
Tags Source
SHA-256 checksum
How to use checksums
2ca271af60e0628394f070e9a0f371bf18ff6c6e23769acc620d4aa7c07ed32c
BLAKE2b-256 checksum
How to use checksums
21ee5c637671338211a1ff0c1fda0300e33f745335bc3eddd4a60b19122c0812
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release files / osrm_bindings-26.10.0-cp312-abi3-manylinux_2_28_x86_64.whl

Download URL osrm_bindings-26.10.0-cp312-abi3-manylinux_2_28_x86_64.whl
Size 20.8 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
840d6f82812eb9f9e17c71eb9083dfa15f3be2bfec4965c32aefa48b00d3a951
BLAKE2b-256 checksum
How to use checksums
02c28aba6802adb86b150b65a339c9ee25ae9cbacf9a472ddac66e49f0948d0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release files / osrm_bindings-26.10.0-cp312-abi3-manylinux_2_28_aarch64.whl

Download URL osrm_bindings-26.10.0-cp312-abi3-manylinux_2_28_aarch64.whl
Size 21.3 MB
Tags CPython 3.12 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
df2d386949756b3de034662d2abb378ff1d60ee9b0d5e33c0da4080dc29164a4
BLAKE2b-256 checksum
How to use checksums
9c95dcff4e0e9d623b67660d705863715520830e2adc0781604c5303a4819a56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release files / osrm_bindings-26.10.0-cp312-abi3-macosx_15_0_arm64.whl

Download URL osrm_bindings-26.10.0-cp312-abi3-macosx_15_0_arm64.whl
Size 6.0 MB
Tags CPython 3.12 abi3 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
70b36c422a972225e26c38789197f5b018459ebbdfacc244dd968dee859a721b
BLAKE2b-256 checksum
How to use checksums
e497ef7847b48ff0e62f0b0caadab3db767328f7684853010fe6e696755bc39c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page