Skip to content

Conversation

matthewfeickert
Copy link
Member

@matthewfeickert matthewfeickert commented Jul 17, 2025

Description

To get development up and running again without having to deal with additional changes yet to the codebase, just get the existing code passing without changing library code and then go from there. We should then pull in the parts of @kratsg's PR #2566 that are needed. Docs will get fixed in another PR.

Resolves #2553

  • Add upper bound of SciPy v1.16.0 as there are numerical differences compared to v1.15.x and convergence issues that can lead to 'Singular matrix E in LSQ subproblem'.
  • Add upper bound of NumPy v2.0 to the PyTorch extra as PyTorch is currently incompatible with NumPy v2.0.
  • Add try-except for from click.testing.CliRunner to work with versions of Click older than v8.2.0.
  • Use typing.cast to have all NumPy backend operations be cast to type numpy.typing.ArrayLike to satisfy mypy.
  • Add pytest fixture to disable CUDA acceleration by default for GPU enabled machines so that the tests will run in CPU mode by default.
    • Add --enable-cuda flag that can be passed to let CUDA backends be turned on.
  • Remove pyhf CLI command with no arguments from Docker image test as it results in an exit code of 2.
  • Add ignores to filterwarning for Click, papermill, and PyTorch.
   - DeprecationWarning: 'MultiCommand' is deprecated and will be removed in Click 9.0. Use 'Group' instead.
   - DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs given by the platformdirs library.  To remove this warning and see the appropriate new directories, set the environment variable `JUPYTER_PLATFORM_DIRS=1` and then run `jupyter --paths`. The use of platformdirs will be the default in `jupyter_core` v6.
   - DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
   - DeprecationWarning: In future, it will be an error for 'np.bool' scalars to be interpreted as an index.
   - DeprecationWarning: __array__ implementation doesn't accept a copy keyword, so passing copy=False failed. __array__ must implement 'dtype' and 'copy' keyword arguments.

Checklist Before Requesting Reviewer

  • Tests are passing
  • "WIP" removed from the title of the pull request
  • Selected an Assignee for the PR to be responsible for the log summary

Before Merging

For the PR Assignees:

  • Summarize commit messages into a comprehensive review of the PR
* Add upper bound of SciPy v1.16.0 as there are numerical differences compared to
  v1.15.x and convergence issues that can lead to 'Singular matrix E in LSQ subproblem'.
   - c.f. https://github.com/scikit-hep/pyhf/issues/2593
* Add upper bound of NumPy v2.0 to the PyTorch extra as PyTorch is currently
  incompatible with NumPy v2.0.
   - c.f. https://github.com/pytorch/pytorch/issues/157973
* Add try-except for from `click.testing.CliRunner` to work with versions of Click
  older than v8.2.0.
* Use typing.cast to have all NumPy backend operations be cast to type
  numpy.typing.ArrayLike to satisfy mypy.
* Add pytest fixture to disable CUDA acceleration by default for GPU enabled machines
  so that the tests will run in CPU mode by default.
   - Add `--enable-cuda` flag that can be passed to let CUDA backends be turned on.
* Remove `pyhf` CLI command with no arguments from Docker image test as it results
  in an exit code of 2.
* Add ignores to filterwarning for Click, papermill, and PyTorch.
   - DeprecationWarning: 'MultiCommand' is deprecated and will be removed in Click 9.0.
     Use 'Group' instead.
   - DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs
     given by the platformdirs library. To remove this warning and see the appropriate
     new directories, set the environment variable `JUPYTER_PLATFORM_DIRS=1` and then
     run `jupyter --paths`. The use of platformdirs will be the default in `jupyter_core`
     v6.
   - DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for
     removal in a future version. Use timezone-aware objects to represent datetimes
     in UTC: datetime.datetime.now(datetime.UTC).
   - DeprecationWarning: In future, it will be an error for 'np.bool' scalars to be
     interpreted as an index.
   - DeprecationWarning: __array__ implementation doesn't accept a copy keyword, so
     passing copy=False failed. __array__ must implement 'dtype' and 'copy' keyword
     arguments.
   - c.f. https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword

Co-authored-by: Giordon Stark <kratsg@gmail.com>

@matthewfeickert matthewfeickert self-assigned this Jul 17, 2025
@matthewfeickert matthewfeickert added the fix A bug fix label Jul 17, 2025
Copy link

codecov bot commented Jul 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.23%. Comparing base (3d26434) to head (ebfd2b3).
Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2592      +/-   ##
==========================================
+ Coverage   98.21%   98.23%   +0.02%     
==========================================
  Files          69       69              
  Lines        4543     4545       +2     
  Branches      804      612     -192     
==========================================
+ Hits         4462     4465       +3     
  Misses         48       48              
+ Partials       33       32       -1     
Flag Coverage Δ
contrib ?
doctest 98.10% <100.00%> (+0.02%) ⬆️
unittests-3.10 ?
unittests-3.11 96.25% <100.00%> (+0.02%) ⬆️
unittests-3.12 96.25% <100.00%> (+0.02%) ⬆️
unittests-3.8 96.25% <100.00%> (+<0.01%) ⬆️
unittests-3.9 96.30% <100.00%> (+0.02%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

@matthewfeickert matthewfeickert added the build Changes that affect the build system or external dependencies label Jul 18, 2025
@github-project-automation github-project-automation bot moved this to In progress in pyhf v0.8.0 Jul 18, 2025
@matthewfeickert matthewfeickert changed the title fix: Get tests passing again without code changes fix: Add temporary upper bounds on NumPy and SciPy to pass tests Jul 18, 2025
@matthewfeickert matthewfeickert marked this pull request as ready for review July 18, 2025 00:56
@matthewfeickert matthewfeickert requested a review from kratsg July 18, 2025 00:56
@kratsg kratsg merged commit 500e8e4 into main Jul 18, 2025
29 of 31 checks passed
@kratsg kratsg deleted the fix/get-tests-passing-more branch July 18, 2025 03:21
@github-project-automation github-project-automation bot moved this from In progress to Done in pyhf v0.8.0 Jul 18, 2025
@kratsg
Copy link
Contributor

kratsg commented Jul 18, 2025

bypassing rules as docs are expected to fail and will be fixed in a different PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Changes that affect the build system or external dependencies fix A bug fix
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

mypy broken for numpy typing
2 participants