hey folks! Does anyone know if the <lockfile diff>...
# general
b
hey folks! Does anyone know if the lockfile diff feature can be used independently of the lockfile generation process? In most cases the lockfile generation happens on the user machine, but the diff report gets lost in the console. Ideally, it would be nice to be able to perform this at the CI level, so we could maybe attach the report to a PR.
h
I don’t think so, because where would the old lockfile come from? But it would be nice to be able to do that if you provided the paths to any two lockfiles as CLI args
b
Yes, that's exactly what I was thinking about! Don't think pants should handle retrieving the "old" lockfile, just comparing whatever two lockfiles the user provide would be enough
h
That would require a motivated party to do the work. I don’t think it’d be super complicated.
b
Nice! I think I can start playing with that. Do you have any pointers to where I should start looking for in the codebase?
h
The feature was introduced here so that code should be a good jumping off point.
You might want to introduce a new goal,
lockfile-diff
, with
--old
and
--new
options, that then uses the code in
_generate_python_lockfile_diff()
to get a diff, and the code in
LockfileDiffPrinter
to print it
Note that this will only work for Python lockfiles, for now, but that’s a start. The underlying data structures are language agnostic, it’s just
_generate_python_lockfile_diff()
that is python specific
So once that works we can figure out how to generalize
There’s documentation on how to add a new goal and add options for it etc
b
great! Thanks for the tips 🙏