pex-tool / pex

A tool for generating .pex (Python EXecutable) files, lock files and venvs.
https://docs.pex-tool.org/
Apache License 2.0
2.5k stars 257 forks source link

Unify CLI options with Pip options when requirements files are parsed. #2345

Open jsirois opened 6 months ago

jsirois commented 6 months ago

Current requirements file parsing skips over Pip options and just allows them to flow through to Pip. This is fine for cases where we only care about Pip's resolve results, but falls down in the lock file creation case, where we write down some of these options to be preserved when the lock file is updated later.

jsirois commented 6 months ago

See #2342 where Pants uses the requirements file Pip option pass-through when pex3 lock createing lock files and then gets bit when trying to update those lock files. The --only-binary / --no-binary pass-throughs used to create a lock vanish in the serialized lock - there is no record of them at all, and since pex3 lock update does not accept requirement files, the pass-through back door is not available when performing an update and the --only-binary / --no-binary restriction is lost.

jsirois commented 6 months ago

The full reference for options that can be passed in requirements files: https://pip.pypa.io/en/stable/reference/requirements-file-format/#per-requirement-options