Skip to main content

Use this module to prevent your Mac OS X system from sleeping while executing a long-running python script.

Quick Start

Just import caffeine. That’s it! You Mac OS X system will not sleep as long as the interpreter remains alive. No need to run any other commands. But if you want slightly finer controls, a few functions are available.

caffeine.on(display=False)

Use the on function to create a power assertion. Set display=True to also keep your display from sleeping. The default of display=False will allow your display to sleep but will keep your system awake so processing can continue. If a power assertion is active, calling on() with display set to the other value will change the assertion. Calling on() with the same value is a harmless no-op.

caffeine.off()

Use the off function to release any power assertion before your interpreter exits.

caffeine.verify()

Calls pmset -g assertions to verify what power assertions are active.

Metadata

Release files for caffeine 0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for caffeine 0.5
File Size Uploaded
caffeine-0.5.tar.gz 2.4 kB Details

Release files / caffeine-0.5.tar.gz

Download URL caffeine-0.5.tar.gz
Size 2.4 kB
Tags Source
SHA-256 checksum
How to use checksums
40092894e2e79652ec2ed7a41508ff3b06b60e041ad42c86ff54d64220332d3a
BLAKE2b-256 checksum
How to use checksums
66baacd2d55744d86142c533c6c73412c5aa0387467f8f75aa3d62a86c866fe8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.5 This release

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page