-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Add TYPE_CHECKING guard for numpy.typing #2208
Merged
Merged
Conversation
This file contains 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
* The addition of typing.TYPE_CHECKING avoids situations in which the version of NumPy (whose lower bounds is enforced by SciPy) doesn't have numpy.typing, which was added in NumPy v1.21.0.
matthewfeickert
added
fix
A bug fix
need-to-backport
tmp label until can be backported to patch release branch
labels
May 17, 2023
Example of things working: $ docker run --rm -ti python:3.8 /bin/bash
root@34efcf32f365:/# python -m venv venv && . venv/bin/activate
(venv) root@34efcf32f365:/# python -m pip --quiet install --upgrade pip setuptools wheel
(venv) root@34efcf32f365:/# python -m pip --quiet install --upgrade 'numpy==1.17.3' 'scipy==1.5.1'
venv) root@34efcf32f365:/# git clone --branch fix/guard-numpy-typing --single-branch https://github.com/scikit-hep/pyhf
Cloning into 'pyhf'...
...
(venv) root@34efcf32f365:/# cd pyhf
(venv) root@34efcf32f365:/pyhf# python -m pip --quiet install --upgrade .
(venv) root@34efcf32f365:/pyhf# cd
(venv) root@34efcf32f365:~# python -m pip list | grep 'numpy\|scipy'
numpy 1.17.3
scipy 1.5.1
(venv) root@34efcf32f365:~# python -c 'import pyhf'
(venv) root@34efcf32f365:~# echo $?
0 |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2208 +/- ##
=======================================
Coverage 98.30% 98.30%
=======================================
Files 69 69
Lines 4533 4533
Branches 801 801
=======================================
Hits 4456 4456
Misses 45 45
Partials 32 32
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
matthewfeickert
commented
May 17, 2023
kratsg
approved these changes
May 17, 2023
kratsg
requested changes
May 17, 2023
kratsg
approved these changes
May 17, 2023
4 tasks
matthewfeickert
removed
the
need-to-backport
tmp label until can be backported to patch release branch
label
May 18, 2023
matthewfeickert
added a commit
that referenced
this pull request
May 18, 2023
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.
Description
Resolves #2207
The addition of
typing.TYPE_CHECKING
avoids situations in which the version of NumPy (whose lower bounds is enforced by SciPy) doesn't havenumpy.typing
, which was added in NumPyv1.21.0
.To avoid drops in code coverage at the patch level, exclude
if TYPE_CHECKING:
from thecoverage
report by using theexclude_also
option.Checklist Before Requesting Reviewer
Before Merging
For the PR Assignees: