Coverage for pipxl/pip_cli.py: 100%

1# SPDX-FileCopyrightText: 2022-present Jeroen van Zundert <mail@jeroenvanzundert.nl>

2#

3# SPDX-License-Identifier: MIT

4

5 import subprocess

6 import sys

7

8

9 def pip_cli(cmd: list[str], py_executable: str = sys.executable) -> subprocess.CompletedProcess[str]:

10 # https://pip.pypa.io/en/stable/user_guide/#using-pip-from-your-program

11 return subprocess.run([py_executable, "-m", "pip"] + cmd, capture_output=True, timeout=60, text=True)