-
-
Notifications
You must be signed in to change notification settings - Fork 310
pass thru --uploaded-prior-to on Pip v26.0 #3131
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,58 @@ | ||||||||||||||||||||||||||||||||
| # Copyright 2026 Pex project contributors. | ||||||||||||||||||||||||||||||||
| # Licensed under the Apache License, Version 2.0 (see LICENSE). | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| import os | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| from pex.pep_440 import Version | ||||||||||||||||||||||||||||||||
| from pex.resolve.lockfile import json_codec | ||||||||||||||||||||||||||||||||
| from pex.typing import TYPE_CHECKING | ||||||||||||||||||||||||||||||||
| from testing.cli import run_pex3 | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| if TYPE_CHECKING: | ||||||||||||||||||||||||||||||||
| from typing import Any | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| def test_uploaded_prior_to_filters_to_older_version(tmpdir): | ||||||||||||||||||||||||||||||||
| # type: (Any) -> None | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| lock_file = os.path.join(str(tmpdir), "cowsay.lock.json") | ||||||||||||||||||||||||||||||||
| run_pex3( | ||||||||||||||||||||||||||||||||
| "lock", | ||||||||||||||||||||||||||||||||
| "create", | ||||||||||||||||||||||||||||||||
| "cowsay", | ||||||||||||||||||||||||||||||||
| "--pip-version", | ||||||||||||||||||||||||||||||||
| "26.0", | ||||||||||||||||||||||||||||||||
|
Comment on lines
+23
to
+24
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume this will fail on the py27 and py38 shards. I'd think you'd need a
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aha, even fails on new Pythons: N.B.: I use
And the devpi support is an open issue: devpi/devpi#1061 |
||||||||||||||||||||||||||||||||
| "--uploaded-prior-to", | ||||||||||||||||||||||||||||||||
| "2023-09-20", | ||||||||||||||||||||||||||||||||
| "-o", | ||||||||||||||||||||||||||||||||
| lock_file, | ||||||||||||||||||||||||||||||||
| ).assert_success() | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| lock = json_codec.load(lock_file) | ||||||||||||||||||||||||||||||||
| assert 1 == len(lock.locked_resolves) | ||||||||||||||||||||||||||||||||
| locked_resolve = lock.locked_resolves[0] | ||||||||||||||||||||||||||||||||
| assert 1 == len(locked_resolve.locked_requirements) | ||||||||||||||||||||||||||||||||
| assert Version("6.0") == locked_resolve.locked_requirements[0].pin.version | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| def test_uploaded_prior_to_far_future_allows_latest(tmpdir): | ||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? I'm not seeing how this tests your Pex integration. It seems to test Pip. |
||||||||||||||||||||||||||||||||
| # type: (Any) -> None | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| lock_file = os.path.join(str(tmpdir), "cowsay.lock.json") | ||||||||||||||||||||||||||||||||
| run_pex3( | ||||||||||||||||||||||||||||||||
| "lock", | ||||||||||||||||||||||||||||||||
| "create", | ||||||||||||||||||||||||||||||||
| "cowsay==6.1", | ||||||||||||||||||||||||||||||||
| "--pip-version", | ||||||||||||||||||||||||||||||||
| "26.0", | ||||||||||||||||||||||||||||||||
| "--uploaded-prior-to", | ||||||||||||||||||||||||||||||||
| "2063-04-05", | ||||||||||||||||||||||||||||||||
| "-o", | ||||||||||||||||||||||||||||||||
| lock_file, | ||||||||||||||||||||||||||||||||
| ).assert_success() | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| lock = json_codec.load(lock_file) | ||||||||||||||||||||||||||||||||
| assert 1 == len(lock.locked_resolves) | ||||||||||||||||||||||||||||||||
| locked_resolve = lock.locked_resolves[0] | ||||||||||||||||||||||||||||||||
| assert 1 == len(locked_resolve.locked_requirements) | ||||||||||||||||||||||||||||||||
| assert Version("6.1") == locked_resolve.locked_requirements[0].pin.version | ||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -420,3 +420,13 @@ def test_multiple_unnamed_indexes(parser): | |
| mac_scoped_repos = repos_configuration.scoped({"sys_platform": "darwin"}) | ||
| assert [] == mac_scoped_repos.in_scope_indexes(ProjectName("torch")) | ||
| assert [] == mac_scoped_repos.in_scope_find_links(ProjectName("torch")) | ||
|
|
||
|
|
||
| def test_resolver_uploaded_prior_to_passthru(parser): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is fine, but I view unit tests as useless in the best case, and detrimental to refactors in the worst when you have an IT that covers like you do. |
||
| # type: (ArgumentParser) -> None | ||
| resolver_options.register(parser) | ||
|
|
||
| pip_configuration = compute_pip_configuration( | ||
| parser, args=["--pip-version", "26.0", "--uploaded-prior-to", "2015-10-21"] | ||
| ) | ||
| assert pip_configuration.uploaded_prior_to == "2015-10-21" | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cburroughs does the hard error on Pip's part when
--uploaded-prior-tometadata is not available from the index suggest your warning should be an error as well? I meant to note this earlier in the review, but the Pip error prompts me to re-consider this. Can you think of a good + real reason to not hard error?. Hard errors are nice because you can relax them later and not break anyone. The reverse is not true, and I'm bound by Pex ethics to never break anyone.