Skip to content

Commit

Permalink
Drop support for EOL Python 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Apr 10, 2023
1 parent aebc0c5 commit 99d1322
Show file tree
Hide file tree
Showing 31 changed files with 59 additions and 180 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ jobs:
matrix:
os: [Ubuntu, MacOS]
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand Down Expand Up @@ -153,9 +152,8 @@ jobs:
matrix:
os: [Windows]
python:
- "3.7"
- "3.8"
# Commented out, since Windows tests are expensively slow.
# - "3.8"
# - "3.9"
# - "3.10"
- "3.11"
Expand Down
42 changes: 22 additions & 20 deletions docs/html/development/ci.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ Supported interpreters

pip support a variety of Python interpreters:

- CPython 3.7
- CPython 3.8
- CPython 3.9
- CPython 3.10
- CPython 3.11
- Latest PyPy3

on different operating systems:
Expand Down Expand Up @@ -88,61 +88,63 @@ Actual testing
+------------------------------+---------------+-----------------+
| **interpreter** | **unit** | **integration** |
+-----------+----------+-------+---------------+-----------------+
| | x86 | CP3.7 | | |
| | +-------+---------------+-----------------+
| | | CP3.8 | | |
| | x86 | CP3.8 | | |
| | +-------+---------------+-----------------+
| | | CP3.9 | | |
| | +-------+---------------+-----------------+
| | | CP3.10| | |
| | +-------+---------------+-----------------+
| | | CP3.11| | |
| | +-------+---------------+-----------------+
| | | PyPy3 | | |
| Windows +----------+-------+---------------+-----------------+
| | x64 | CP3.7 | GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | CP3.8 | | |
| | x64 | CP3.8 | GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | CP3.9 | | |
| | +-------+---------------+-----------------+
| | | CP3.10| GitHub | GitHub |
| | | CP3.10| | |
| | +-------+---------------+-----------------+
| | | CP3.11| GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | PyPy3 | | |
+-----------+----------+-------+---------------+-----------------+
| | x86 | CP3.7 | | |
| | +-------+---------------+-----------------+
| | | CP3.8 | | |
| | x86 | CP3.8 | | |
| | +-------+---------------+-----------------+
| | | CP3.9 | | |
| | +-------+---------------+-----------------+
| | | CP3.10| | |
| | +-------+---------------+-----------------+
| | | CP3.11| | |
| | +-------+---------------+-----------------+
| | | PyPy3 | | |
| Linux +----------+-------+---------------+-----------------+
| | x64 | CP3.7 | GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | CP3.8 | GitHub | GitHub |
| | x64 | CP3.8 | GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | CP3.9 | GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | CP3.10| GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | CP3.11| GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | PyPy3 | | |
+-----------+----------+-------+---------------+-----------------+
| | arm64 | CP3.7 | | |
| | +-------+---------------+-----------------+
| | | CP3.8 | | |
| | arm64 | CP3.8 | | |
| | +-------+---------------+-----------------+
| | | CP3.9 | | |
| | +-------+---------------+-----------------+
| | | CP3.10| | |
| | +-------+---------------+-----------------+
| | | CP3.11| | |
| | +-------+---------------+-----------------+
| | | PyPy3 | | |
| macOS +----------+-------+---------------+-----------------+
| | x64 | CP3.7 | GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | CP3.8 | GitHub | GitHub |
| | x64 | CP3.8 | GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | CP3.9 | GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | CP3.10| GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | CP3.11| GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | PyPy3 | | |
+-----------+----------+-------+---------------+-----------------+
4 changes: 2 additions & 2 deletions docs/html/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ $ pip install --upgrade pip

The current version of pip works on:

- Windows, Linux and MacOS.
- CPython 3.7, 3.8, 3.9, 3.10 and latest PyPy3.
- Windows, Linux and macOS.
- CPython 3.8, 3.9, 3.10, 3.11 and latest PyPy3.

pip is tested to work on the latest patch version of the Python interpreter,
for each of the minor versions listed above. Previous patch versions are
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def should_update_common_wheels() -> bool:
# -----------------------------------------------------------------------------
# Development Commands
# -----------------------------------------------------------------------------
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "pypy3"])
@nox.session(python=["3.8", "3.9", "3.10", "3.11", "pypy3"])
def test(session: nox.Session) -> None:
# Get the common wheels.
if should_update_common_wheels():
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def get_version(rel_path: str) -> str:
"Programming Language :: Python",
"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 Down Expand Up @@ -83,5 +82,5 @@ def get_version(rel_path: str) -> str:
zip_safe=False,
# NOTE: python_requires is duplicated in __pip-runner__.py.
# When changing this value, please change the other copy as well.
python_requires=">=3.7",
python_requires=">=3.8",
)
2 changes: 1 addition & 1 deletion src/pip/__pip-runner__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import sys

# Copied from setup.py
PYTHON_REQUIRES = (3, 7)
PYTHON_REQUIRES = (3, 8)


def version_str(version): # type: ignore
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/commands/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import xmlrpc.client
from collections import OrderedDict
from optparse import Values
from typing import TYPE_CHECKING, Dict, List, Optional
from typing import TYPE_CHECKING, Dict, List, Optional, TypedDict

from pip._vendor.packaging.version import parse as parse_version

Expand All @@ -20,7 +20,6 @@
from pip._internal.utils.misc import write_output

if TYPE_CHECKING:
from typing import TypedDict

class TransformedHit(TypedDict):
name: str
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/distributions/sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def _install_build_reqs(self, finder: PackageFinder) -> None:
if (
self.req.editable
and self.req.permit_editable_wheels
and self.req.supports_pyproject_editable()
and self.req.supports_pyproject_editable
):
build_reqs = self._get_build_requires_editable()
else:
Expand Down
3 changes: 1 addition & 2 deletions src/pip/_internal/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import re
import sys
from itertools import chain, groupby, repeat
from typing import TYPE_CHECKING, Dict, Iterator, List, Optional, Union
from typing import TYPE_CHECKING, Dict, Iterator, List, Literal, Optional, Union

from pip._vendor.requests.models import Request, Response
from pip._vendor.rich.console import Console, ConsoleOptions, RenderResult
Expand All @@ -22,7 +22,6 @@

if TYPE_CHECKING:
from hashlib import _Hash
from typing import Literal

from pip._internal.metadata import BaseDistribution
from pip._internal.req.req_install import InstallRequirement
Expand Down
7 changes: 1 addition & 6 deletions src/pip/_internal/index/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
from html.parser import HTMLParser
from optparse import Values
from typing import (
TYPE_CHECKING,
Callable,
Dict,
Iterable,
List,
MutableMapping,
NamedTuple,
Optional,
Protocol,
Sequence,
Tuple,
Union,
Expand All @@ -42,11 +42,6 @@

from .sources import CandidatesFromPage, LinkSource, build_source

if TYPE_CHECKING:
from typing import Protocol
else:
Protocol = object

logger = logging.getLogger(__name__)

ResponseHeaders = MutableMapping[str, str]
Expand Down
11 changes: 0 additions & 11 deletions src/pip/_internal/locations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,17 +336,6 @@ def get_scheme(
if skip_linux_system_special_case:
continue

# On Python 3.7 and earlier, sysconfig does not include sys.abiflags in
# the "pythonX.Y" part of the path, but distutils does.
skip_sysconfig_abiflag_bug = (
sys.version_info < (3, 8)
and not WINDOWS
and k in ("headers", "platlib", "purelib")
and tuple(_fix_abiflags(old_v.parts)) == new_v.parts
)
if skip_sysconfig_abiflag_bug:
continue

# MSYS2 MINGW's sysconfig patch does not include the "site-packages"
# part of the path. This is incorrect and will be fixed in MSYS.
skip_msys2_mingw_bug = (
Expand Down
7 changes: 1 addition & 6 deletions src/pip/_internal/metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@
import functools
import os
import sys
from typing import TYPE_CHECKING, List, Optional, Type, cast
from typing import List, Optional, Protocol, Type, cast

from pip._internal.utils.misc import strtobool

from .base import BaseDistribution, BaseEnvironment, FilesystemWheel, MemoryWheel, Wheel

if TYPE_CHECKING:
from typing import Protocol
else:
Protocol = object

__all__ = [
"BaseDistribution",
"BaseEnvironment",
Expand Down
21 changes: 5 additions & 16 deletions src/pip/_internal/metadata/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import zipfile
from typing import (
IO,
TYPE_CHECKING,
Any,
Collection,
Container,
Expand All @@ -18,6 +17,7 @@
List,
NamedTuple,
Optional,
Protocol,
Tuple,
Union,
)
Expand All @@ -42,11 +42,6 @@

from ._json import msg_to_json

if TYPE_CHECKING:
from typing import Protocol
else:
Protocol = object

DistributionVersion = Union[LegacyVersion, Version]

InfoPath = Union[str, pathlib.PurePath]
Expand Down Expand Up @@ -386,15 +381,7 @@ def iter_entry_points(self) -> Iterable[BaseEntryPoint]:
def _metadata_impl(self) -> email.message.Message:
raise NotImplementedError()

@functools.lru_cache(maxsize=1)
def _metadata_cached(self) -> email.message.Message:
# When we drop python 3.7 support, move this to the metadata property and use
# functools.cached_property instead of lru_cache.
metadata = self._metadata_impl()
self._add_egg_info_requires(metadata)
return metadata

@property
@functools.cached_property
def metadata(self) -> email.message.Message:
"""Metadata of distribution parsed from e.g. METADATA or PKG-INFO.
Expand All @@ -403,7 +390,9 @@ def metadata(self) -> email.message.Message:
:raises NoneMetadataError: If the metadata file is available, but does
not contain valid metadata.
"""
return self._metadata_cached()
metadata = self._metadata_impl()
self._add_egg_info_requires(metadata)
return metadata

@property
def metadata_dict(self) -> Dict[str, Any]:
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/operations/install/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
List,
NewType,
Optional,
Protocol,
Sequence,
Set,
Tuple,
Expand Down Expand Up @@ -60,7 +61,6 @@
from pip._internal.utils.wheel import parse_wheel

if TYPE_CHECKING:
from typing import Protocol

class File(Protocol):
src_record_path: "RecordPath"
Expand Down
5 changes: 1 addition & 4 deletions src/pip/_internal/req/req_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
Generator,
Iterable,
List,
NoReturn,
Optional,
Tuple,
)
Expand All @@ -30,10 +31,6 @@
from pip._internal.utils.urls import get_url_scheme

if TYPE_CHECKING:
# NoReturn introduced in 3.6.2; imported only for type checking to maintain
# pip compatibility with older patch versions of Python 3.6
from typing import NoReturn

from pip._internal.index.package_finder import PackageFinder

__all__ = ["parse_requirements"]
Expand Down
6 changes: 3 additions & 3 deletions src/pip/_internal/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def name(self) -> Optional[str]:
return None
return self.req.name

@functools.lru_cache() # use cached_property in python 3.8+
@functools.cached_property
def supports_pyproject_editable(self) -> bool:
if not self.use_pep517:
return False
Expand Down Expand Up @@ -494,7 +494,7 @@ def isolated_editable_sanity_check(self) -> None:
if (
self.editable
and self.use_pep517
and not self.supports_pyproject_editable()
and not self.supports_pyproject_editable
and not os.path.isfile(self.setup_py_path)
and not os.path.isfile(self.setup_cfg_path)
):
Expand All @@ -520,7 +520,7 @@ def prepare_metadata(self) -> None:
if (
self.editable
and self.permit_editable_wheels
and self.supports_pyproject_editable()
and self.supports_pyproject_editable
):
self.metadata_directory = generate_editable_metadata(
build_env=self.build_env,
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/resolution/resolvelib/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Mapping,
NamedTuple,
Optional,
Protocol,
Sequence,
Set,
Tuple,
Expand Down Expand Up @@ -66,7 +67,6 @@
)

if TYPE_CHECKING:
from typing import Protocol

class ConflictCause(Protocol):
requirement: RequiresPythonRequirement
Expand Down
Loading

0 comments on commit 99d1322

Please sign in to comment.