NoSleep.jl: Keep Julia awake for long calculations

We’ve recently released a small utility package — NoSleep.jl .
It prevents your laptop or desktop from going to sleep while Julia is performing long computations, and restores the normal sleep behavior when done or failed.

using NoSleep
@nosleep begin
    # long-running code here
end

Of course, as alternative you could just disable sleep mode entirely on your laptop, but then it would keep consuming power even when idle.
With @nosleep, the system stays awake only while computations are running, and goes back to normal afterward. Or set nosleep_on() mode for the whole Julia process.

Features:

  • Cross-platform (Linux, macOS, Windows)
  • No dependencies
  • Works both as a macro (@nosleep) and via simple API: nosleep_on() / nosleep_off()

Feedback, bug reports, and suggestions are welcome!

32 Likes

Thanks! I was trying to find out how to make my computer keep up with the grindset and this is just the trick.

4 Likes

Neat!

2 Likes