sisl icon indicating copy to clipboard operation
sisl copied to clipboard

Enabling/disabling progress bars globally

Open pfebrer opened this issue 3 years ago • 7 comments

Do you think it could make sense that all progress bars shown in sisl could be disabled/enabled with just one parameter?

E.g. with an env variable SISL_PROGRESSBARS or some global switch like sisl.progress_bars().

Since the plots in sisl.viz might be a bit of a black box I want to give the option to the user to show the progress bars for some calculations to understand if the code is working or infinitely stuck. However, I don't want to create an extra setting just for that in every case where there may be a progress bar.

Therefore I thought a global switch could be a neat solution.

pfebrer avatar Jul 12 '21 16:07 pfebrer

Sounds like a good idea. However, it may be a bit excessive with progress bars all the time.

I think it would be ideal to have a context manager that globally sets this, this would make it a bit more flexible I think. And the env-variable, perhaps SISL_SHOW_PROGRESS? makes it clear that this is a visible thing?

zerothi avatar Jul 14 '21 07:07 zerothi

Sure, the only true proposal here was the concept, not the specifics. However you prefer to implement it is fine for me!

Also it sure seems better to include SHOW in the env variable name. SISL_SHOW_PROGRESS sounds good to me!

pfebrer avatar Jul 14 '21 13:07 pfebrer

I'll have a go at this asap

zerothi avatar Jul 14 '21 17:07 zerothi

Fixed in bba363b1c, note this doesn't allow dynamic control. I.e. it is defined at import of sisl.

Still needing a context manager. But that should be rather trivially solved.

zerothi avatar Jul 14 '21 17:07 zerothi

Nice! Thank you very much, this solves my request already :+1:

pfebrer avatar Jul 14 '21 17:07 pfebrer

I'm curious though, you deliberately made it non dynamic from what I understand reading the code (I mean it could have very easily been dynamic). Is this because of efficiency?

pfebrer avatar Jul 14 '21 17:07 pfebrer

I'm curious though, you deliberately made it non dynamic from what I understand reading the code (I mean it could have very easily been dynamic). Is this because of efficiency?

Yeah both efficiency, which shouldn't do much since the routines having eta are heavy by them-selves. But rather making sure that users requests are obeyed. I don't know... ;)

zerothi avatar Jul 14 '21 17:07 zerothi