Skip to main content

A tool to keep Mac OS X from sleeping

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

caffeine-0.2.tar.gz (2.1 kB view details)

Uploaded Source

File details

Details for the file caffeine-0.2.tar.gz.

File metadata

  • Download URL: caffeine-0.2.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for caffeine-0.2.tar.gz
Algorithm Hash digest
SHA256 cd82831ca1834158a782f3f395655275a5eed5f3f8311eba4def9e5cf6421737
MD5 45072d73c41b0a487d06a26c2132f0f5
BLAKE2b-256 6abe64ff6030ea8f8e9f5025b1bf7a0b9df7d0874990882f5bbc7a96f83761a1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page