chore(build): pybind11 v3 pin, C++17, MSVC /WX, config and stub cleanups#1145
Draft
henryiii wants to merge 4 commits into
Draft
chore(build): pybind11 v3 pin, C++17, MSVC /WX, config and stub cleanups#1145henryiii wants to merge 4 commits into
henryiii wants to merge 4 commits into
Conversation
…+17, fix MSVC /WX The FetchContent fallback pinned pybind11 v2.13.3 while pyproject.toml requires pybind11>=3, so pure-CMake builds used a different pybind11 major than shipped wheels. Pin the v3.0.4 commit and add a version floor to FIND_PACKAGE_ARGS. pybind11 3 mandates C++17, so declare the standard the wheels already compile with. Also fix BOOST_HISTOGRAM_ERRORS on MSVC: /WE is not a valid flag; the warnings-as-errors flag is /WX. Part of #1143 Assisted-by: ClaudeCode:claude-fable-5
- WeightedSum.fill takes variance as keyword-only (py::kw_only in the binding), like Mean/WeightedMean already do in the stubs - Mean.__call__/WeightedMean.__call__ take a scalar value (the binding is make_mean_call, which binds a double), not ArrayLike - _ipython_key_completions_ is only registered on WeightedSum, Mean, and WeightedMean, not on Sum, so move it off the shared base class Part of #1143 Assisted-by: ClaudeCode:claude-fable-5
- Remove a stray leading space in the Chat URL - Drop sdist excludes for extern/pybind11, which is not a submodule - Drop gp311_242-* cibuildwheel test-skips (no such identifiers exist) - Drop cp310-musllinux_*, subsumed by cp31*-musllinux_* - Fix 'Hypothosis' typo Part of #1143 Assisted-by: ClaudeCode:claude-fable-5
The examples workflow only triggered on pushes to master, but the active default branch is develop. Also remove --ignore=docs/.build from the docs session: the directory does not exist (the outdir is docs/_build) and sphinx-autobuild ignores its outdir automatically. Part of #1143 Assisted-by: ClaudeCode:claude-fable-5
This was referenced Jun 11, 2026
henryiii
added a commit
to scikit-hep/hist
that referenced
this pull request
Jun 11, 2026
#697) 🤖 _AI text below_ 🤖 ## Problem boost-histogram's downstream `hist` CI job ([example: scikit-hep/boost-histogram#1145](scikit-hep/boost-histogram#1145)) was failing on its Python 3.10 leg with: ``` src/hist/chunked.py:60: error: Missing type arguments for generic type "ndarray" [type-arg] ... (9 total) ``` `np.ndarray` is generic. NumPy **≥2.3** added [PEP 696](https://peps.python.org/pep-0696/) **defaults** to `ndarray`'s type parameters, so its stubs silently accept a bare `np.ndarray`. NumPy **≤2.2** has no defaults, so strict mypy (`disallow_any_generics`) flags it. The downstream job type-checks on Python 3.10, where the newest installable NumPy is 2.2.x — hence the failure. It passed on the 3.14 leg, and never showed up here, because hist's only mypy run is the pre-commit hook pinned to `numpy~=2.4.0` (which has the defaults). The `accumulators.pyi` changes in that PR are unrelated — they don't affect hist. ## Fix - `src/hist/chunked.py`: replace the nine bare `np.ndarray` annotations with `np.typing.NDArray[Any]` (the convention already used in `plot.py`). Correct under every supported NumPy version, including the `numpy>=1.21.3` floor. The runtime `isinstance(value, np.ndarray)` check is untouched. ## Preventing regressions There is no single NumPy pin that both lacks the defaults *and* ships Python 3.14 wheels, so the pre-commit hook can't catch this. Instead: - `noxfile.py`: a new `nox -s mypy` session **pinned to Python 3.10**, where NumPy permanently resolves to <2.3 (no defaults), mirroring the downstream environment. - `.github/workflows/ci.yml`: a `Type check` job running it, added to the `pass` gate. Verified the new session **catches** the bug (9 errors with the fix reverted) and **passes** with it. Used normal resolution rather than `--resolution=lowest-direct` to avoid unrelated noise from boost-histogram 1.6.1 (no `MultiCell`, non-generic `Histogram`). `prek -a` and the chunked tests (61 passed) are green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
Part of #1143.
Build/tooling fixes verified against the sources:
pyproject.tomlrequirespybind11>=3, so pure-CMake builds (including the CMake CI job) built a different pybind11 major than shipped wheels. Now pins the v3.0.4 commit (d03662f) and usesFIND_PACKAGE_ARGS 3as a version floor. Also setsCMAKE_CXX_STANDARDto 17 — pybind11 3 mandates C++17, so wheels already compile as 17; the declared standard is now honest. (No C++ header modernization here; that is deferred.)BOOST_HISTOGRAM_ERRORS=ONpassed/WE, which is not an MSVC flag, so it silently did nothing. Fixed to/WX.src/boost_histogram/_core/accumulators.pyi:WeightedSum.fillnow declaresvariancekeyword-only (matchespy::kw_only()inregister_accumulators.cpp);Mean.__call__/WeightedMean.__call__take a scalarfloat(the binding ismake_mean_call, which binds adouble), notArrayLike;_ipython_key_completions_moved off_BaseAccumulatoronto WeightedSum/Mean/WeightedMean —Sumnever had it in C++.extern/pybind11(not a submodule); deadgp311_242-*cibuildwheel test-skip identifiers;cp310-musllinux_*subsumed bycp31*-musllinux_*; "Hypothosis" typo.examples.ymlpush trigger now includesdevelop(the active default branch); removed--ignore=docs/.buildfrom the nox docs session (nonexistent dir — outdir isdocs/_build, which sphinx-autobuild auto-ignores).Verification:
uv sync --reinstall-package boost-histogramrebuilds cleanly with C++17 + pybind11 3; pure-CMake configure fetches pybind11 v3.0.4 at the pinned commit; full test suite passes (997 passed, 1 xfail);mypystrict clean;prek -aclean.🤖 Generated with Claude Code