So I'm jankily calling `Get(FmtResult, BlackReques...
# plugins
a
So I'm jankily calling
Get(FmtResult, BlackRequest, BlackRequest(...))
to format the output of my codgen (because reasons) But every time I request the codegen'd code it re-formats the files. And I can't work out for the life of me, which part of the Black rules are preventing it from being cached?
f
can you share the actual invocation and what you do with the resulting
Digest
?
b
(also you can omit the middle
BlackRequest
😉 the parser recognizes
Get(Result Request(...))
a
oh, maybe it is being cached, it's also caching standard output and displaying that multiple times
basically I am doing.
Copy code
result = await Get(ProcessResult, PexProcess(generator_pex.pex, args....)
snapshot = await Get(Snapshot, Digest, result.output_digest)
formatted = await Get(FmtResult, BlackRequest(snapshot=snapshot, field_sets[
  BlackFieldSet(address=target.address, source=PythonSourceField(raw_value=output[1, address=target.address),
  interpreter_constraints=interpreter_constraints)
  for output in output_files]
))
ahhh there it is.
FmtResult.cacheable
returns False
b
We have a ticket about that. Kinda. Basically it's the only way today to force the output to rerender
I don't quite agree with the rerendering in the first place, so 👀