Is there a way to run `pex3 lock create` with the ...
# general
b
Is there a way to run
pex3 lock create
with the
-r
coming from
stdin
? Coming from
pip-compile
I can
cat requirements.txt | pip-compile -o out.txt -
āœ… 1
Oddly:
Copy code
-o PATH, --output PATH
                        A file to output the lock to; STDOUT by default or when `-` is specified.
but
pex3 lock create -o out.lock -
fails with
Copy code
Problem parsing '-' as a requirement: Parse error at "'-'": Expected W:(abcd...)
e
That refers to
-o -
which you're not doing.
b
šŸ¤¦ā€ā™‚ļø
e
But, effectively no for the
-r
question.
This works to get requirements from stdout:
Copy code
pex3 lock create $(echo cowsay) -o - --indent 2
Using
-r <(...)
, however, is problematic.
b
Bummer. I'm generating an additional lockfile with pytorch pinned to a CUDA version. In order to keep every other dep the same I'm
sed
-ding the version.
Le tme see if
$(sed ...)
like you suggest works
e
You might save yourself some trouble and slap an echo in front of the whole thing to visually inspect.
b
Ah no, the reqs file has hashes via
--hash
so no dice. Another file isn't going to kill me (use an intermediate
.txt
)
e
Wait a sec.
pex3 lock update -p just_update_this ...
šŸ‘€ 1
But I'm not fully following "another lockfile" plus --hash
The lock update doesn't have an option to update to a new file, it mutates the one you give it if not --dry-run, but maybe what you want almost.
b
cp
can fix that šŸ™‚
e
Well, you weren't happy about doing effectively that with -r!
-p can be a full requirement string if that's not clear.
b
I assumed as much
This
cp
is better because right now we have: ā€¢ `pip-compile`:
<http://requirements.in|requirements.in>
->
requirements.txt
ā€¢
pex3
:
requirements.txt
->
requirements.lock
This is because people still are using
requirements.txt
as an out-of-band lockfile and I want them to agree 100%
e
Gotcha
You can then use pex3 lock export on the new lockfile you're generating with cp + lock update if you need that canonical form back again.
b
Yup!
works like a charm ā¤ļø