Python bindings for the osrm-backend project
Project description
osrm-bindings
osrm-bindings is a Python package that binds to osrm-backend using nanobind.
PyPI Supported Platforms
| Platform | Arch |
|---|---|
| Linux | x86_64 |
| MacOS | x86_64 |
| Windows | x86_64 |
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.
Installation
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
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 Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file osrm_bindings-0.1.0-cp312-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: osrm_bindings-0.1.0-cp312-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 6.3 MB
- Tags: CPython 3.12+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4949dce7da7ec04d14cfc31a74f460812f152ca51d054017345a78c04dcbb84d
|
|
| MD5 |
ab41d52eeaf7906c3fe30c458d4e1298
|
|
| BLAKE2b-256 |
8783c63869704f41715114108658ea5f400a9f9ace2c9d21de9894127d3d6203
|
Provenance
The following attestation bundles were made for osrm_bindings-0.1.0-cp312-abi3-manylinux_2_28_x86_64.whl:
Publisher:
publish_wheels.yml on nilsnolde/osrm-bindings
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
osrm_bindings-0.1.0-cp312-abi3-manylinux_2_28_x86_64.whl -
Subject digest:
4949dce7da7ec04d14cfc31a74f460812f152ca51d054017345a78c04dcbb84d - Sigstore transparency entry: 1236409654
- Sigstore integration time:
-
Permalink:
nilsnolde/osrm-bindings@c2a4563122ee6ebcec6ce0c0b6d486d0303df94d -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/nilsnolde
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_wheels.yml@c2a4563122ee6ebcec6ce0c0b6d486d0303df94d -
Trigger Event:
push
-
Statement type:
File details
Details for the file osrm_bindings-0.1.0-cp312-abi3-macosx_15_0_arm64.whl.
File metadata
- Download URL: osrm_bindings-0.1.0-cp312-abi3-macosx_15_0_arm64.whl
- Upload date:
- Size: 19.7 MB
- Tags: CPython 3.12+, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cdba4e2656324c8655507f8db0f2661cc1280ed4cdbd5811fcbed335c67c7e6
|
|
| MD5 |
c66fb44ca46a64262f4a88559d39f2c1
|
|
| BLAKE2b-256 |
c7cffab06b9c2c32a4246e9ce660e54515c2fc06e127b6574f5b7cf29fad8696
|
Provenance
The following attestation bundles were made for osrm_bindings-0.1.0-cp312-abi3-macosx_15_0_arm64.whl:
Publisher:
publish_wheels.yml on nilsnolde/osrm-bindings
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
osrm_bindings-0.1.0-cp312-abi3-macosx_15_0_arm64.whl -
Subject digest:
5cdba4e2656324c8655507f8db0f2661cc1280ed4cdbd5811fcbed335c67c7e6 - Sigstore transparency entry: 1236409590
- Sigstore integration time:
-
Permalink:
nilsnolde/osrm-bindings@c2a4563122ee6ebcec6ce0c0b6d486d0303df94d -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/nilsnolde
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_wheels.yml@c2a4563122ee6ebcec6ce0c0b6d486d0303df94d -
Trigger Event:
push
-
Statement type: