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

Update pip to 25.0 #104

Closed
wants to merge 8 commits into from
Closed

Update pip to 25.0 #104

wants to merge 8 commits into from

Conversation

rez-pip-update-bot[bot]
Copy link
Contributor

@rez-pip-update-bot rez-pip-update-bot bot commented Apr 28, 2024

Update pip from 24.3.1 to 25.0.

Changelog: https://pip.pypa.io/en/stable/news/#v25-0.


This PR was created by the rez-pip-update-bot bot and the workflow located at .github/workflows/update_pip.yaml

@rez-pip-update-bot rez-pip-update-bot bot added the pip-update Automated pip update label Apr 28, 2024
Copy link

codecov bot commented Apr 28, 2024

❌ 40 Tests Failed:

Tests completed Failed Passed Skipped
2144 40 2104 40
View the top 3 failed test(s) by shortest run time
tests.test_pip::test_getPackages_with_deps[3.7.16]
Stack Traces | 0.245s run time
pythonRezPackage = '3.7.16'
rezRepo = '.../tests/data/rez_repo'
pypi = 'http://localhost:45678'

    def test_getPackages_with_deps(
        pythonRezPackage: str,
        rezRepo: str,
        pypi: str,
    ):
        """
        Test that we get all dependencies
        """
        executable, ctx = utils.getPythonRezPackageExecutablePath(pythonRezPackage, rezRepo)
        assert executable is not None
    
>       resolvedPackages = rez_pip.pip.getPackages(
            ["package_a"],
            rez_pip.pip.getBundledPip(),
            "3.11",
            executable,
            [],
            [],
            ["--index-url", pypi, "-vvv", "--retries=0"],
        )

tests/test_pip.py:197: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

packageNames = ['package_a']
pip = '.../rez-pip/rez-pip/.nox....../test-3-8/lib/python3.8.../rez_pip/data/pip.pyz'
pythonVersion = '3.11'
pythonExecutable = '.../tests/data/rez_repo/python/3.7.16....../python/bin/python3'
requirements = [], constraints = []
extraArgs = ['--index-url', 'http://localhost:45678', '-vvv', '--retries=0']

    def getPackages(
        packageNames: list[str],
        pip: str,
        pythonVersion: str,
        pythonExecutable: str,
        requirements: list[str],
        constraints: list[str],
        extraArgs: list[str],
    ) -> list[PackageInfo]:
        rez_pip.plugins.getHook().prePipResolve(
            packages=tuple(packageNames), requirements=tuple(requirements)
        )
    
        _fd, tmpFile = tempfile.mkstemp(prefix="pip-install-output", text=True)
        os.close(_fd)
        # We can't with "with" (context manager) because it will fail on Windows.
        # Windows doesn't allow two different processes to write if the file is
        # already opened.
        try:
            command = [
                # We need to use the real interpreter because pip can't resolve
                # markers correctly even if --python-version is provided.
                # See https://github..../pip/issues/11664.
                pythonExecutable,
                pip,
                "install",
                "-q",
                *packageNames,
                *list(itertools.chain(*zip(["-r"] * len(requirements), requirements))),
                *list(itertools.chain(*zip(["-c"] * len(constraints), constraints))),
                "--disable-pip-version-check",
                "--dry-run",
                "--ignore-installed",
                f"--python-version={pythonVersion}" if pythonVersion else "",
                "--only-binary=:all:",
                "--target=/tmp/asd",
                "--disable-pip-version-check",
                "--report",  # This is the "magic". Pip will generate a JSON with all the resolved URLs.
                tmpFile,
                *extraArgs,
            ]
    
            _LOG.debug(f"Running {' '.join(command)!r}")
            process = subprocess.Popen(
                command,
                stdout=subprocess.PIPE,
                stderr=subprocess.STDOUT,
                text=True,
            )
    
            pipOutput = []
            while True:
                stdout = typing.cast(typing.IO[str], process.stdout).readline()
                if process.poll() is not None:
                    break
                if stdout:
                    pipOutput.append(stdout.rstrip())
                    sys.stdout.write(stdout)
    
            if process.poll() != 0:
                output = "\n".join(pipOutput)
>               raise rez_pip.exceptions.PipError(
                    f"[bold red]Failed to run pip command[/]: {' '.join(command)!r}\n\n"
                    "[bold]Pip reported this[/]:\n\n"
                    f"{output}",
                )
E               rez_pip.exceptions.PipError: [bold red]Failed to run pip command[/]: '.../tests/data/rez_repo/python/3.7.16....../python/bin/python3 .../rez-pip/rez-pip/.nox....../test-3-8/lib/python3.8.../rez_pip/data/pip.pyz install -q package_a --disable-pip-version-check --dry-run --ignore-installed --python-version=3.11 --only-binary=:all: --target=/tmp/asd --disable-pip-version-check --report /tmp/pip-install-output9bouju0m --index-url http://localhost:45678 -vvv --retries=0'
E               
E               [bold]Pip reported this[/]:
E               
E               This version of pip does not support python 3.7 (requires >= 3.8).

.nox....../test-3-8/lib/python3.8.../site-packages/rez_pip/pip.py:220: PipError
tests.test_pip::test_getPackages_no_deps[3.7.16-package_a+console_scripts]
Stack Traces | 0.246s run time
packages = ['package_a', 'console_scripts']
expectedPackages = [PackageInfo(download_info=DownloadInfo(url='{pypi}........./packages/package_a/package_a-1.0.0-py2.py3-none-any.whl', archive_...0b6ddfdca7add44c4cb8'})), is_direct=False, requested=True, metadata=Metadata(version='0.1.0', name='console_scripts'))]
pythonRezPackage = '3.7.16'
rezRepo = '.../tests/data/rez_repo'
pypi = 'http://localhost:45678'
index = <tests.utils.PyPIIndex object at 0x7fa95d4bb0d0>

    @pytest.mark.parametrize(
        "packages,expectedPackages",
        [
            [
                ["package_a"],
                [
                    rez_pip.pip.PackageInfo(
                        rez_pip.pip.DownloadInfo(
                            "{pypi}........./packages/package_a/package_a-1.0.0-py2.py3-none-any.whl",
                            rez_pip.pip.ArchiveInfo(
                                "sha256=<val>",
                                {"sha256": "<val>"},
                            ),
                        ),
                        False,
                        True,
                        rez_pip.pip.Metadata("1.0.0", "package_a"),
                    ),
                ],
            ],
            [
                ["package_a", "console_scripts"],
                [
                    rez_pip.pip.PackageInfo(
                        rez_pip.pip.DownloadInfo(
                            "{pypi}........./packages/package_a/package_a-1.0.0-py2.py3-none-any.whl",
                            rez_pip.pip.ArchiveInfo(
                                "sha256=<val>",
                                {"sha256": "<val>"},
                            ),
                        ),
                        False,
                        True,
                        rez_pip.pip.Metadata("1.0.0", "package_a"),
                    ),
                    rez_pip.pip.PackageInfo(
                        download_info=rez_pip.pip.DownloadInfo(
                            url="{pypi}.../packages/console_scripts/console_scripts-0.1.0-py2.py3-none-any.whl",
                            archive_info=rez_pip.pip.ArchiveInfo(
                                hash="sha256=<val>",
                                hashes={"sha256": "<val>"},
                            ),
                        ),
                        is_direct=False,
                        requested=True,
                        metadata=rez_pip.pip.Metadata(
                            version="0.1.0", name="console_scripts"
                        ),
                    ),
                ],
            ],
        ],
        ids=["package_a", "package_a+console_scripts"],
    )
    def test_getPackages_no_deps(
        packages: list[str],
        expectedPackages: list[rez_pip.pip.PackageInfo],
        pythonRezPackage: str,
        rezRepo: str,
        pypi: str,
        index: utils.PyPIIndex,
    ):
        """
        This just tests that the function returns PackageInfo objects
        and it's why we use --no-deps. The scenario with dependencies
        will be tested in another test.
        """
        executable, ctx = utils.getPythonRezPackageExecutablePath(pythonRezPackage, rezRepo)
        assert executable is not None
    
        for expectedPackage in expectedPackages:
            expectedPackage.download_info.archive_info.hash = (
                f"sha256={index.getWheelHash(expectedPackage.name)}"
            )
            expectedPackage.download_info.archive_info.hashes = {
                "sha256": index.getWheelHash(expectedPackage.name)
            }
    
>       resolvedPackages = rez_pip.pip.getPackages(
            packages,
            rez_pip.pip.getBundledPip(),
            "3.11",
            executable,
            [],
            [],
            ["--index-url", pypi, "-vvv", "--no-deps", "--retries=0"],
        )

tests/test_pip.py:170: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

packageNames = ['package_a', 'console_scripts']
pip = '.../rez-pip/rez-pip/.nox....../test-3-8/lib/python3.8.../rez_pip/data/pip.pyz'
pythonVersion = '3.11'
pythonExecutable = '.../tests/data/rez_repo/python/3.7.16....../python/bin/python3'
requirements = [], constraints = []
extraArgs = ['--index-url', 'http://localhost:45678', '-vvv', '--no-deps', '--retries=0']

    def getPackages(
        packageNames: list[str],
        pip: str,
        pythonVersion: str,
        pythonExecutable: str,
        requirements: list[str],
        constraints: list[str],
        extraArgs: list[str],
    ) -> list[PackageInfo]:
        rez_pip.plugins.getHook().prePipResolve(
            packages=tuple(packageNames), requirements=tuple(requirements)
        )
    
        _fd, tmpFile = tempfile.mkstemp(prefix="pip-install-output", text=True)
        os.close(_fd)
        # We can't with "with" (context manager) because it will fail on Windows.
        # Windows doesn't allow two different processes to write if the file is
        # already opened.
        try:
            command = [
                # We need to use the real interpreter because pip can't resolve
                # markers correctly even if --python-version is provided.
                # See https://github..../pip/issues/11664.
                pythonExecutable,
                pip,
                "install",
                "-q",
                *packageNames,
                *list(itertools.chain(*zip(["-r"] * len(requirements), requirements))),
                *list(itertools.chain(*zip(["-c"] * len(constraints), constraints))),
                "--disable-pip-version-check",
                "--dry-run",
                "--ignore-installed",
                f"--python-version={pythonVersion}" if pythonVersion else "",
                "--only-binary=:all:",
                "--target=/tmp/asd",
                "--disable-pip-version-check",
                "--report",  # This is the "magic". Pip will generate a JSON with all the resolved URLs.
                tmpFile,
                *extraArgs,
            ]
    
            _LOG.debug(f"Running {' '.join(command)!r}")
            process = subprocess.Popen(
                command,
                stdout=subprocess.PIPE,
                stderr=subprocess.STDOUT,
                text=True,
            )
    
            pipOutput = []
            while True:
                stdout = typing.cast(typing.IO[str], process.stdout).readline()
                if process.poll() is not None:
                    break
                if stdout:
                    pipOutput.append(stdout.rstrip())
                    sys.stdout.write(stdout)
    
            if process.poll() != 0:
                output = "\n".join(pipOutput)
>               raise rez_pip.exceptions.PipError(
                    f"[bold red]Failed to run pip command[/]: {' '.join(command)!r}\n\n"
                    "[bold]Pip reported this[/]:\n\n"
                    f"{output}",
                )
E               rez_pip.exceptions.PipError: [bold red]Failed to run pip command[/]: '.../tests/data/rez_repo/python/3.7.16....../python/bin/python3 .../rez-pip/rez-pip/.nox....../test-3-8/lib/python3.8.../rez_pip/data/pip.pyz install -q package_a console_scripts --disable-pip-version-check --dry-run --ignore-installed --python-version=3.11 --only-binary=:all: --target=/tmp/asd --disable-pip-version-check --report /tmp/pip-install-outputiwcdi5r1 --index-url http://localhost:45678 -vvv --no-deps --retries=0'
E               
E               [bold]Pip reported this[/]:
E               
E               This version of pip does not support python 3.7 (requires >= 3.8).

.nox....../test-3-8/lib/python3.8.../site-packages/rez_pip/pip.py:220: PipError
tests.test_pip::test_getPackages_error[3.7.16]
Stack Traces | 0.249s run time
pythonRezPackage = '3.7.16'
rezRepo = '.../tests/data/rez_repo'
pypi = 'http://localhost:45678'
tmp_path = PosixPath('.../pytest-of-runner/pytest-0/test_getPackages_error_3_7_16_0')

    def test_getPackages_error(
        pythonRezPackage: str, rezRepo: str, pypi: str, tmp_path: pathlib.Path
    ):
        executable, ctx = utils.getPythonRezPackageExecutablePath(pythonRezPackage, rezRepo)
        assert executable is not None
    
        packageName = str(uuid.uuid4())
    
        with pytest.raises(rez_pip.exceptions.PipError) as exc:
            rez_pip.pip.getPackages(
                [packageName],
                rez_pip.pip.getBundledPip(),
                ".".join(str(i) for i in sys.version_info[:2]),
                executable,
                [],
                [],
                # Disable retries to speed up the test
                [
                    # Specify index to avoid pip complaining about OpenSSL not being available.
                    f"--index-url={pypi}",
                    "--find-links",
                    os.fspath(tmp_path),
                    "-v",
                    "--retries",
                    "0",
                ],
            )
    
        with rez_pip.utils.CONSOLE.capture() as capture:
            rez_pip.utils.CONSOLE.print(exc.value, soft_wrap=True)
    
        match = re.match(
            r"rez_pip\.exceptions\.PipError: Failed to run pip command\: '.*'",
            capture.get().splitlines()[0],
        )
    
        assert match is not None
    
        # Lowercase to avoid discrepencies between C:\ and c:\
>       assert (
            "\n".join(capture.get().splitlines()[1:]).lower()
            == f"""
    Pip reported this:
    
    Looking in indexes: {pypi}
    Looking in links: {os.fspath(tmp_path)}
    ERROR: Could not find a version that satisfies the requirement {packageName} (from versions: none)
    ERROR: No matching distribution found for {packageName}""".lower()
        )
E       AssertionError: assert '\npip report...ires >= 3.8).' == '\npip report...-df2902fc7ffc'
E         
E           
E           pip reported this:
E           
E         + this version of pip does not support python 3.7 (requires >= 3.8).
E         - looking in indexes: http://localhost:45678
E         - looking in links: .../pytest-of-runner/pytest-0/test_getpackages_error_3_7_16_0
E         - error: could not find a version that satisfies the requirement 62355202-c803-41c8-be1e-df2902fc7ffc (from versions: none)
E         - error: no matching distribution found for 62355202-c803-41c8-be1e-df2902fc7ffc

tests/test_pip.py:251: AssertionError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@rez-pip-update-bot rez-pip-update-bot bot changed the title Update pip to 24.0 Update pip to 24.1 Jun 23, 2024
@rez-pip-update-bot rez-pip-update-bot bot changed the title Update pip to 24.1 Update pip to 24.1.1 Jun 30, 2024
@rez-pip-update-bot rez-pip-update-bot bot changed the title Update pip to 24.1.1 Update pip to 24.1.2 Jul 14, 2024
@rez-pip-update-bot rez-pip-update-bot bot changed the title Update pip to 24.1.2 Update pip to 24.2 Aug 4, 2024
@rez-pip-update-bot rez-pip-update-bot bot changed the title Update pip to 24.2 Update pip to 24.3.1 Nov 3, 2024
@JeanChristopheMorinPerso JeanChristopheMorinPerso added this to the 0.4.0b1 milestone Jan 1, 2025
@JeanChristopheMorinPerso
Copy link
Owner

We can't yet... 24.0 drops support for 3.7. We could technically stop calling pip from the rez python package and use the new --python-version flag that finally works... But that has implications. For example, the python use to run rez-pip might have different properties than the python from a rez package. We will have to think it through.

@JeanChristopheMorinPerso JeanChristopheMorinPerso removed this from the 0.4.0b1 milestone Jan 19, 2025
@rez-pip-update-bot rez-pip-update-bot bot changed the title Update pip to 24.3.1 Update pip to 25.0 Feb 2, 2025
Signed-off-by: rez-pip-update-bot[bot] <133434221+rez-pip-update-bot[bot]@users.noreply.github.com>
Signed-off-by: rez-pip-update-bot[bot] <133434221+rez-pip-update-bot[bot]@users.noreply.github.com>
Signed-off-by: rez-pip-update-bot[bot] <133434221+rez-pip-update-bot[bot]@users.noreply.github.com>
Signed-off-by: rez-pip-update-bot[bot] <133434221+rez-pip-update-bot[bot]@users.noreply.github.com>
Signed-off-by: rez-pip-update-bot[bot] <133434221+rez-pip-update-bot[bot]@users.noreply.github.com>
Signed-off-by: rez-pip-update-bot[bot] <133434221+rez-pip-update-bot[bot]@users.noreply.github.com>
Signed-off-by: rez-pip-update-bot[bot] <133434221+rez-pip-update-bot[bot]@users.noreply.github.com>
Signed-off-by: rez-pip-update-bot[bot] <133434221+rez-pip-update-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pip-update Automated pip update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant