-
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
chore: Drop Python 3.8, fix issues with CI #2566
base: main
Are you sure you want to change the base?
Changes from all commits
523b8d3
af60b9b
d9bb85c
ff2715c
2e621ff
95276cb
2dd854a
1bbbbc4
e0ebad4
e0366e5
104b4fa
40ecdc7
9688401
589d571
37234d3
42a5249
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ dynamic = ["version"] | |
description = "pure-Python HistFactory implementation with tensors and autodiff" | ||
readme = "README.rst" | ||
license = { text = "Apache-2.0" } # SPDX short identifier | ||
requires-python = ">=3.8" | ||
requires-python = ">=3.9" | ||
authors = [ | ||
{ name = "Lukas Heinrich", email = "[email protected]" }, | ||
{ name = "Matthew Feickert", email = "[email protected]" }, | ||
|
@@ -35,7 +35,6 @@ classifiers = [ | |
"Operating System :: OS Independent", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
|
@@ -68,18 +67,10 @@ Homepage = "https://github.com/scikit-hep/pyhf" | |
|
||
[project.optional-dependencies] | ||
shellcomplete = ["click_completion"] | ||
# TODO: 'tensorflow' supports all platform_machine for tensorflow v2.16.1+ | ||
# but TensorFlow only supports python_version 3.8 up through tensorflow v2.13.1. | ||
# So until Python 3.8 support is dropped, split requirments on python_version | ||
# before and after 3.9. | ||
# NOTE: macos x86 support is deprecated from tensorflow v2.17.0 onwards. | ||
tensorflow = [ | ||
# python == 3.8 | ||
"tensorflow>=2.7.0; python_version < '3.9' and platform_machine != 'arm64'", # c.f. PR #1962, #2452 | ||
"tensorflow-macos>=2.7.0; python_version < '3.9' and platform_machine == 'arm64' and platform_system == 'Darwin'", # c.f. PR #2119, #2452 | ||
"tensorflow-probability>=0.11.0; python_version < '3.9'", # c.f. PR #1657, #2452 | ||
# python >= 3.9 | ||
"tensorflow-probability[tf]>=0.24.0; python_version >= '3.9'" # c.f. PR #2452 | ||
# see https://github.com/tensorflow/probability/issues/1854 | ||
"tensorflow-probability[tf]>=0.24.0,!=0.25.0" # c.f. PR #2452 | ||
] | ||
torch = ["torch>=1.10.0"] # c.f. PR #1657 | ||
jax = [ | ||
|
@@ -251,6 +242,7 @@ warn_unused_configs = true | |
strict = true | ||
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] | ||
warn_unreachable = true | ||
plugins = "numpy.typing.mypy_plugin" | ||
|
||
[[tool.mypy.overrides]] | ||
module = [ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
""" | ||
|
||
from pyhf.infer.mle import fixed_poi_fit | ||
from pyhf import get_backend | ||
from pyhf.tensor.manager import get_backend | ||
from pyhf.infer import utils | ||
import tqdm | ||
|
||
|
@@ -120,7 +120,7 @@ def cdf(self, value): | |
>>> import pyhf | ||
>>> pyhf.set_backend("numpy") | ||
>>> bkg_dist = pyhf.infer.calculators.AsymptoticTestStatDistribution(0.0) | ||
>>> bkg_dist.cdf(0.0) | ||
>>> print(bkg_dist.cdf(0.0)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did something change RE: the way doctest works where the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, numpy changed. ubuntu-latest has numpy 2.x which gives There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. >>> import numpy as np
>>> np.__version__
'2.0.2'
>>> np.float64(0.0)
np.float64(0.0)
>>> print(np.float64(0.0))
0.0 and >>> import numpy as np
>>> np.__version__
'1.26.4'
>>> np.float64(0.0)
0.0
>>> print(np.float64(0.0))
0.0 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I understand what you mean, but I thought that we already did have ways to indicate to doc tests that it should only test on certain operating systems as we would already get different versions. Let me take the afternoon today (once I'm free from running interviews for a search I'm on) to play with this and if I can't get it then we can just accept it and move on. |
||
0.5 | ||
|
||
Args: | ||
|
@@ -619,7 +619,7 @@ def expected_value(self, nsigma): | |
>>> normal = pyhf.probability.Normal(mean, std) | ||
>>> samples = normal.sample((100,)) | ||
>>> dist = pyhf.infer.calculators.EmpiricalDistribution(samples) | ||
>>> dist.expected_value(nsigma=1) | ||
>>> print(dist.expected_value(nsigma=1)) | ||
6.15094381... | ||
|
||
>>> import pyhf | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,8 @@ class histosys_combined: | |
def __init__( | ||
self, modifiers, pdfconfig, builder_data, interpcode='code0', batch_size=None | ||
): | ||
default_backend = pyhf.default_backend | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this needed just to deal with the PyTorch warnings from Issue #2554? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's needed in order to type |
||
|
||
self.batch_size = batch_size | ||
self.interpcode = interpcode | ||
assert self.interpcode in ['code0', 'code2', 'code4p'] | ||
|
@@ -128,10 +130,13 @@ def __init__( | |
] | ||
for m in keys | ||
] | ||
self._histosys_mask = [ | ||
[[builder_data[m][s]['data']['mask']] for s in pdfconfig.samples] | ||
for m in keys | ||
] | ||
self._histosys_mask = default_backend.astensor( | ||
[ | ||
[[builder_data[m][s]['data']['mask']] for s in pdfconfig.samples] | ||
for m in keys | ||
], | ||
dtype='bool', | ||
) | ||
|
||
if histosys_mods: | ||
self.interpolator = getattr(interpolators, self.interpcode)( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm personally fine with jumping up to Python 3.9. I think though as the
0.7.6
release is still on Python 3.7 that regardless of features we should make a0.8.0
release after this that is the same as what we have in the0.7.x
series but just with non-EOL Python support. That will make multiple things easier to maintain and Python 3.9 is not new at all so I don't see that as an issue.