Skip to content

Commit

Permalink
Drop support for Python 3.7 (Qiskit#10009)
Browse files Browse the repository at this point in the history
* Drop support for Python 3.7

This updates our documentation and build processes to set Python 3.8 as
the oldest support version of Python, consistent with our policy on
Python support.

This commit also removes remaining Python-version gating, since we were
principally using this to account for differences between 3.7 and 3.8.
Several backport packages are no longer required for any suppported
Python version, because of this change.

* Remove test for multiprocessing on Mac

With Python 3.7 support now dropped, there are no versions of Python on
macOS that we expect to support with multiprocessing again.  There's no
guarantee that the hypothetical Python 10.11 (???) that this test was
previously checking would be any more valid than existing versions.

---------

Co-authored-by: Matthew Treinish <[email protected]>
  • Loading branch information
jakelishman and mtreinish authored May 5, 2023
1 parent bc288d8 commit 251c39b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

from __future__ import annotations

import sys
from collections.abc import Sequence
from typing import Literal

import numpy as np

Expand All @@ -30,11 +30,6 @@

from ..exceptions import AlgorithmError

if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal


class FiniteDiffEstimatorGradient(BaseEstimatorGradient):
"""
Expand Down
8 changes: 1 addition & 7 deletions qiskit/algorithms/gradients/finite_diff_sampler_gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

from __future__ import annotations

import sys
from collections import defaultdict
from typing import Literal, Sequence

import numpy as np

Expand All @@ -28,12 +28,6 @@

from ..exceptions import AlgorithmError

if sys.version_info >= (3, 8):
# pylint: disable=ungrouped-imports
from typing import Literal, Sequence
else:
from typing_extensions import Literal


class FiniteDiffSamplerGradient(BaseSamplerGradient):
"""
Expand Down
9 changes: 1 addition & 8 deletions qiskit/algorithms/optimizers/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,13 @@
from collections.abc import Callable
from enum import IntEnum
import logging
import sys
from typing import Any, Union
from typing import Any, Union, Protocol

import numpy as np
import scipy

from qiskit.algorithms.algorithm_result import AlgorithmResult

if sys.version_info >= (3, 8):
# pylint: disable=ungrouped-imports
from typing import Protocol
else:
from typing_extensions import Protocol

logger = logging.getLogger(__name__)

POINT = Union[float, np.ndarray]
Expand Down
12 changes: 5 additions & 7 deletions qiskit/algorithms/optimizers/p_bfgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import logging
import multiprocessing
import platform
import sys
from collections.abc import Callable
from typing import SupportsFloat

Expand Down Expand Up @@ -109,12 +108,11 @@ def minimize(
# default. The fork start method should be considered unsafe as it can
# lead to crashes.
# However P_BFGS doesn't support spawn, so we revert to single process.
if sys.version_info >= (3, 8):
num_procs = 0
logger.warning(
"For MacOS, python >= 3.8, using only current process. "
"Multiple core use not supported."
)
num_procs = 0
logger.warning(
"For MacOS, python >= 3.8, using only current process. "
"Multiple core use not supported."
)
elif platform.system() == "Windows":
num_procs = 0
logger.warning(
Expand Down

0 comments on commit 251c39b

Please sign in to comment.