Skip to main content

Keep your machine awake while long tasks or agents run.

Project description

heimdallur

Keep your machine awake while long tasks or agents run. A thin, dependency-free wrapper around caffeinate (macOS) and systemd-inhibit (Linux), exposed as both a Python library and a CLI.

Install

pip install heimdallur

Library

from heimdallur import StayAwake

with StayAwake(display=False, lid=False):
    run_long_task()

# or explicit control
guard = StayAwake()
guard.start()
try:
    run_long_task()
finally:
    guard.stop()

The guard rolls back automatically on __exit__, stop(), and via an atexit hook even if the process crashes.

CLI

heimdallur                 # stay awake until Ctrl+C
heimdallur -- make build   # stay awake while the command runs
heimdallur -w 12345        # stay awake while PID 12345 is alive

Flags:

  • -d, --display — also keep the display awake.
  • --lid — prevent sleep even with the lid closed.

⚠️ Warning about --lid

On macOS --lid runs sudo pmset -a disablesleep 1, which means the system will never sleep until it is rolled back to 0. heimdallur rolls this back automatically on exit, but:

  • It requires sudo, which may hang on a password prompt in non-interactive (agent) contexts — avoid it there.
  • If the process is killed with SIGKILL, rollback cannot run. Re-run sudo pmset -a disablesleep 0 manually if needed.

License

MIT

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

heimdallur-0.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

heimdallur-0.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file heimdallur-0.1.0.tar.gz.

File metadata

  • Download URL: heimdallur-0.1.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for heimdallur-0.1.0.tar.gz
Algorithm Hash digest
SHA256 79d0508ba1067c538f4a385c9c5180a370a292d92b16691f053cd0819a14ef10
MD5 13c7dfbb5007e982d1034222f8489f3a
BLAKE2b-256 fce5e30a73bafe4289cb344abaafe3d06d5077728694d81019c482cf6b07b881

See more details on using hashes here.

File details

Details for the file heimdallur-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: heimdallur-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for heimdallur-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d96e184631ebdf6d7479bd9214ec2c0c8a61612c7508c3115b7187589980f606
MD5 34fb0b8381e2cb9a398a46fb3bc5a196
BLAKE2b-256 5cca05752a785968893976c2ed97f9c82ec274ff8be6645ddf7ada04824f6e92

See more details on using hashes here.

Supported by

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