-
-
Notifications
You must be signed in to change notification settings - Fork 636
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Part of #11165 and builds off of #12703. Rather than having a single option `[python-setup].experimental_lockfile`, users set `[python-setup].experimental_resolves_to_lockfiles` to define 0-n "named resolves" that associate a lockfile with a name: ```toml [python-setup] experimental_resolves_to_lockfiles = { lock1 = "lock1.txt", lock2 = "lock2.txt" } ``` Then, individual `pex_binary` targets can specify which resolve to use: ```python pex_binary(name="reversion", entry_point="reversion.py", experimental_resolve="lock1") ``` In a followup, we'll add a mechanism to set the default resolve. Users can generate that lockfile with `./pants generate-lockfiles` (all resolves) or `./pants generate-lockfiles --resolve=<name>`: ``` ❯ ./pants generate-lockfiles --resolve=lock1 --resolve=lock2 15:55:56.60 [INFO] Completed: Generate lockfile for lock1 15:55:56.61 [INFO] Completed: Generate lockfile for lock2 15:55:57.02 [INFO] Wrote lockfile for the resolve `lock1` to lock1.txt 15:55:57.02 [INFO] Wrote lockfile for the resolve `lock2` to lock2.txt ``` Then, it will be consumed with `./pants package` and `./pants run`. Pants will extract the proper subset from that lockfile, meaning that the lockfile can safely be a superset of what is used for the particular build. ``` ❯ ./pants package build-support/bin: ... 15:56:33.87 [INFO] Completed: Installing lock1.txt for the resolve `lock1` 15:56:34.39 [INFO] Completed: Installing lock2.txt for the resolve `lock2` 15:56:34.48 [INFO] Completed: Extracting 1 requirement to build build-support.bin/generate_user_list.pex from lock1_lockfile.pex: pystache==0.5.4 ... ``` If the lockfile is incompatible, we will (soon) warn or error with instructions to either use a new resolve or regenerate the lockfile. In followups, this field will be hooked up to other targets like `python_awslambda` and `python_tests`. We will likely also add a new field `compatible_resolves` to `python_library`, per #12714, which is a list of resolves. "Root targets" like `python_tests` and `pex_binary` will validate that all their dependencies are compatible. When you operate directly on a `python_library` target, like running MyPy on it, we will choose any of the possible resolves. You will be able to set your own default for this field. [ci skip-rust] [ci skip-build-wheels]
- Loading branch information
1 parent
70f0cd7
commit 824b8d7
Showing
7 changed files
with
211 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.