Skip to content

Commit

Permalink
Merge branch 'main' into diagnostic-error-on-pip-uninstall
Browse files Browse the repository at this point in the history
  • Loading branch information
notatallshaw authored Oct 20, 2024
2 parents faf02ac + 53ba3fb commit 49c8196
Show file tree
Hide file tree
Showing 86 changed files with 436 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ jobs:
# - "3.9"
# - "3.10"
# - "3.11"
- "3.12" # Comment out when 3.13 is final
# - "3.12"
- "3.13"
group: [1, 2]

Expand Down
28 changes: 21 additions & 7 deletions docs/html/development/ci.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pip support a variety of Python interpreters:
- CPython 3.10
- CPython 3.11
- CPython 3.12
- CPython 3.13
- Latest PyPy3

on different operating systems:
Expand All @@ -35,8 +36,9 @@ and on different architectures:

- x64
- x86
- arm64 (macOS only)

so 42 hypothetical interpreters.
so 49 hypothetical interpreters.


Checks
Expand Down Expand Up @@ -99,6 +101,8 @@ Actual testing
| | +-------+---------------+-----------------+
| | | CP3.12| | |
| | +-------+---------------+-----------------+
| | | CP3.13| | |
| | +-------+---------------+-----------------+
| | | PyPy3 | | |
| Windows +----------+-------+---------------+-----------------+
| | x64 | CP3.8 | GitHub | GitHub |
Expand All @@ -107,10 +111,12 @@ Actual testing
| | +-------+---------------+-----------------+
| | | CP3.10| | |
| | +-------+---------------+-----------------+
| | | CP3.11| GitHub | GitHub |
| | | CP3.11| | |
| | +-------+---------------+-----------------+
| | | CP3.12| | |
| | +-------+---------------+-----------------+
| | | CP3.13| GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | PyPy3 | | |
+-----------+----------+-------+---------------+-----------------+
| | x86 | CP3.8 | | |
Expand All @@ -123,6 +129,8 @@ Actual testing
| | +-------+---------------+-----------------+
| | | CP3.12| | |
| | +-------+---------------+-----------------+
| | | CP3.13| | |
| | +-------+---------------+-----------------+
| | | PyPy3 | | |
| Linux +----------+-------+---------------+-----------------+
| | x64 | CP3.8 | GitHub | GitHub |
Expand All @@ -135,17 +143,21 @@ Actual testing
| | +-------+---------------+-----------------+
| | | CP3.12| GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | CP3.13| GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | PyPy3 | | |
+-----------+----------+-------+---------------+-----------------+
| | arm64 | CP3.8 | | |
| | arm64 | CP3.8 | GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | CP3.9 | | |
| | | CP3.9 | GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | CP3.10| | |
| | | CP3.10| GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | CP3.11| | |
| | | CP3.11| GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | CP3.12| | |
| | | CP3.12| GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | CP3.13| GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | PyPy3 | | |
| macOS +----------+-------+---------------+-----------------+
Expand All @@ -159,5 +171,7 @@ Actual testing
| | +-------+---------------+-----------------+
| | | CP3.12| GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | CP3.13| GitHub | GitHub |
| | +-------+---------------+-----------------+
| | | PyPy3 | | |
+-----------+----------+-------+---------------+-----------------+
2 changes: 1 addition & 1 deletion docs/html/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ $ pip install --upgrade pip
The current version of pip works on:

- Windows, Linux and macOS.
- CPython 3.8, 3.9, 3.10, 3.11, 3.12, and latest PyPy3.
- CPython 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, 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
1 change: 1 addition & 0 deletions news/12678.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update classifier to support Python 3.13
1 change: 1 addition & 0 deletions news/12939.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update non PEP 440 wheel filename deprecation notice.
1 change: 1 addition & 0 deletions news/12961.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support for PEP 730 iOS wheels was added.
1 change: 1 addition & 0 deletions news/12974.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Create two new import groups, "vendored" and "import", this only affects tests.
1 change: 1 addition & 0 deletions news/13012.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Clean up non PEP 440 wheel filename deprecation language.
1 change: 1 addition & 0 deletions news/13013.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove InvalidVersion exception catch for parse_{sdist,wheel}_filename.
1 change: 1 addition & 0 deletions news/truststore.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade truststore to 0.9.2
17 changes: 14 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
Expand Down Expand Up @@ -185,9 +186,19 @@ select = [
]

[tool.ruff.lint.isort]
# Explicitly make tests "first party" as it's not in the "src" directory
known-first-party = ["tests"]
known-third-party = ["pip._vendor"]
section-order = [
"future",
"standard-library",
"third-party",
"vendored",
"first-party",
"tests",
"local-folder",
]

[tool.ruff.lint.isort.sections]
"vendored" = ["pip._vendor"]
"tests" = ["tests"]

[tool.ruff.lint.mccabe]
max-complexity = 33 # default is 10
Expand Down
5 changes: 2 additions & 3 deletions src/pip/_internal/index/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from pip._vendor.packaging.utils import (
InvalidSdistFilename,
InvalidVersion,
InvalidWheelFilename,
canonicalize_name,
parse_sdist_filename,
Expand Down Expand Up @@ -68,10 +67,10 @@ def _scan_directory(self) -> None:
# otherwise not worth considering as a package
try:
project_filename = parse_wheel_filename(entry.name)[0]
except (InvalidWheelFilename, InvalidVersion):
except InvalidWheelFilename:
try:
project_filename = parse_sdist_filename(entry.name)[0]
except (InvalidSdistFilename, InvalidVersion):
except InvalidSdistFilename:
continue

self._project_name_to_urls[project_filename].append(url)
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/metadata/importlib/_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def _emit_egg_deprecation(location: Optional[str]) -> None:
deprecated(
reason=f"Loading egg at {location} is deprecated.",
replacement="to use pip for package installation",
gone_in="24.3",
gone_in="25.1",
issue=12330,
)

Expand Down
36 changes: 22 additions & 14 deletions src/pip/_internal/models/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
from typing import Dict, Iterable, List

from pip._vendor.packaging.tags import Tag
from pip._vendor.packaging.utils import (
InvalidWheelFilename as PackagingInvalidWheelName,
)
from pip._vendor.packaging.utils import parse_wheel_filename

from pip._internal.exceptions import InvalidWheelFilename
from pip._internal.utils.deprecation import deprecated
Expand All @@ -32,20 +36,24 @@ def __init__(self, filename: str) -> None:
self.name = wheel_info.group("name").replace("_", "-")
_version = wheel_info.group("ver")
if "_" in _version:
deprecated(
reason=(
f"Wheel filename {filename!r} uses an invalid filename format, "
f"as the version part {_version!r} is not correctly normalised, "
"and contains an underscore character. Future versions of pip may "
"fail to recognise this wheel."
),
replacement=(
"rename the wheel to use a correctly normalised version part "
"(this may require updating the version in the project metadata)"
),
gone_in="25.1",
issue=12914,
)
try:
parse_wheel_filename(filename)
except PackagingInvalidWheelName as e:
deprecated(
reason=(
f"Wheel filename {filename!r} is not correctly normalised. "
"Future versions of pip will raise the following error:\n"
f"{e.args[0]}\n\n"
),
replacement=(
"to rename the wheel to use a correctly normalised "
"name (this may require updating the version in "
"the project metadata)"
),
gone_in="25.1",
issue=12938,
)

_version = _version.replace("_", "-")

self.version = _version
Expand Down
27 changes: 25 additions & 2 deletions src/pip/_internal/utils/compatibility_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
generic_tags,
interpreter_name,
interpreter_version,
ios_platforms,
mac_platforms,
)

_osx_arch_pat = re.compile(r"(.+)_(\d+)_(\d+)_(.+)")
_apple_arch_pat = re.compile(r"(.+)_(\d+)_(\d+)_(.+)")


def version_info_to_nodot(version_info: Tuple[int, ...]) -> str:
Expand All @@ -24,7 +25,7 @@ def version_info_to_nodot(version_info: Tuple[int, ...]) -> str:


def _mac_platforms(arch: str) -> List[str]:
match = _osx_arch_pat.match(arch)
match = _apple_arch_pat.match(arch)
if match:
name, major, minor, actual_arch = match.groups()
mac_version = (int(major), int(minor))
Expand All @@ -43,6 +44,26 @@ def _mac_platforms(arch: str) -> List[str]:
return arches


def _ios_platforms(arch: str) -> List[str]:
match = _apple_arch_pat.match(arch)
if match:
name, major, minor, actual_multiarch = match.groups()
ios_version = (int(major), int(minor))
arches = [
# Since we have always only checked that the platform starts
# with "ios", for backwards-compatibility we extract the
# actual prefix provided by the user in case they provided
# something like "ioscustom_". It may be good to remove
# this as undocumented or deprecate it in the future.
"{}_{}".format(name, arch[len("ios_") :])
for arch in ios_platforms(ios_version, actual_multiarch)
]
else:
# arch pattern didn't match (?!)
arches = [arch]
return arches


def _custom_manylinux_platforms(arch: str) -> List[str]:
arches = [arch]
arch_prefix, arch_sep, arch_suffix = arch.partition("_")
Expand All @@ -68,6 +89,8 @@ def _get_custom_platforms(arch: str) -> List[str]:
arch_prefix, arch_sep, arch_suffix = arch.partition("_")
if arch.startswith("macosx"):
arches = _mac_platforms(arch)
elif arch.startswith("ios"):
arches = _ios_platforms(arch)
elif arch_prefix in ["manylinux2014", "manylinux2010"]:
arches = _custom_manylinux_platforms(arch)
else:
Expand Down
6 changes: 6 additions & 0 deletions src/pip/_vendor/distlib/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ def _build_shebang(self, executable, post_interp):
"""
if os.name != 'posix':
simple_shebang = True
elif getattr(sys, "cross_compiling", False):
# In a cross-compiling environment, the shebang will likely be a
# script; this *must* be invoked with the "safe" version of the
# shebang, or else using os.exec() to run the entry script will
# fail, raising "OSError 8 [Errno 8] Exec format error".
simple_shebang = False
else:
# Add 3 for '#!' prefix and newline suffix.
shebang_length = len(executable) + len(post_interp) + 3
Expand Down
Loading

0 comments on commit 49c8196

Please sign in to comment.