eugeroic


Nameeugeroic JSON
Version 1.8.2 PyPI version JSON
download
home_pagehttps://github.com/sixty-north/eugeroic
SummaryPrevent your computer from sleeping
upload_time2023-08-25 16:16:38
maintainer
docs_urlNone
authorSixty North AS
requires_python
licenseMIT License
keywords macos sleep
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Eugeroic

Tools in Python for keeping a computer display awake.

eugeroic
:  (_adjective_) keeping one awake. Of a wakefulness promoting agent.


Sometimes you need to perform a task without the screensaver kicking in, or the display being
suspended entirely. This may be because you are capturing the screen, or because you are running
presentation software, or because you are running a long-running task that you want to monitor
without interaction. This module provides a context manager and a decorator that can be used to
keep the display awake while the block or function is running.

## Installation

    $ pip install eugeroic


## Examples

The `wakefulness` context manager keeps the computer awake while the block is running:

    # Keep the computer awake while capturing the screen.

    from eugeroic import wakefulness
    
    with wakefulness("Capture the screen"):
        capture_screen(seconds=500)


The `stay_awake` decorator keeps the computer awake while the decorated function is running:

    # Keep the computer awake while capturing the screen.

    from eugeroic import stay_awake
    
    @stay_awake("Capture the screen")
    def capture_screen(seconds):
        ...


How it works
============

On Windows calls to `SetThreadExecutionState` are used.

On macOS IOKit Power Management functions are used.

On Linux, an attempt is made to communicate with the desktop environment through D-Bus messages.

Note that while every attempt is made to keep the computer and display awake, there is no guarantee
that the display will not be suspended. For example, on macOS, the display will be suspended if the
user locks the screen. On Linux, the display will be suspended if the user switches to a different
virtual terminal. On Windows, the display will be suspended if the user locks the screen or switches
to a different user account.  In particular, on Linux, there is no guarantee that the required D-Bus
messages will be handled by the desktop environment.  In practice though, _Eugeroic_ usually works.

MIT License

Copyright (c) 2023 Sixty North AS

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/sixty-north/eugeroic",
    "name": "eugeroic",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "macos sleep",
    "author": "Sixty North AS",
    "author_email": "systems+eugeroic@sixty-north.com",
    "download_url": "https://files.pythonhosted.org/packages/d5/5a/f165526b2c3798d2d710477a071834f9dfa19e66500e97a7d75c93b7fbc4/eugeroic-1.8.2.tar.gz",
    "platform": null,
    "description": "# Eugeroic\n\nTools in Python for keeping a computer display awake.\n\neugeroic\n:  (_adjective_) keeping one awake. Of a wakefulness promoting agent.\n\n\nSometimes you need to perform a task without the screensaver kicking in, or the display being\nsuspended entirely. This may be because you are capturing the screen, or because you are running\npresentation software, or because you are running a long-running task that you want to monitor\nwithout interaction. This module provides a context manager and a decorator that can be used to\nkeep the display awake while the block or function is running.\n\n## Installation\n\n    $ pip install eugeroic\n\n\n## Examples\n\nThe `wakefulness` context manager keeps the computer awake while the block is running:\n\n    # Keep the computer awake while capturing the screen.\n\n    from eugeroic import wakefulness\n    \n    with wakefulness(\"Capture the screen\"):\n        capture_screen(seconds=500)\n\n\nThe `stay_awake` decorator keeps the computer awake while the decorated function is running:\n\n    # Keep the computer awake while capturing the screen.\n\n    from eugeroic import stay_awake\n    \n    @stay_awake(\"Capture the screen\")\n    def capture_screen(seconds):\n        ...\n\n\nHow it works\n============\n\nOn Windows calls to `SetThreadExecutionState` are used.\n\nOn macOS IOKit Power Management functions are used.\n\nOn Linux, an attempt is made to communicate with the desktop environment through D-Bus messages.\n\nNote that while every attempt is made to keep the computer and display awake, there is no guarantee\nthat the display will not be suspended. For example, on macOS, the display will be suspended if the\nuser locks the screen. On Linux, the display will be suspended if the user switches to a different\nvirtual terminal. On Windows, the display will be suspended if the user locks the screen or switches\nto a different user account.  In particular, on Linux, there is no guarantee that the required D-Bus\nmessages will be handled by the desktop environment.  In practice though, _Eugeroic_ usually works.\n\nMIT License\n\nCopyright (c) 2023 Sixty North AS\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Prevent your computer from sleeping",
    "version": "1.8.2",
    "project_urls": {
        "Homepage": "https://github.com/sixty-north/eugeroic"
    },
    "split_keywords": [
        "macos",
        "sleep"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ee68262d45ea9eda2a8043c16eb7462258cae18272f14ccbe3792379fc0a74e0",
                "md5": "bd7d3a4a9fd19248e436116d0bd7f8c6",
                "sha256": "f9ebbaff264f5a36af4819f4577c7f49d690062eacf85d5bb9e4b056056b0d51"
            },
            "downloads": -1,
            "filename": "eugeroic-1.8.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bd7d3a4a9fd19248e436116d0bd7f8c6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 13536,
            "upload_time": "2023-08-25T16:16:37",
            "upload_time_iso_8601": "2023-08-25T16:16:37.097797Z",
            "url": "https://files.pythonhosted.org/packages/ee/68/262d45ea9eda2a8043c16eb7462258cae18272f14ccbe3792379fc0a74e0/eugeroic-1.8.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d55af165526b2c3798d2d710477a071834f9dfa19e66500e97a7d75c93b7fbc4",
                "md5": "367e9ed8c2f498771bf0ebe3977fb3d6",
                "sha256": "732480a5d4770d5ea55b53264138f3346fdc0db6b79c61163f21ea4f63c3251f"
            },
            "downloads": -1,
            "filename": "eugeroic-1.8.2.tar.gz",
            "has_sig": false,
            "md5_digest": "367e9ed8c2f498771bf0ebe3977fb3d6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11769,
            "upload_time": "2023-08-25T16:16:38",
            "upload_time_iso_8601": "2023-08-25T16:16:38.468784Z",
            "url": "https://files.pythonhosted.org/packages/d5/5a/f165526b2c3798d2d710477a071834f9dfa19e66500e97a7d75c93b7fbc4/eugeroic-1.8.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-25 16:16:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sixty-north",
    "github_project": "eugeroic",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "eugeroic"
}
        
Elapsed time: 0.12041s