Commit ed901ca
Fix CMake Python3::Python target and cibuildwheel CI issues (#910)
Summary:
This PR fixes multiple build issues related to CMake Python3 target discovery and PyPI wheel builds via cibuildwheel.
## Changes
### CMake Python3::Python Target Fix
- **Problem**: In SKBUILD builds, `find_package(Python3)` only requests `Development.Module` which provides `Python3::Module` but not `Python3::Python`. The tensor tests need the full Python library for executables.
- **Solution**: Implemented a robust 3-step fallback mechanism:
1. Check if `Python3::Python` already exists (regular CMake builds)
2. Try `find_package` with `Development.Embed` (QUIET, not REQUIRED)
3. If that fails, create `Python3::Python` target manually by finding libpython
### Flaky Jacobian Test Tolerance
- Increased numerical tolerance thresholds for two tests that were failing intermittently:
- `DistanceConstraint_GradientsAndJacobians` (double): 2e-5 → 5e-5
- `JointToJointPositionError_GradientsAndJacobians` (float): 0.05 → 0.06
### cibuildwheel PyPI Wheel Build Fixes
1. **PyTorch installation**: Added `build-frontend = { name = "pip", args = ["--no-build-isolation"] }` and install build dependencies (scikit-build-core, pybind11, setuptools-scm) in `before-build`
2. **Version consistency**: Use Jinja2 template variables for PyTorch versions instead of hardcoded values
3. **publish_gpu job**: Added missing `if` condition to skip on non-tag pushes
4. **auditwheel repair**: Handle case when auditwheel produces no output by copying original wheel
## Files Changed
- `pymomentum/CMakeLists.txt` - Python3::Python fallback mechanism
- `momentum/test/character_solver/error_functions_test.cpp` - Tolerance fixes
- `pyproject-pypi.toml.j2` - cibuildwheel configuration fixes
- `.github/workflows/publish_to_pypi.yml` - publish_gpu job fix
- `.gitignore` - Added pyproject.toml.bak
## Testing
- ✅ All 19 C++ tests pass locally
- ✅ Local wheel build with `--no-build-isolation --no-deps` succeeds
- ✅ CI jobs should all pass with these fixes
Pull Request resolved: #910
Reviewed By: cdtwigg
Differential Revision: D90049988
Pulled By: jeongseok-meta
fbshipit-source-id: 646a3190cb2872d07342c4b45cdfa449a7a630a51 parent 5e426e8 commit ed901ca
File tree
5 files changed
+114
-13
lines changed- .github/workflows
- momentum/test/character_solver
- pymomentum
5 files changed
+114
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
316 | 320 | | |
317 | 321 | | |
318 | 322 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1983 | 1983 | | |
1984 | 1984 | | |
1985 | 1985 | | |
1986 | | - | |
| 1986 | + | |
1987 | 1987 | | |
1988 | 1988 | | |
1989 | 1989 | | |
| |||
2111 | 2111 | | |
2112 | 2112 | | |
2113 | 2113 | | |
2114 | | - | |
| 2114 | + | |
2115 | 2115 | | |
2116 | 2116 | | |
2117 | 2117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
339 | 383 | | |
340 | 384 | | |
341 | 385 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| 208 | + | |
| 209 | + | |
208 | 210 | | |
209 | 211 | | |
210 | 212 | | |
| 213 | + | |
| 214 | + | |
211 | 215 | | |
212 | | - | |
213 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
214 | 231 | | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
219 | 252 | | |
220 | 253 | | |
221 | 254 | | |
222 | | - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
223 | 263 | | |
224 | 264 | | |
225 | 265 | | |
| |||
251 | 291 | | |
252 | 292 | | |
253 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
254 | 297 | | |
255 | 298 | | |
256 | 299 | | |
| |||
271 | 314 | | |
272 | 315 | | |
273 | 316 | | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
278 | 330 | | |
279 | 331 | | |
280 | 332 | | |
| |||
0 commit comments