-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Expand file tree
/
Copy pathpyproject.toml
More file actions
executable file
·134 lines (122 loc) · 5.3 KB
/
pyproject.toml
File metadata and controls
executable file
·134 lines (122 loc) · 5.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
[build-system]
requires = [
"scikit-build-core >=0.12.0",
"nanobind >=2.12.0",
"setuptools-scm >=10",
"cmake",
"ninja; sys_platform != 'win32'",
]
build-backend = "scikit_build_core.build"
[project]
name = "osrm-bindings"
dynamic = ["version"]
description = "Python bindings for the osrm-backend project"
readme = "src/python/README.md"
requires-python = ">=3.10"
authors = [{name = "Doo Woong Chung"}, { name = "Nils Nolde" }]
license = { file = "LICENSE.TXT" }
[project.optional-dependencies]
dev = ["pytest", "pre-commit", "ruff"]
[project.urls]
repository = "https://github.com/Project-OSRM/osrm-backend"
[tool.ruff]
exclude = [".venv", "build"]
extend-exclude = [
"dist",
"wheelhouse",
"*build*",
"*.egg-info",
]
line-length = 105
lint.ignore = ["E731", "F811", "E741"]
[tool.scikit-build.metadata]
version.provider = "scikit_build_core.metadata.setuptools_scm"
[tool.setuptools_scm]
version_scheme = "no-guess-dev"
local_scheme = "no-local-version"
[tool.scikit-build]
minimum-version = "0.4"
build-dir = "build/{wheel_tag}"
cmake.build-type = "Release"
wheel.py-api = "cp312"
wheel.packages = ["src/python/osrm"]
wheel.exclude = ["include/**", "lib/**", "bin/**", "share/**"]
sdist.include = ["pyproject.toml"]
sdist.exclude = ["dist", "wheelhouse", "build", "build-*", ".venv", "**/.venv"]
[tool.scikit-build.cmake.define]
ENABLE_PYTHON_BINDINGS = "ON"
CMAKE_BUILD_TYPE = "Release"
CMAKE_CXX_SCAN_FOR_MODULES = "OFF"
[tool.cibuildwheel]
archs = ["native"]
build = "cp312-*"
build-verbosity = 1
skip = "*musllinux*"
# TODO(nils): should we leave it here or push to osrm org?
manylinux-x86_64-image = "ghcr.io/nilsnolde/manylinux:2_28_osrm_python"
manylinux-aarch64-image = "ghcr.io/nilsnolde/manylinux:2_28_osrm_python"
test-requires = "pytest"
test-command = [
"cd {project}/test/data && python -m osrm extract -p {project}/profiles/car.lua monaco.osm.pbf",
"mkdir -p {project}/test/data/ch && cp {project}/test/data/monaco.osrm* {project}/test/data/ch/",
"python -m osrm contract {project}/test/data/ch/monaco.osrm",
"mkdir -p {project}/test/data/mld && cp {project}/test/data/monaco.osrm* {project}/test/data/mld/",
"python -m osrm partition {project}/test/data/mld/monaco.osrm",
"python -m osrm customize {project}/test/data/mld/monaco.osrm",
"python -m osrm datastore {project}/test/data/ch/monaco",
"pytest {project}/test/python"
]
[tool.cibuildwheel.linux]
# The custom manylinux image ships vcpkg + a pre-warmed binary cache built
# against this exact vcpkg.json, exposing VCPKG_ROOT=/opt/vcpkg and
# VCPKG_DEFAULT_BINARY_CACHE=/opt/vcpkg-bincache as ENV. CMAKE_ARGS routes
# the cmake configure through the vcpkg toolchain so `vcpkg install` reads
# from that bincache instead of rebuilding boost/tbb/etc. from source.
# The `-release` triplet matches what the image's prewarm used; vcpkg's ABI
# hash includes the triplet name, so x64-linux ≠ x64-linux-release in the
# cache.
environment = """\
LD_LIBRARY_PATH=/usr/local/lib64:${LD_LIBRARY_PATH} \
CCACHE_DIR=/ccache \
CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-linux-release"\
"""
before-build = "ccache -s && ccache -M 500M"
repair-wheel-command = "auditwheel repair -w {dest_dir} {wheel}"
[tool.cibuildwheel.macos]
# Build deps come from vcpkg (same pattern as Windows). VCPKG_ROOT is
# exported on the runner by lukka/run-vcpkg in the workflow and inherited
# by cibuildwheel; CMAKE_ARGS routes the cmake configure through the vcpkg
# toolchain. No triplet override — vcpkg's autodetect picks arm64-osx on
# Apple Silicon and x64-osx on Intel, matching the main build-matrix step's
# CMakePresets, so the wheel hits the runner-level bincache populated there.
environment = """\
MACOSX_DEPLOYMENT_TARGET=15.0 \
CCACHE_DIR=$HOME/.ccache \
CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"\
"""
before-build = "ccache -s && ccache -M 500M"
before-all = """
export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1
brew install ccache
"""
[tool.cibuildwheel.windows]
# Windows uses vcpkg. VCPKG_ROOT is exported on the runner by lukka/run-vcpkg
# in the workflow and inherited by the cibuildwheel build env; CMAKE_ARGS is
# read by scikit-build-core and forwarded to the cmake configure step.
# cibuildwheel parses `environment` as bash export statements, so $VCPKG_ROOT
# expands here.
environment = 'CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static-md"'
before-build = "pip install delvewheel"
# In manifest mode, vcpkg installs deps into <build-dir>/vcpkg_installed/<triplet>.
# scikit-build-core's build dir is build/{wheel_tag} and the abi3 cp312 wheel
# tag on Windows x64 is cp312-abi3-win_amd64, so the vcpkg-built tbb12.dll
# (TBB is shared even under static-md — vcpkg's port forces it) lives at the
# path below. --add-path makes delvewheel discover it. --no-mangle preserves
# the DLL name so anything that hard-codes "tbb12.dll" still loads it.
repair-wheel-command = 'delvewheel repair --analyze-existing-exes --add-path build\cp312-abi3-win_amd64\vcpkg_installed\x64-windows-static-md\bin --no-mangle tbb12.dll -w {dest_dir} {wheel}'
test-command = [
"cd /d {project}/test/data",
"windows-build-test-data.bat",
"python -m osrm datastore {project}/test/data/ch/monaco",
"pytest {project}/test/python"
]