Skip to content

make scipy optional, decouple pure-numpy metrics from _topology#298

Open
kmarchais wants to merge 2 commits into
mainfrom
scipy-optional
Open

make scipy optional, decouple pure-numpy metrics from _topology#298
kmarchais wants to merge 2 commits into
mainfrom
scipy-optional

Conversation

@kmarchais

Copy link
Copy Markdown
Owner

Summary

  • Drop scipy from [project.dependencies]. No [scipy] extras group; users wanting scipy-coupled features (lagrangian, transfer_fields, repair, ValidationReport family, reorder_cuthill_mckee, metrics.compute_hessian) install scipy themselves.
  • Defer the mmgpy._topology import in metrics.py so the pure-numpy helpers (create_isotropic_metric, create_anisotropic_metric, tensor conversions, validate, eigenpairs, intersect) work on the slim install. Only compute_hessian reaches _topology and therefore scipy.
  • Now that pyvista and scipy are both out of the published wheel's Requires-Dist, simplify the Blender extension's METADATA strip: STRIP_DEPS = {"rich", "patchelf"} and the verify-step forbidden list collapses to the same two names.

Changes

  • pyproject.toml: remove scipy from dependencies; add it to the ui extra and the dev group directly.
  • src/mmgpy/metrics.py: move from mmgpy._topology import ... inside compute_hessian (one # noqa: PLC0415).
  • README.md: new "Features that need SciPy" section listing the scipy-coupled names.
  • .github/scripts/strip_blender_wheel_metadata.py: STRIP_DEPS reduced to {rich, patchelf}; docstring updated.
  • .github/workflows/build-blender-extension.yml: verify-step forbidden list reduced to rich patchelf; surrounding comment refreshed.
  • tests/headless_subset_test.py: docstring note that scipy is opt-in too (no functional change).

Notes

  • Slim install path remains covered by tests/headless_subset_test.py (scipy still lazy-loads after touching scipy-coupled attrs in the dev env).
  • [fem] extra unchanged; fedoo brings scipy transitively.
  • Breaking for users on pip install mmgpy who relied on scipy-coupled features without realizing scipy was pulled transitively; README calls this out.

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview: https://kmarchais.github.io/mmgpy/pr-298/

@codecov

codecov Bot commented May 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.18%. Comparing base (c0bf966) to head (33a7557).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #298   +/-   ##
=======================================
  Coverage   86.18%   86.18%           
=======================================
  Files          29       29           
  Lines        3865     3865           
  Branches      684      684           
=======================================
  Hits         3331     3331           
  Misses        330      330           
  Partials      204      204           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions

github-actions Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

Benchmark Results Summary

Group Benchmarks Mean Time Range
duplicate-detection 2 5.81ms - 69.97ms
operations 6 0.14ms - 53.64ms
remesh-2d 3 187.37ms - 190.53ms
remesh-3d 3 2882.68ms - 9445.27ms
remesh-surface 4 192.00ms - 478.99ms

Total: 18 benchmarks


Benchmark Comparison Results

Status: ✅ PASS
Compared: 18 benchmarks (threshold: 1.3x)

18 benchmarks passed
Benchmark Baseline Current Ratio
test_metric_field_set_get 108.2us 139.0us 1.28x
test_3d_adaptive_hmin_hmax_hausd 7.28s 7.75s 1.06x
test_pyvista_roundtrip_3d 31.86ms 33.54ms 1.05x
test_validate_3d 13.21ms 13.80ms 1.04x
test_construction_3d 27.30ms 28.01ms 1.03x
test_2d_adaptive_hmax_hgrad_angle 187.88ms 190.35ms 1.01x
test_2d_metric_hmin_hausd 188.26ms 190.53ms 1.01x
test_surface_metric_hmax_hausd_angle 475.58ms 478.99ms 1.01x
test_io_roundtrip_3d 53.48ms 53.64ms 1.00x
test_surface_uniform 348.70ms 348.88ms 1.00x
test_duplicate_detection_100k 69.96ms 69.97ms 1.00x
test_3d_metric_hgrad 9.45s 9.45s 1.00x
test_quality_3d 295.1us 294.6us 1.00x
test_duplicate_detection_10k 5.82ms 5.81ms 1.00x
test_2d_uniform_angle 187.95ms 187.37ms 1.00x
test_surface_adaptive_hmin_hgrad 193.03ms 192.00ms 0.99x
test_3d_optimize 2.91s 2.88s 0.99x
test_surface_optimize 479.20ms 472.48ms 0.99x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant