Repository navigation
Open
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
This is a followup of #255.
pyth-on-line/tests/py/test_hmr.py
Lines 177 to 196 in c254aaa
| with wait_for_tick(): | |
| Path("b.py").write_text("print('b')\n\nfrom a import one\n\ntwo = one + 2\n") | |
| assert stdout.delta == "b\na\nc\n5\n" # b <- a <- c | |
| with wait_for_tick(): | |
| Path("a.py").write_text("print('a')\n\none = 2\n\nfrom b import two\n\nthree = two + 2\n") | |
| assert stdout.delta == "a\nb\na\nc\n6\n" # a <- b, b <- a <- c | |
| """ | |
| TODO This is not an optimal behavior. Here are 2 alternate solutions: | |
| 1. Maximize consistency: | |
| Log the order of each `Derived` and replay every loop in its original order. | |
| Always run `a` before `b` in the tests above. | |
| 2. Greedy memoization: | |
| Always run the changed module first. Only run `a` when necessary. | |
| But if `a.one` changes every time, we'll have to run `b` twice to keep consistency. | |
| """ | |
Personally I prefer the first solution. And we may provide an option for user to opt-in the second solution.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity
linear commentedon May 12, 2025
PROM-46 Cyclic Dependency Handling
RecursionErrorfor circular dependencies #255RecursionErrorfor circular dependencies #255[-]Cyclic Dependency Handling[/-][+][hmr] Cyclic Dependency Handling[/+]Implement solution 1 for issue #269: consistent cyclic dependency han…