Skip to main content

osrm-bindings

Python bindings for osrm-backend using nanobind.

PyPI

pip install osrm-bindings
Platform Arch
Linux x86_64
MacOS 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.9.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.9.0
File Size Uploaded
osrm_bindings-26.9.0.tar.gz 10.8 MB Details

Built distributions (wheels)

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

Total release size: 65.0 MB

Release files / osrm_bindings-26.9.0.tar.gz

Download URL osrm_bindings-26.9.0.tar.gz
Size 10.8 MB
Tags Source
SHA-256 checksum
How to use checksums
ab3ab8489db7a82e414fd7c5cf2ee90db3c0f4aff81527a3bca3871e2e3be90d
BLAKE2b-256 checksum
How to use checksums
a0a7b26faa3ea849110c185969fac3ffc6c1d28b5c66cd318844507f9a0c36b6
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 Sep 1, 2026.

Transparency log

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

Download URL osrm_bindings-26.9.0-cp312-abi3-manylinux_2_28_x86_64.whl
Size 20.6 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
eaeee942d59a06dda18ad41678ba1b07709c0f967a27c0fda87ee0e6b258ce48
BLAKE2b-256 checksum
How to use checksums
feea2b41d04f5531def243dbb48337efbb926db6ad21f4cc67fd815e764ac14f
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 Sep 1, 2026.

Transparency log

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

Download URL osrm_bindings-26.9.0-cp312-abi3-manylinux_2_28_aarch64.whl
Size 21.1 MB
Tags CPython 3.12 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
c3bfe6dafdb07819c5f22042c93abfb43ad52748d7bd29d9af5aa607017e56b9
BLAKE2b-256 checksum
How to use checksums
3081ee8c5894d097cf6519d6d811b4b0d53a4553bd6cec40f8b500c143d3a2a7
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 Sep 1, 2026.

Transparency log

Release files / osrm_bindings-26.9.0-cp312-abi3-macosx_15_0_x86_64.whl

Download URL osrm_bindings-26.9.0-cp312-abi3-macosx_15_0_x86_64.whl
Size 6.5 MB
Tags CPython 3.12 abi3 macOS 15.0+ x86-64
SHA-256 checksum
How to use checksums
2b2f5345757239c95a031a4e4fe6fbca5fde787be956fd94a9bd2d9ec84e5bad
BLAKE2b-256 checksum
How to use checksums
a26ffb7d56b1d64562fc4e8dc7f85cf25d497ccf7e6f7e0f8985014049b69daa
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 Sep 1, 2026.

Transparency log

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

Download URL osrm_bindings-26.9.0-cp312-abi3-macosx_15_0_arm64.whl
Size 5.9 MB
Tags CPython 3.12 abi3 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
30f7942cdce9291440ca7c4087f5b6354b248f2b63dcbc96e18129fc1c5d1f3f
BLAKE2b-256 checksum
How to use checksums
655da3c187ad65600ad6a3845286b848d1fe6dbaaa11917529923d01622f85e2
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 Sep 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