This project has been archived by its maintainers, and is no longer receiving any updates.
Valhalla Python bindings
| [] | [
] |
This folder contains the Python bindings to Valhalla routing engine.
[!NOTE]
pyvalhalla(-weekly)packages are currently only published for:
linux-x86_x64win-amd64macos-arm64
On top of the (very) high-level Python bindings, we package some data-building Valhalla executables to ease the process of graph creation or run Valhalla as a service, see below.
Installation
We distribute all currently maintained CPython versions as binary wheels for Win64, MacOS (arm64) and Linux (x86_64) distributions with glibc>=2.28. We do not offer a source distribution on PyPI.
pip install pyvalhalla to install the most recent Valhalla release.
pip install pyvalhalla-weekly to install the weekly published Valhalla master commit.
Usage
Bindings
Find a more extended notebook in ./examples, e.g. how to use the actor.
Before using the Python bindings you need to have access to a routable Valhalla graph. Either install Valhalla from source and built the graph from OSM compatible data or use our Valhalla docker image for a painless experience, e.g. this will build the routing graph for Andorra in ./custom_files:
docker run --rm --name valhalla -p 8002:8002 -v $PWD/custom_files:/custom_files -e tile_urls=https://download.geofabrik.de/europe/andorra-latest.osm.pbf ghcr.io/valhalla/valhalla-scripted:latest
Once you have created a graph locally, you can use it like this:
from valhalla import Actor, get_config, get_help
# generate configuration
config = get_config(tile_extract='./custom_files/valhalla_tiles.tar', verbose=True)
# print the help for specific config items (has the same structure as the output of get_config()
print(get_help()["service_limits"]["auto"]["max_distance"])
# instantiate Actor to load graph and call actions
actor = Actor(config)
route = actor.route({"locations": [...]})
Valhalla executables (linux-x86_x64 only)
To access the C++ (native) executables, there are 2 options:
- (recommended) execute the module, e.g.
python -m valhalla valhalla_build_tiles -h - execute the Python wrapper scripts directly, e.g.
valhalla_build_tiles -h
[!NOTE] For the latter option to work, the Python environment's
bin/folder has to be in the$PATH. Inside virtual environments, that's always the case.
Executing the scripts directly might also not work properly if there's a system-wide Valhalla installation, unless the Python environment's bin/ folder has higher priority than system folders in $PATH. The module execution uses an explicit Python executable which should be preferred.
There are also some additional commands we added:
--help: print the help forpython -m valhallaexplicitly--quiet: redirectstdoutof the C++ executables to/dev/null; can be added once anywhere in the command, will not be forwarded to a C++ executableprint_bin_path: simply prints the absolute path to the package-internalbin/directory where the C++ executables are; useful if the executables should be accessed directly in some script
To find out which Valhalla executables are currently included, run python -m valhalla --help. We limit the number of executables to control the wheel size. However, we're open to include any other executable if there's a good reason.
Building from source
Linux
To package arch-dependent Linux bindings we use a manylinux fork, where we install all dependencies into the manylinux_2_28 image, based on AlmaLinux 8. This is necessary to have a broad glibc compatibility with many semi-recent Linux distros.
Either pull the manylinux image, or build it locally for testing:
docker pull ghcr.io/valhalla/manylinux:2_28_valhalla_python
# or pull the image from ghcr.io
git clone https://github.com/valhalla/manylinux
cd manylinux
POLICY=manylinux_2_28 PLATFORM=x86_64 COMMIT_SHA=$(git rev-parse --verify HEAD) BUILDX_BUILDER=builder-docker-container ./build.sh
docker tag quay.io/pypa/manylinux_2_28_x86_64:$(git rev-parse --verify HEAD) ghcr.io/valhalla/manylinux:2_28_valhalla_python
Once built, start a container to actually build Valhalla using AlmaLinux 8:
cd valhalla
docker run -dt -v $PWD:/valhalla-py --name valhalla-py --workdir /valhalla-py ghcr.io/valhalla/manylinux:2_28_valhalla_python
docker exec -t valhalla-py /valhalla-py/src/bindings/python/scripts/build_manylinux.sh build_manylinux 3.13
This will also build & install libvalhalla before building the bindings. At this point there should be a wheelhouse folder with the fixed python wheel, ready to be installed or distributed to arbitrary python 3.12 installations.
cibuildwheel
On our CI, this orchestrates the packaging of all pyvalhalla wheels for every supported, minor Python version and every platform. It can also be run locally (obviously only being able to build wheels for your platform), e.g.
python -m pip install cibuildwheel
cibuildwheel --print-build-identifiers
cibuildwheel --only cp313-manylinux_x86_64
# for windows you'll have to set an env var to the vcpkg win root
VCPKG_ARCH_ROOT="build/vcpkg_installed/custom-x64-windows" cibuildwheel --only cp313-manylinux_x86_64
On Linux, this might download the manylinux docker image. In the end, you'll find the wheel in ./wheelhouse.
Testing (linux-x86_x64 only)
We have a small test script which makes sure that all the executables are working properly. If run locally for some reason, install a pyvalhalla wheel first. We run this in CI in a fresh Docker container with no dependencies installed, mostly to verify dynamic linking of the vendored dependencies.
Metadata
Release files for pyvalhalla-weekly 3.5.1.post1.dev202
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 911.3 MB
Release files / pyvalhalla_weekly-3.5.1.post1.dev202-cp313-cp313-win_amd64.whl
| Download URL | pyvalhalla_weekly-3.5.1.post1.dev202-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 26.8 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
c5bcc6e4ca466e928577f6db09badcfd127c16004e72acd3d084fe8882d90852
|
|
BLAKE2b-256 checksum How to use checksums |
8a3c9e2d18820906ec96512e48956ddde9ce9327a527c7bc6337a1d89e40f7b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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 Aug 17, 2025.
Transparency logRelease files / pyvalhalla_weekly-3.5.1.post1.dev202-cp313-cp313-manylinux_2_28_x86_64.whl
| Download URL | pyvalhalla_weekly-3.5.1.post1.dev202-cp313-cp313-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 85.1 MB |
| Tags | CPython 3.13 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
05d18db530f96f85fa9773b5ad95148f79caabdab46f15c5cc990c22931cd0d0
|
|
BLAKE2b-256 checksum How to use checksums |
a2fc9305b71a36bf73696804fd745c8a702fb1ff788a44811de58af5292d151c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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 Aug 17, 2025.
Transparency logRelease files / pyvalhalla_weekly-3.5.1.post1.dev202-cp313-cp313-macosx_14_0_arm64.whl
| Download URL | pyvalhalla_weekly-3.5.1.post1.dev202-cp313-cp313-macosx_14_0_arm64.whl |
|---|---|
| Size | 70.3 MB |
| Tags | CPython 3.13 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
2936aaf06b496ca6deb3892e3752d77bc0287683259f146c984cc5d3442e42cf
|
|
BLAKE2b-256 checksum How to use checksums |
a19194fadc04f3322892ce0c1631ce07d98bd51058fdde37f83af4e07fbe5439
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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 Aug 17, 2025.
Transparency logRelease files / pyvalhalla_weekly-3.5.1.post1.dev202-cp312-cp312-win_amd64.whl
| Download URL | pyvalhalla_weekly-3.5.1.post1.dev202-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 26.8 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2c1110c19fdd20e7d4ecc38afe98bf6492df96ffb184f023ffd6ef6542a42619
|
|
BLAKE2b-256 checksum How to use checksums |
76109589317d9fdb60d35cf8a1ebd5fcb2f0f64a6d2dadd66be1d21efe5649ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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 Aug 17, 2025.
Transparency logRelease files / pyvalhalla_weekly-3.5.1.post1.dev202-cp312-cp312-manylinux_2_28_x86_64.whl
| Download URL | pyvalhalla_weekly-3.5.1.post1.dev202-cp312-cp312-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 85.1 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
c17bc4a220c14978fa0efd4b4414557cb82e4e98496903b1cd36a80a04843496
|
|
BLAKE2b-256 checksum How to use checksums |
bd3282e1fa30d3c9258e8b354a839031652e88079f89b611db4d08c28fceec39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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 Aug 17, 2025.
Transparency logRelease files / pyvalhalla_weekly-3.5.1.post1.dev202-cp312-cp312-macosx_14_0_arm64.whl
| Download URL | pyvalhalla_weekly-3.5.1.post1.dev202-cp312-cp312-macosx_14_0_arm64.whl |
|---|---|
| Size | 70.3 MB |
| Tags | CPython 3.12 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
68b9631c0f866f9ab28b3711f2d9d7eee4a2689d48cf7e2abc59fee9d6754ccb
|
|
BLAKE2b-256 checksum How to use checksums |
28191ae5d58f36399a14ffcb3e398411f51c1ec2ecd3fbeba0e7da15a5f1f367
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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 Aug 17, 2025.
Transparency logRelease files / pyvalhalla_weekly-3.5.1.post1.dev202-cp311-cp311-win_amd64.whl
| Download URL | pyvalhalla_weekly-3.5.1.post1.dev202-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 26.8 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
4bfac53c16ca8c9350b2f4834bd2fd63ff5649dc66c848bc0b135cc45603aba9
|
|
BLAKE2b-256 checksum How to use checksums |
7d2ca882ae591834ff1b5cd15455fddf7448b626a318578499d041c1bbf441ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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 Aug 17, 2025.
Transparency logRelease files / pyvalhalla_weekly-3.5.1.post1.dev202-cp311-cp311-manylinux_2_28_x86_64.whl
| Download URL | pyvalhalla_weekly-3.5.1.post1.dev202-cp311-cp311-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 85.1 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
e42991a25095ca4934c0c4220308c021b45728ad9cd9215fe505853a6c2d29e1
|
|
BLAKE2b-256 checksum How to use checksums |
3725703337d8e177c8f4248a2fadbd8fa014739047fc888ac462bbefee83d83f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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 Aug 17, 2025.
Transparency logRelease files / pyvalhalla_weekly-3.5.1.post1.dev202-cp311-cp311-macosx_14_0_arm64.whl
| Download URL | pyvalhalla_weekly-3.5.1.post1.dev202-cp311-cp311-macosx_14_0_arm64.whl |
|---|---|
| Size | 70.3 MB |
| Tags | CPython 3.11 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
4a542ab4d26ef86424484fc5453bec0a99f5a78124aad89e8f34e59bc14d2d25
|
|
BLAKE2b-256 checksum How to use checksums |
d3da9bf40615db3d90225cb0b7b9e227ecf90e6b8f109009dcc5c70aef4e90ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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 Aug 17, 2025.
Transparency logRelease files / pyvalhalla_weekly-3.5.1.post1.dev202-cp310-cp310-win_amd64.whl
| Download URL | pyvalhalla_weekly-3.5.1.post1.dev202-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 26.8 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
98f2b4119c77273b8cbc15b64aee69326b0b10abf219656a36481ed21067f4f0
|
|
BLAKE2b-256 checksum How to use checksums |
3dcd2bb378a4dba81911ca832dca59410136ca8c2f15d6e4e976848fef671f9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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 Aug 17, 2025.
Transparency logRelease files / pyvalhalla_weekly-3.5.1.post1.dev202-cp310-cp310-manylinux_2_28_x86_64.whl
| Download URL | pyvalhalla_weekly-3.5.1.post1.dev202-cp310-cp310-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 85.1 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
cb78925ebef9cfb6a8ec935c0c9d7528d49524d383562eb4766ee5ce74f35683
|
|
BLAKE2b-256 checksum How to use checksums |
ee4bac02155332f69d1a8a8801f49c81acb9e38dd1db905d7321f28370ce17fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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 Aug 17, 2025.
Transparency logRelease files / pyvalhalla_weekly-3.5.1.post1.dev202-cp310-cp310-macosx_14_0_arm64.whl
| Download URL | pyvalhalla_weekly-3.5.1.post1.dev202-cp310-cp310-macosx_14_0_arm64.whl |
|---|---|
| Size | 70.3 MB |
| Tags | CPython 3.10 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
4d608229505b0a7105e4ded5dc7119b95ff925c4739d28329dfe34bcb1a58a40
|
|
BLAKE2b-256 checksum How to use checksums |
86044d77586f0e51a32203612de407a7438ee071cd1da9464c935d399c1327c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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 Aug 17, 2025.
Transparency logRelease files / pyvalhalla_weekly-3.5.1.post1.dev202-cp39-cp39-win_amd64.whl
| Download URL | pyvalhalla_weekly-3.5.1.post1.dev202-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 26.9 MB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
cff650b7616fc27d357767d77adb8b7e153a9175ee3c8bb083004b829e4052af
|
|
BLAKE2b-256 checksum How to use checksums |
463a5f0de13ef55d8daab0749a98c4450f28604b48047fa3409c743385a2a391
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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 Aug 17, 2025.
Transparency logRelease files / pyvalhalla_weekly-3.5.1.post1.dev202-cp39-cp39-manylinux_2_28_x86_64.whl
| Download URL | pyvalhalla_weekly-3.5.1.post1.dev202-cp39-cp39-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 85.1 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
56a208405793d6c54974a38991419ca7557740c070ecb7640ba522751dabd32a
|
|
BLAKE2b-256 checksum How to use checksums |
0e0809d4be9bedd1fc50b13b5a915da15d2d6de7434869dbd475b712c8f1f13b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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 Aug 17, 2025.
Transparency logRelease files / pyvalhalla_weekly-3.5.1.post1.dev202-cp39-cp39-macosx_14_0_arm64.whl
| Download URL | pyvalhalla_weekly-3.5.1.post1.dev202-cp39-cp39-macosx_14_0_arm64.whl |
|---|---|
| Size | 70.3 MB |
| Tags | CPython 3.9 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
15c7d2bd188b6931282a9bbeef7a4be8fd6ea80dfc316aaf1eebadf5ac9892e5
|
|
BLAKE2b-256 checksum How to use checksums |
b011809da0af9de1845a4a709c1ff85bdc5a364cbfb568ad5f0db8e2aceb8f27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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 Aug 17, 2025.
Transparency log