feat: integrate https://github.com/nilsnolde/osrm-bindings#7485
feat: integrate https://github.com/nilsnolde/osrm-bindings#7485nilsnolde wants to merge 23 commits intoProject-OSRM:masterfrom
Conversation
| { text: 'Node.js API', link: '/nodejs/api' }, | ||
| { text: 'Python', items: [ | ||
| { text: 'API', link: '/python/api' }, | ||
| { text: 'Development', link: '/python/development' } |
There was a problem hiding this comment.
I tried to be really thorough, so I had claude add some python development and API docs. python doesn't work very well with vitepress with pulling out docstrings etc. it's mostly mkdocs these days in python land. not sure, but I could imagine mkdocs support JS docstrings as well. I guess you just switched to vitepress @DennisOSRM , not sure you'd be open to ditch it again potentially?
There was a problem hiding this comment.
for reference, this is the mkdocs based documentation I configured for valhalla: https://valhalla.github.io/valhalla/
| @@ -0,0 +1,68 @@ | |||
| # osrm-bindings | |||
|
|
|||
| **Python bindings for [osrm-backend](https://github.com/Project-OSRM/osrm-backend) using [nanobind](https://github.com/wjakob/nanobind).** | |||
There was a problem hiding this comment.
this file is the project page on pypi.org
| @ECHO OFF | ||
| SETLOCAL EnableDelayedExpansion | ||
|
|
||
| SET DATA_DIR=%CD% |
There was a problem hiding this comment.
could probably use the standard Makefile instead of duplicating the same logic here. I know there gmake for windows, could just work..
|
The PR probably needs a rebase onto latest master to pick up a fix for macOS ci. |
|
jeez, thanks, was just about to diagnose! |
getting to build linux was less of a hassle than I imagined. it's more of a hassle to review I guess.. my proposal: since it's mostly copy/paste from https://github.com/nilsnolde/osrm-bindings, it's not too bad to not review the code toooo much. one can somewhat trust the python packaging pipeline. I'll add more details later. IMO it's more important to understand how things work conceptually, so I'll add quite some more text to the PR description once this is a final PR. and of course feel free to ask any understanding question you have:) packaging is always awful, but honestly, python got really usable after they introduced (and widely supported) pyproject.toml.
General
nanobindfor C++ binding (i.e. no setup.py, all CMake based), very close to libosrm API, only some plumbing python codeRepo Layout
everything is properly namespaced to python:
src/python/ ├── CMakeLists.txt ├── README.md ├── include/ │ └── python/ │ ├── engineconfig_nb.hpp │ ├── parameters/ │ ├── types/ │ └── utility/ ├── osrm/ │ ├── __init__.py │ ├── __main__.py │ └── osrm_ext.pyi └── src/ ├── engineconfig_nb.cpp ├── osrm_nb.cpp ├── parameters/ ├── types/ └── utility/ test/python/ ├── constants.py ├── test_index.py ├── test_match.py ├── test_nearest.py ├── test_route.py ├── test_table.py ├── test_tile.py └── test_trip.pyPackaging Architecture
cibuildwheelto orchestrate the build, packaging, repairing (mostly vendor dynamic libs into the wheel), can be run locally toomanylinux_2_28docker image based on almalinux 8. I forked https://github.com/pypa/manylinux a while ago to https://github.com/nilsnolde/manylinux, where I added the OSRM build dependencies for both aarch64 & x86: https://github.com/nilsnolde/manylinux/pkgs/container/manylinux.setuptools_scmwhich inspects .git to derive a semver version at packaging timeOpen Questions
osrm-bindingsis ok-ish,osrmwould of course be much nicer:)