Skip to content

Add switches that turn the runtime checks off - #44

Draft
user27182 wants to merge 5 commits into
mainfrom
feat/check-config
Draft

user27182 wants to merge 5 commits into
mainfrom
feat/check-config

Conversation

@user27182

Copy link
Copy Markdown
Contributor

Adds pyvista_validation.config, which turns the runtime checks off globally (enabled) or one kind at a time: one switch per check_* function, plus axes and rotation for the geometric checks of validate_axes and validate_rotation. A switched-off check returns its input unchanged, both in its check function and in the validate_array options that use it; casts, reshapes and dtype conversions always run, so valid input gives the same output. config.override(...) scopes switches to a with block, and PYVISTA_VALIDATION_CHECKS=false starts with enabled off.

The C fast paths read the same switches as a bitmask. Composite checks such as check_nonnegative and check_string call private helpers, so only their own switch applies. to_dict/from_dict are there for a future pyvista.global_config.validation.checks section.

Call C, on C, off Python, on Python, off
validate_arrayNx3, 1M x 3, finite 409 µs 0.1 µs 426 µs 1.1 µs
check_sorted, 1M 135 µs 0.03 µs 326 µs 0.07 µs

Timed with timeit on an M-series MacBook, best of 5.

Changes drafted by Claude Opus 5.5 but fully understood by me.

🤖 Generated with Claude Code (Claude Opus 5.5)

user27182 and others added 2 commits September 27, 2026 12:33
`pyvista_validation.config` has one boolean switch per kind of check, named
after its check function, plus `enabled` for all of them and `axes` and
`rotation` for the geometric checks of `validate_axes` and `validate_rotation`.
A switched-off check returns its input unchanged, in its `check` function and
in the `validate` options that use it; casts, reshapes and dtype conversions
always run. `config.override(...)` sets switches for a `with` block, and
`PYVISTA_VALIDATION_CHECKS=false` starts with `enabled` off.

The C fast paths read the same switches as a bitmask.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	pyvista_validation/check.py
@codecov-commenter

codecov-commenter commented Sep 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.79%. Comparing base (0bda3f6) to head (b7e1c4e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #44      +/-   ##
==========================================
+ Coverage   99.74%   99.79%   +0.05%     
==========================================
  Files          11       12       +1     
  Lines        1167     1459     +292     
  Branches      135      162      +27     
==========================================
+ Hits         1164     1456     +292     
  Misses          1        1              
  Partials        2        2              
Flag Coverage Δ
tests 99.60% <100.00%> (+0.13%) ⬆️
typing 98.21% <99.30%> (+0.32%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

user27182 and others added 3 commits September 27, 2026 12:37
…d run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants