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

Support syncing input requirements to a lock file more easily. #2344

Closed
jsirois opened this issue Jan 23, 2024 · 0 comments · Fixed by #2373
Closed

Support syncing input requirements to a lock file more easily. #2344

jsirois opened this issue Jan 23, 2024 · 0 comments · Fixed by #2373

Comments

@jsirois
Copy link
Member

jsirois commented Jan 23, 2024

With #2335, the correct set of arguments to pex3 lock update can be crafted to minimally update to a lock to an evolved set of input requirements. As noted here #2334 (comment) though, a nicer interface would be:

pex3 lock sync "req1<2" -r reqs.txt --constraints constraints.txt --lock lock.json -- pytest ...

The idea is to perform a minimal lock update given the input requirements and constraints (or noop if reqs have not changed) and, if -- is present, execute the command line following it after syncing that command's venv with the lock.

This new notion of an ~auto minimal lock update would parse all input requirements and use the new features from #2335 to form the appropriate set of -R replacements and -d deletes to bring the lock in sync.

@jsirois jsirois self-assigned this Jan 23, 2024
jsirois added a commit to jsirois/pex that referenced this issue Feb 20, 2024
Introduce the high level `pex3 lock sync` command. This should generally
suffice for typical use cases and works as follows:

+ On first use (where the specified `--lock` does not yet exist), it
  acts just like `pex3 lock create`.
+ On subsequent uses it does a minimal synchronization of the lock based
  on the diff of the given current requirements against the requirements
  used to generate the specified `--lock`. This amounts to formulating a
  `pex3 lock update` command with the appropriate `-p`, `-R` and `-d`
  arguments.

In addition to creating and syncing a lock, it can also create and sync
a venv (--venv) based on the lock. Further, a command can be specified
to run in the synchronized venv with arguments following the `--` option
terminator.

This latter set of features allow Pex to act as a concise tool in `tox` /
`nox` / `invoke` / `make` setups to implement a simple build system.

Fixes pex-tool#2344
jsirois added a commit that referenced this issue Mar 28, 2024
Introduce the high level `pex3 lock sync` command. This should generally
suffice for typical use cases and works as follows:

+ On first use (where the specified `--lock` does not yet exist), it
  acts just like `pex3 lock create`.
+ On subsequent uses it does a minimal synchronization of the lock based
  on the diff of the given current requirements against the requirements
  used to generate the specified `--lock`. This amounts to formulating a
  `pex3 lock update` command with the appropriate `-p`, `-R` and `-d`
  arguments.

In addition to creating and syncing a lock, it can also create and sync
a venv (--venv) based on the lock. Further, a command can be specified
to run in the synchronized venv with arguments following the `--` option
terminator.

This latter set of features allow Pex to act as a concise tool in `tox`
/
`nox` / `invoke` / `make` setups to implement a simple build system.

Fixes #2344

---------

Co-authored-by: Andreas Stenius <git@astekk.se>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant