straight-shampoo-11124
01/11/2025, 3:27 AM@card
that shows the source code of the corresponding step 🐍 ✨
a. In other words, you can see the code executed in the Metaflow UI (and the card viewer)
2. A small new handy utility: pip install metaflow-diff
(repo here). It runs git diff
between a Metaflow run and the current working directory, so you can
a. See what has changed between a past run and the status quo
b. Reset the current working directory back to the state of a past run to reproduce past results
c. Unpack a past code package to a local directory so you can inspect and rerun code written by your or your colleagues easily
See the features in action below! 📺hundreds-rainbow-67050
01/11/2025, 4:15 AMvictorious-lawyer-58417
01/11/2025, 4:17 AMhundreds-rainbow-67050
01/11/2025, 7:06 AMimportant-london-94970
01/11/2025, 3:34 PMvictorious-lawyer-58417
01/12/2025, 12:25 AMgit apply
is very particular how it wants the paths to appear in the diff output, so I had to fix source_file
and target_file
logic in your PR
(also disable color output for patches and non-terminal output)victorious-lawyer-58417
01/12/2025, 12:28 AMAssertionError: Expected 'run' to be called once. Called 2 times.
I am not sure how it's supposed to work so if you have a chance, take a look if the tests still pass for you
when it comes to the patch
command, the best test would be
1. Run a flow, run id X
2. Make a change
3. patch X
4. Run git apply
to apply the patch (as instructed in the patch
command output)
5. Assert that (2) was reverted properlyvictorious-lawyer-58417
01/12/2025, 12:29 AMdiff-runs
seems to work nicely - that's a great addition - thanks! bowqhundreds-rainbow-67050
01/12/2025, 4:42 AMvictorious-lawyer-58417
01/12/2025, 7:33 PMpython test_metaflow_diff.py > a
works since it does --no-color
. Without > a
it doesn't work as it does --color
instead of --no-color
breaking assert_any_call
🙂victorious-lawyer-58417
01/12/2025, 7:34 PMif sys.stdout.isatty():
color = ["--color"]
else:
color = ["--no-color"]
in the test too 🤷hundreds-rainbow-67050
01/13/2025, 1:33 AMpytest test_metaflow_diff.py
and pytest test_metaflow_diff.py > a
also works.
python test_metaflow_diff.py > a
doesn't produce any output in a
for me, so not sure what that's even supposed to dovictorious-lawyer-58417
01/13/2025, 2:05 AMsys.stdout.isatty()
eval to False, so we use --no-color
The current test asserts that diff output has --no-color
which is not true when you are outputting a diff in the terminal (since we want a colored output)hundreds-rainbow-67050
01/13/2025, 6:55 AMvictorious-lawyer-58417
01/13/2025, 7:01 AM