diff --git a/CHANGES.md b/CHANGES.md index 7c981e305..e6ac53355 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,12 @@ # Release Notes +## 2.97.0 + +This release adds support for using `--scie-pbs-stripped` in combination with +`--scie-pbs-free-threaded`. + +* Support PBS free-threaded `install_only(_stripped)`. (#3197) + ## 2.96.2 This release fixes `--scie-only` for foreign platforms. diff --git a/pex/scie/__init__.py b/pex/scie/__init__.py index 9a157d463..95fe3a231 100644 --- a/pex/scie/__init__.py +++ b/pex/scie/__init__.py @@ -361,8 +361,7 @@ def register_options( help=( "Should the Python Standalone Builds CPython distributions be free-threaded. If left " "unspecified or otherwise turned off, creating a scie from a PEX with free-threaded " - "abi wheels will automatically turn this option on. Note that this option is not " - "compatible with `--scie-pbs-stripped`." + "abi wheels will automatically turn this option on." ), ) parser.add_argument( @@ -388,7 +387,7 @@ def register_options( "Should the Python Standalone Builds CPython distributions used be stripped of debug " "symbols or not. For Linux and Windows particularly, the stripped distributions are " "less than half the size of the distributions that ship with debug symbols. Note that " - "this option is not compatible with `--scie-pbs-free-threaded` or `--scie-pbs-debug`." + "this option is not compatible with `--scie-pbs-debug`." ), ) parser.add_argument( @@ -588,10 +587,9 @@ def extract_options(options): ) ) - if options.scie_pbs_stripped and (options.scie_pbs_free_threaded or options.scie_pbs_debug): + if options.scie_pbs_stripped and options.scie_pbs_debug: raise ValueError( - "Python Standalone Builds does not release stripped distributions for debug or " - "free-threaded builds." + "Python Standalone Builds does not release stripped distributions for debug builds." ) science_binary = None # type: Optional[Union[File, Url]] diff --git a/pex/scie/science.py b/pex/scie/science.py index f64310131..ba3098c7f 100644 --- a/pex/scie/science.py +++ b/pex/scie/science.py @@ -7,6 +7,7 @@ import re import shutil import subprocess +import time from collections import OrderedDict from subprocess import CalledProcessError @@ -69,7 +70,7 @@ def qualified_binary_name(self, binary_name): SCIENCE_RELEASES_URL = "https://github.com/a-scie/lift/releases" -MIN_SCIENCE_VERSION = Version("0.18.1") +MIN_SCIENCE_VERSION = Version("0.19.0") SCIENCE_REQUIREMENT = SpecifierSet("~={min_version}".format(min_version=MIN_SCIENCE_VERSION)) @@ -441,9 +442,20 @@ def configuration_binding( interpreter_config["base_url"] = "/".join( (configuration.options.assets_base_url, "providers", str(interpreter.provider)) ) - if Provider.PythonBuildStandalone is interpreter.provider and not ( - configuration.options.pbs_debug or pbs_free_threaded + + install_only_available = Provider.PythonBuildStandalone is interpreter.provider + if install_only_available and configuration.options.pbs_debug: + install_only_available = False + if ( + install_only_available + and pbs_free_threaded + and interpreter.release + and time.strptime(interpreter.release, "%Y%m%d") < time.strptime("20260320", "%Y%m%d") ): + # N.B.: Builds for free-threaded gained install_only & install_only_stripped flavors as + # of https://github.com/astral-sh/python-build-standalone/releases/tag/20260320 + install_only_available = False + if install_only_available: interpreter_config.update( flavor=( "install_only_stripped" diff --git a/pex/version.py b/pex/version.py index ca32b552c..cb276ca69 100644 --- a/pex/version.py +++ b/pex/version.py @@ -1,4 +1,4 @@ # Copyright 2015 Pex project contributors. # Licensed under the Apache License, Version 2.0 (see LICENSE). -__version__ = "2.96.2" +__version__ = "2.97.0" diff --git a/tests/integration/scie/test_pex_scie.py b/tests/integration/scie/test_pex_scie.py index 99f8bdec8..a44129f64 100644 --- a/tests/integration/scie/test_pex_scie.py +++ b/tests/integration/scie/test_pex_scie.py @@ -350,7 +350,7 @@ def test_specified_science_binary(tmpdir): local_science_binary = os.path.join(str(tmpdir), "science") with open(local_science_binary, "wb") as write_fp, URLFetcher().get_body_stream( - "https://github.com/a-scie/lift/releases/download/v0.18.1/{binary}".format( + "https://github.com/a-scie/lift/releases/download/v0.19.0/{binary}".format( binary=SysPlatform.CURRENT.qualified_binary_name("science") ) ) as read_fp: @@ -394,7 +394,7 @@ def test_specified_science_binary(tmpdir): cached_science_binaries ), "Expected the local science binary to be used but not cached." assert ( - "0.18.1" + "0.19.0" == subprocess.check_output(args=[local_science_binary, "--version"]).decode("utf-8").strip() ) @@ -1349,6 +1349,9 @@ def test_free_threaded_scie_auto_detected(tmpdir): "eager", "--scie-only", "--scie-pbs-free-threaded", + # N.B.: Exercise selection of old free-threaded -full builds. + "--scie-pbs-release", + "20260310", "-o", free_threaded_python, ] @@ -1356,7 +1359,16 @@ def test_free_threaded_scie_auto_detected(tmpdir): scie = tmpdir.join("scie") run_pex_command( - args=["--scie", "eager", "psutil", "--scie-only", "-o", scie], + args=[ + "--scie", + "eager", + "psutil", + "--scie-only", + # N.B.: Exercise selection of newer free-threaded install_only(_stripped) builds. + "--scie-pbs-stripped", + "-o", + scie, + ], python=free_threaded_python, use_pex_whl_venv=False, ).assert_success()