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

Start tracking Python PI. #2563

Merged
merged 17 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
28 changes: 14 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ jobs:
# Unit tests:
# -----------
- tox-env: py27-pip20
- tox-env: py37-pip22_3_1
- tox-env: py38-pip22_3_1
- tox-env: py311-pip23_3_2
- tox-env: py312-pip24_2
- tox-env: py313-pip24_2
- tox-env: py314-pip24_2
- tox-env: pypy310-pip24_2

# Integration tests, split most into two shards:
Expand All @@ -81,24 +81,24 @@ jobs:
# CPython 2.7 is fast enough not to require sharding.
- tox-env: py27-pip20-integration

- tox-env: py37-pip22_3_1-integration
- tox-env: py38-pip22_3_1-integration
pex-test-pos-args: --shard 1/2
- tox-env: py37-pip22_3_1-integration
- tox-env: py38-pip22_3_1-integration
pex-test-pos-args: --shard 2/2

- tox-env: py311-pip23_3_2-integration
pex-test-pos-args: --shard 1/2
- tox-env: py311-pip23_3_2-integration
pex-test-pos-args: --shard 2/2

- tox-env: py312-pip24_2-integration
- tox-env: py313-pip24_2-integration
pex-test-pos-args: --shard 1/2
- tox-env: py312-pip24_2-integration
- tox-env: py313-pip24_2-integration
pex-test-pos-args: --shard 2/2

- tox-env: py313-pip24_2-integration
- tox-env: py314-pip24_2-integration
pex-test-pos-args: --shard 1/2
- tox-env: py313-pip24_2-integration
- tox-env: py314-pip24_2-integration
pex-test-pos-args: --shard 2/2

- tox-env: pypy310-pip24_2-integration
Expand Down Expand Up @@ -145,15 +145,15 @@ jobs:
strategy:
matrix:
include:
- python-version: [ 3, 12 ]
tox-env: py312-pip24_2
- python-version: [ 3, 13 ]
tox-env: py313-pip24_2
tox-env-python: python3.11
- python-version: [ 3, 12 ]
tox-env: py312-pip24_2-integration
- python-version: [ 3, 13 ]
tox-env: py313-pip24_2-integration
tox-env-python: python3.11
pex-test-pos-args: --shard 1/2
- python-version: [ 3, 12 ]
tox-env: py312-pip24_2-integration
- python-version: [ 3, 13 ]
tox-env: py313-pip24_2-integration
tox-env-python: python3.11
pex-test-pos-args: --shard 2/2
steps:
Expand Down
1,949 changes: 977 additions & 972 deletions .test_timings

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docker/base/install_pythons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ PYENV_VERSIONS=(
3.10.15
3.12.7
3.13.0
3.14.0a1
pypy2.7-7.3.17
pypy3.5-7.0.0
pypy3.6-7.3.3
Expand Down
4 changes: 2 additions & 2 deletions pex/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ def from_binary(
raise cls.IdentificationError("Failed to identify {}: {}".format(binary, e))

@classmethod
def _matches_binary_name(cls, path):
def matches_binary_name(cls, path):
# type: (str) -> bool
basefile = os.path.basename(path)
return any(matcher.match(basefile) is not None for matcher in cls._REGEXEN)
Expand Down Expand Up @@ -1202,7 +1202,7 @@ def _find(
Returns an iterator over PythonInterpreter objects.
"""
return cls._identify_interpreters(
filter=path_filter or cls._matches_binary_name, paths=paths, error_handler=error_handler
filter=path_filter or cls.matches_binary_name, paths=paths, error_handler=error_handler
)

@overload
Expand Down
1 change: 1 addition & 0 deletions pex/interpreter_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ def iter_compatible_versions(
PythonVersion(Lifecycle.STABLE, 3, 11, 10),
PythonVersion(Lifecycle.STABLE, 3, 12, 7),
PythonVersion(Lifecycle.STABLE, 3, 13, 0),
PythonVersion(Lifecycle.DEV, 3, 14, 0),
)


Expand Down
2 changes: 1 addition & 1 deletion pex/pip/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def values(cls):
version="24.2",
setuptools_version="71.1.0",
wheel_version="0.43.0",
requires_python=">=3.8,<3.14",
requires_python=">=3.8,<3.15",
)

VENDORED = v20_3_4_patched
Expand Down
7 changes: 6 additions & 1 deletion pex/sh_boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,12 @@ def create_sh_boot_script(
python_args = list(pex_info.inject_python_args) # type: List[str]
if python_shebang:
shebang = python_shebang[2:] if python_shebang.startswith("#!") else python_shebang
args = shlex.split(shebang)
# Drop leading `/usr/bin/env [args]?`.
args = list(
itertools.dropwhile(
lambda word: not PythonInterpreter.matches_binary_name(word), shlex.split(shebang)
)
)
python = args[0]
python_args.extend(args[1:])
venv_python_args = python_args[:]
Expand Down
6 changes: 6 additions & 0 deletions testing/pytest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# Copyright 2024 Pex project contributors.
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import absolute_import

import os

IS_CI = "true" == os.environ.get("CI", "false")
21 changes: 21 additions & 0 deletions testing/pythonPI.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 Pex project contributors.
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import absolute_import

import sys

import pytest

# Utilities related to Pex Python PI support bring-up.
# These will all be removed as tracked by https://github.com/pex-tool/pex/issues/2564

skip_flit_core_39 = pytest.mark.skipif(
sys.version_info[:2] >= (3, 14),
reason=(
"As of its latest 3.9.0 release, flit_core relies on ast.Str which was removed in Python "
"3.14. This was fixed in"
"https://github.com/pypa/flit/commit/6ab62c91d0db451b5e9ab000f0dba5471550b442 and will be "
"released in 3.10 at which point this skip can be removed."
),
)
15 changes: 14 additions & 1 deletion testing/scie.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Copyright 2024 Pex project contributors.
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import absolute_import

import pytest

from pex.scie import SciePlatform
from testing import IS_PYPY, PY_VER

Expand All @@ -18,4 +22,13 @@ def has_provider():
else:
return PY_VER >= (3, 6)
else:
return (3, 8) <= PY_VER < (3, 13)
return (3, 9) <= PY_VER < (3, 14)


skip_if_no_provider = pytest.mark.skipif(
not has_provider(),
reason=(
"Either A PBS or PyPy release must be available for the current interpreter to run this "
"test."
),
)
17 changes: 5 additions & 12 deletions tests/integration/cli/commands/test_issue_2098.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,18 @@
from pex.common import safe_open, touch
from pex.compatibility import commonpath
from pex.interpreter import PythonInterpreter
from pex.typing import TYPE_CHECKING
from testing import run_pex_command
from testing.cli import run_pex3

if TYPE_CHECKING:
from typing import Any
from testing.pytest.tmp import Tempdir


def test_missing_download_lock_analysis_handling(
tmpdir, # type: Any
tmpdir, # type: Tempdir
py310, # type: PythonInterpreter
):
# type: (...) -> None

my_feast = os.path.join(str(tmpdir), "intermediary")
my_feast = tmpdir.join("intermediary")
touch(os.path.join(my_feast, "README.rst"))
with safe_open(os.path.join(my_feast, "pyproject.toml"), "w") as fp:
fp.write(
Expand All @@ -49,15 +46,10 @@ def test_missing_download_lock_analysis_handling(
)
)

pex_root = os.path.join(str(tmpdir), "pex_root")
lock = os.path.join(str(tmpdir), "lock.json")
lock = tmpdir.join("lock.json")
run_pex3(
"lock",
"create",
"--pex-root",
pex_root,
"--python-path",
py310.binary,
"--interpreter-constraint",
"==3.10.*",
"--style",
Expand All @@ -76,6 +68,7 @@ def test_missing_download_lock_analysis_handling(
lock,
).assert_success()

pex_root = tmpdir.join("pex_root")
result = run_pex_command(
args=[
"--pex-root",
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/cli/commands/test_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
)
from testing.build_system import hatchling_only_supports_37_and_greater
from testing.cli import run_pex3
from testing.pythonPI import skip_flit_core_39
from testing.resolve import normalize_locked_resolve

if TYPE_CHECKING:
Expand Down Expand Up @@ -251,6 +252,7 @@ def test_create_universal_python_unsupported():
) == result.error


@skip_flit_core_39
def test_create_universal_platform_check(tmpdir):
# type: (Any) -> None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def reproducibility_hostile_project(tmpdir):
"""\
[build-system]
requires = ["setuptools"]
backend = "setuptools.build_meta"
build-backend = "setuptools.build_meta"
"""
)
)
Expand Down
16 changes: 8 additions & 8 deletions tests/integration/cli/commands/test_lock_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -1276,9 +1276,9 @@ def assert_p537_lock(


skip_unless_p537_compatible = pytest.mark.skipif(
PY_VER < (3, 6) or PY_VER >= (3, 13) or IS_PYPY or not IS_X86_64,
PY_VER < (3, 6) or PY_VER >= (3, 15) or IS_PYPY or not IS_X86_64,
reason=(
"The p537 1.0.7 release only supports CPython >=3.6,<3.13 and only has published wheels "
"The p537 1.0.8 release only supports CPython >=3.6,<3.13 and only has published wheels "
"for Linux and Mac x86_64"
),
)
Expand Down Expand Up @@ -1309,7 +1309,7 @@ def test_sync_strict_to_strict(tmpdir):

lock = os.path.join(str(tmpdir), "lock.json")
run_pex3(
"lock", "sync", "--style", "strict", "p537==1.0.7", "--indent", "2", "--lock", lock
"lock", "sync", "--style", "strict", "p537==1.0.8", "--indent", "2", "--lock", lock
).assert_success()
p537_current = assert_p537_lock(
lock, LockStyle.STRICT, expected_python_tag=python_tag(), expected_abi_tag=abi_tag()
Expand All @@ -1328,7 +1328,7 @@ def test_sync_strict_to_strict(tmpdir):
other_python,
"--style",
"strict",
"p537==1.0.7",
"p537==1.0.8",
"--indent",
"2",
"--lock",
Expand All @@ -1350,7 +1350,7 @@ def test_sync_strict_to_sources(tmpdir):

lock = os.path.join(str(tmpdir), "lock.json")
run_pex3(
"lock", "sync", "--style", "strict", "p537==1.0.7", "--indent", "2", "--lock", lock
"lock", "sync", "--style", "strict", "p537==1.0.8", "--indent", "2", "--lock", lock
).assert_success()
p537_strict = assert_p537_lock(
lock, LockStyle.STRICT, expected_python_tag=python_tag(), expected_abi_tag=abi_tag()
Expand All @@ -1359,7 +1359,7 @@ def test_sync_strict_to_sources(tmpdir):
p537_strict_tag, p537_strict_wheel = next(iter(p537_strict.artifacts_by_tag.items()))

run_pex3(
"lock", "sync", "--style", "sources", "p537==1.0.7", "--indent", "2", "--lock", lock
"lock", "sync", "--style", "sources", "p537==1.0.8", "--indent", "2", "--lock", lock
).assert_success()
p537_sources = assert_p537_lock(
lock, LockStyle.SOURCES, expected_python_tag=python_tag(), expected_abi_tag=abi_tag()
Expand All @@ -1386,7 +1386,7 @@ def test_sync_universal_to_universal(tmpdir):
"universal",
"--interpreter-constraint",
"CPython==3.10.*",
"p537==1.0.7",
"p537==1.0.8",
"--indent",
"2",
"--lock",
Expand All @@ -1411,7 +1411,7 @@ def test_sync_universal_to_universal(tmpdir):
"universal",
"--interpreter-constraint",
"CPython==3.11.*",
"p537==1.0.7",
"p537==1.0.8",
"--indent",
"2",
"--lock",
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/resolve/test_issue_1907.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def local_project(tmpdir):
"""\
[build-system]
requires = ["setuptools"]
backend = "setuptools.build_meta"
build-backend = "setuptools.build_meta"

[project]
name = "app"
Expand Down
28 changes: 15 additions & 13 deletions tests/integration/scie/test_pex_scie.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
from pex.targets import LocalInterpreter
from pex.typing import TYPE_CHECKING
from pex.version import __version__
from testing import IS_PYPY, PY_VER, make_env, run_pex_command, scie
from testing import IS_PYPY, PY_VER, make_env, run_pex_command
from testing.scie import skip_if_no_provider

if TYPE_CHECKING:
from typing import Any, Iterable, List
Expand Down Expand Up @@ -82,16 +83,25 @@ def test_basic(
re_flags=re.DOTALL | re.MULTILINE,
)
return
if PY_VER == (3, 8) or PY_VER >= (3, 14):
result.assert_failure(
expected_error_re=(
r".*"
r"^Failed to build 1 scie:$"
r".*"
r"^Provider: No released assets found for release [0-9]{{8}} Python {version} "
r"of flavor install_only\.$".format(version=".".join(map(str, PY_VER)))
),
re_flags=re.DOTALL | re.MULTILINE,
)
return
result.assert_success()

scie = os.path.join(str(tmpdir), "cowsay")
assert b"| PAR! |" in subprocess.check_output(args=[scie, "PAR!"], env=make_env(PATH=None))


@pytest.mark.skipif(
(PY_VER < (3, 8) and not IS_PYPY) or PY_VER >= (3, 13),
reason="Scie output is not supported for {interpreter}".format(interpreter=sys.version),
)
@skip_if_no_provider
@pytest.mark.skipif(
not any(
is_exe(os.path.join(entry, "shasum"))
Expand Down Expand Up @@ -525,14 +535,6 @@ def bar(tmpdir):
return make_project(tmpdir, "bar")


skip_if_no_provider = pytest.mark.skipif(
not scie.has_provider(),
reason=(
"Either A PBS or PyPy release must be available for the current interpreter to run this test."
),
)


@skip_if_no_provider
@pytest.mark.parametrize(
"execution_mode_args",
Expand Down
Loading