Skip to content
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

feat: Drop Python 3.7 support #2044

Merged
merged 14 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10']
include:
- os: macos-latest
python-version: '3.10'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lower-bound-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
matrix:
os: [ubuntu-latest]
# minimum supported Python
python-version: ['3.7']
python-version: ['3.8']

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10']
include:
- os: macos-latest
python-version: '3.10'
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ repos:
rev: v2.38.2
hooks:
- id: pyupgrade
args: ["--py37-plus"]
args: ["--py38-plus"]

- repo: https://github.com/MarcoGorelli/absolufy-imports
rev: v0.3.1
Expand Down Expand Up @@ -66,11 +66,11 @@ repos:
hooks:
- &mypy
id: mypy
name: mypy with Python 3.7
name: mypy with Python 3.8
files: src
additional_dependencies:
['numpy', 'types-tqdm', 'click', 'types-jsonpatch', 'types-pyyaml', 'types-jsonschema', 'importlib_metadata', 'packaging']
args: ["--python-version=3.7"]
args: ["--python-version=3.8"]
- <<: *mypy
name: mypy with Python 3.10
args: ["--python-version=3.10"]
Expand Down
1 change: 0 additions & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
"Python 3",
"Python 3 Only",
"Python 3.10",
"Python 3.7",
"Python 3.8",
"Python 3.9",
"Python Implementation CPython"
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ local_scheme = "no-local-version"

[tool.black]
line-length = 88
target-version = ['py37', 'py38']
target-version = ['py38', 'py39', 'py310']
skip-string-normalization = true
include = '\.pyi?$'
exclude = '''
Expand Down Expand Up @@ -96,7 +96,7 @@ filterwarnings = [
pyupgrade = 1

[tool.nbqa.addopts]
pyupgrade = ["--py37-plus"]
pyupgrade = ["--py38-plus"]

[tool.mypy]
files = "src"
Expand Down
6 changes: 2 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ classifiers =
Topic :: Scientific/Engineering :: Physics
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Expand All @@ -33,16 +32,15 @@ packages = find_namespace:
package_dir =
= src
include_package_data = True
python_requires = >=3.7
python_requires = >=3.8
install_requires =
scipy>=1.2.0 # requires numpy, which is required by pyhf and tensorflow
scipy>=1.3.2 # requires numpy, which is required by pyhf and tensorflow
click>=8.0.0 # for console scripts
tqdm>=4.56.0 # for readxml
jsonschema>=4.15.0 # for utils
jsonpatch>=1.15
pyyaml>=5.1 # for parsing CLI equal-delimited options
importlib_resources>=1.4.0; python_version < "3.9" # for resources in schema
typing_extensions>=3.7.4.3; python_version == "3.7" # for SupportsIndex
numpy # compatible versions controlled through scipy

[options.packages.find]
Expand Down
2 changes: 1 addition & 1 deletion src/pyhf/contrib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def download(archive_url, output_directory, force=False, compress=False):
archive.write(response.content)
else:
# Support for file-like objects for tarfile.is_tarfile was added
# in Python 3.9, so as pyhf is currently Python 3.7+ then can't
# in Python 3.9, so as pyhf is currently Python 3.8+ then can't
# do tarfile.is_tarfile(BytesIO(response.content)).
# Instead, just use a 'try except' block to determine if the
# archive is a valid tarfile.
Expand Down
6 changes: 1 addition & 5 deletions src/pyhf/typing.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import os
import sys
from typing import Any, MutableSequence, Sequence, Tuple, Union

if sys.version_info >= (3, 8):
from typing import Literal, Protocol, SupportsIndex, TypedDict
else:
from typing_extensions import Literal, Protocol, SupportsIndex, TypedDict
from typing import Literal, Protocol, SupportsIndex, TypedDict
matthewfeickert marked this conversation as resolved.
Show resolved Hide resolved

__all__ = (
"PathOrStr",
Expand Down
3 changes: 1 addition & 2 deletions tests/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# core
scipy==1.2.0 # c.f. PR #1274
scipy==1.3.2 # c.f. PR #2044
click==8.0.0 # c.f. PR #1958, #1909
tqdm==4.56.0
jsonschema==4.15.0 # c.f. PR #1979
jsonpatch==1.15
pyyaml==5.1
importlib_resources==1.4.0 # c.f. PR #1979
typing-extensions==3.7.4.3 # c.f. PR #1961, #1940
# xmlio
uproot==4.1.1
# minuit
Expand Down
3 changes: 1 addition & 2 deletions tests/test_optim.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,7 @@ def test_init_pars_sync_fixed_values_minuit(mocker):
minuit = mocker.patch.object(getattr(opt_minuit, 'iminuit'), 'Minuit')
minimizer = opt._get_minimizer(None, [9, 9, 9], [(0, 10)] * 3, fixed_vals=[(0, 1)])
assert minuit.called
# python 3.7 does not have ::args attribute on ::call_args
# assert minuit.call_args.args[1] == [1, 9, 9]
assert minuit.call_args.args[1] == [1, 9, 9]
assert minuit.call_args[0][1] == [1, 9, 9]
assert minimizer.fixed == [True, False, False]

Expand Down