Closed nathanjmcdougall closed 5 months ago
Interesting! I have been unable to replicate this from a Python 3.10 console in either PowerShell or Command Prompt on Windows 10. Are there any other factors in your setup that you think might be causing this? What Python version are you running? For reference, here's what I'm seeing in command prompt:
A few things:
dependents_and_mermaid.py
.tqdm
related. I have noticed that sometimes when using tqdm
I get issues where output is repeated if I move/resize the window while it is running. However this issue is consistent so I am not sure.Thanks @nathanjmcdougall
@ben-denham
tqdm
on my setup, not for labtech
in particular.
3-4 I'll work on now.Regarding point 4, here is the issue reproduced within Powershell only, without using VS Code:
Regarding point 3, see #25.
Aha, I was able to reproduce the issue by running the specific test as a module just as you did.
The cause of the issue is that the diagram-printing lines are at the top-level of module and unguarded by if __name__ == '__main__':
, which means they will be re-executed whenever the module is loaded. With the default multiprocessing start_method
of 'spawn'
on Windows, the module will be reloaded at the start of each subprocess (skipping over anything guarded by if __name__ == '__main__':
), printing the diagram from each subprocess.
I've fixed this by moving the diagram printing under if __name__ == '__main__':
in https://github.com/ben-denham/labtech/commit/ddb677cc09f76d9b55ebede04cd0bb1d1a27ea22
Okay, but then won't those lines be untested/unexecuted in the test suite? Might be better to add those lines to the README itself but exclude then from the integration tests.
On Sat, 25 May 2024, 12:05 pm Dr Ben Denham, @.***> wrote:
Aha, I was able to reproduce the issue by running the specific test as a module just as you did.
The cause of the issue is that the diagram-printing lines are at the top-level of module and unguarded by if name == 'main':, which means they will be re-executed whenever the module is loaded. With the default multiprocessing start_method of 'spawn' on Windows, the module will be reloaded at the start of each subprocess (skipping over anything guarded by if name == 'main':), printing the diagram from each subprocess.
I've fixed this by moving the diagram printing under if name == 'main': in ddb677c https://github.com/ben-denham/labtech/commit/ddb677cc09f76d9b55ebede04cd0bb1d1a27ea22
— Reply to this email directly, view it on GitHub https://github.com/ben-denham/labtech/issues/16#issuecomment-2130533202, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEN5SMPHX5OJ335D55ISOZDZD7IWFAVCNFSM6AAAAABGWSAI66VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZQGUZTGMRQGI . You are receiving this because you were mentioned.Message ID: @.***>
They'll still be executed, but only once in the main process instead of repeatedly in each subprocess. I've updated the test to check for exactly one diagram in the output: https://github.com/ben-denham/labtech/commit/ddb677cc09f76d9b55ebede04cd0bb1d1a27ea22#diff-eb0ef88a399d99af6bfcec93c9fdbb2e4656d6f3cc05150ef6bf4fe736d721a6R35
Ah, great!
On Sat, 25 May 2024, 5:31 pm Dr Ben Denham, @.***> wrote:
They'll still be executed, but only once in the main process instead of repeatedly in each subprocess. I've updated the test to check for exactly one diagram in the output: ddb677c
diff-eb0ef88a399d99af6bfcec93c9fdbb2e4656d6f3cc05150ef6bf4fe736d721a6R35
— Reply to this email directly, view it on GitHub https://github.com/ben-denham/labtech/issues/16#issuecomment-2130788268, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEN5SMN5J477LQMCAP7UF2TZEAO45AVCNFSM6AAAAABGWSAI66VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZQG44DQMRWHA . You are receiving this because you were mentioned.Message ID: @.***>
Similar to #14, running the mermaid example from the README from the CLI (rather than an interactive IPython session) seems to spam the console with 12 times. As of ef08cfee7f1db905b04c2fa9e2ff7c15d4ce03d4, this is no longer
<IPython.core.display.Markdown object>
but instead, a text representation of the diagram.