Skip to content

Commit

Permalink
Upgrade Pex to 2.1.28. (#11493)
Browse files Browse the repository at this point in the history
We want to use the new `--venv` and `--pex-repository` features this
upgrade brings in.
  • Loading branch information
jsirois authored Jan 23, 2021
1 parent 3059645 commit e3b3e53
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 20 deletions.
6 changes: 3 additions & 3 deletions 3rdparty/python/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by build-support/bin/generate_lockfile.sh on Thu Jan 21 09:34:41 PST 2021
# Generated by build-support/bin/generate_lockfile.sh on Fri Jan 22 05:13:08 PM PST 2021
ansicolors==1.1.8
attrs==20.3.0
beautifulsoup4==4.6.3
Expand All @@ -14,8 +14,8 @@ monotonic==1.5
mypy==0.782
mypy-extensions==0.4.3
packaging==20.8
pex==2.1.24
pip==20.2.1
pex==2.1.28
pip==20.2.3
pluggy==0.13.1
psutil==5.7.0
py==1.10.0
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/python/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mypy==0.782

packaging==20.8
pathspec==0.8.0
pex==2.1.24
pex==2.1.28
psutil==5.7.0
pystache==0.5.4
# This should be kept in sync with `pytest.py`.
Expand Down
6 changes: 3 additions & 3 deletions src/python/pants/backend/python/util_rules/pex_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class PexBinary(TemplatedExternalTool):
name = "pex"
help = "The PEX (Python EXecutable) tool (https:/pantsbuild/pex)."

default_version = "v2.1.24"
default_version = "v2.1.28"
default_url_template = "https:/pantsbuild/pex/releases/download/{version}/pex"

@classproperty
Expand All @@ -47,8 +47,8 @@ def default_known_versions(cls):
(
cls.default_version,
plat,
"561da5a7c76a8a88567a306fa60dfcb5c6924bb71c18b892080d5c2b3eea7133",
"2936466",
"bfc0add2649bd2d76043ef4ec07edf28aa3bf2654e8ee9b8e39ff5dcffb37665",
"2966062",
)
)
for plat in ["darwin", "linux"]
Expand Down
41 changes: 28 additions & 13 deletions src/python/pants/backend/python/util_rules/pex_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,23 +477,38 @@ def test_resolves_dependencies(rule_runner: RuleRunner) -> None:


def test_requirement_constraints(rule_runner: RuleRunner) -> None:
# This is intentionally old; a constraint will resolve us to a more modern version.
direct_dep = "requests==1.0.0"
constraints = [
"requests==2.23.0",
"certifi==2019.6.16",
"chardet==3.0.2",
"idna==2.7",
"urllib3==1.25.6",
]
rule_runner.create_file("constraints.txt", "\n".join(constraints))
direct_deps = ["requests>=1.0.0,<=2.23.0"]

pex_info = create_pex_and_get_pex_info(
def assert_direct_requirements(pex_info):
assert set(Requirement.parse(r) for r in pex_info["requirements"]) == set(
Requirement.parse(d) for d in direct_deps
)

# Unconstrained, we should always pick the top of the range (requests 2.23.0) since the top of
# the range is a transitive closure over universal wheels.
direct_pex_info = create_pex_and_get_pex_info(
rule_runner, requirements=PexRequirements(direct_deps)
)
assert_direct_requirements(direct_pex_info)
assert {
"certifi-2020.12.5-py2.py3-none-any.whl",
"chardet-3.0.4-py2.py3-none-any.whl",
"idna-2.10-py2.py3-none-any.whl",
"requests-2.23.0-py2.py3-none-any.whl",
"urllib3-1.25.11-py2.py3-none-any.whl",
} == set(direct_pex_info["distributions"].keys())

constraints = ["requests==2.0.0"]
rule_runner.create_file("constraints.txt", "\n".join(constraints))
constrained_pex_info = create_pex_and_get_pex_info(
rule_runner,
requirements=PexRequirements([direct_dep]),
requirements=PexRequirements(direct_deps),
additional_pants_args=("--python-setup-requirement-constraints=constraints.txt",),
)
assert set(parse_requirements(pex_info["requirements"])) == set(parse_requirements(constraints))
assert_direct_requirements(constrained_pex_info)
assert {"requests-2.0.0-py2.py3-none-any.whl"} == set(
constrained_pex_info["distributions"].keys()
)


def test_entry_point(rule_runner: RuleRunner) -> None:
Expand Down

0 comments on commit e3b3e53

Please sign in to comment.