skillfed

elevate

Python library for requesting root privileges

elevate v0.1.3 111.9K downloads/30d#12,392 on PyPI129
Permissive license MIT DORMANT released

What it is and what it does

Elevate is a small library that re-launches your Python process with elevated privileges, handling the platform-specific details of privilege escalation. When you call elevate() early in your script, it checks whether the process is already running as root; if not, it uses the appropriate system mechanism for your platform to request elevation and replace or restart the process. On Windows it uses UAC, on macOS it tries AppleScript before falling back to sudo, and on Linux it tries graphical tools like pkexec before sudo.

The library has no runtime dependencies and is designed to be called once at script startup. Its main constraint is that it depends entirely on system-level privilege escalation infrastructure, which varies across platforms and may not be available in all environments. The package has received no updates since its initial release.

Use it for:

  • System administration scripts that need to perform privileged operations but should prompt for elevation only once at startup.
  • Cross-platform tools that require root access on Unix-like systems and admin access on Windows.
  • Installation or configuration utilities that need to modify system files or settings.
  • Daemon or service launchers that must run with elevated privileges from a user-initiated script.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Elevate re-launches the current Python process with root or admin privileges using platform-specific mechanisms (UAC on Windows, AppleScript on macOS, pkexec/sudo on Linux).

No. The package has not been updated since 2018-05-22 and is dormant, raising serious concerns about compatibility with modern Python versions and contemporary privilege escalation mechanisms. While the MIT license is permissive and there are no known vulnerabilities, the age and lack of maintenance make it a poor choice for new projects. Consider using platform-specific elevation mechanisms directly or evaluating actively maintained alternatives.

Install

elevate on PyPI

pip

pip install elevate

uv

uv add elevate

poetry

poetry add elevate

Installing elevate

Before you install

High install friction: the package has not been updated since its latest release on 2018-05-22 and is marked dormant. No runtime dependencies, but the underlying mechanism depends on system-level privilege escalation tools being available.

License in practice

MIT license is permissive and imposes no significant restrictions on use, modification, or distribution.

Quickstart

import os
from elevate import elevate

elevate()
print(os.getuid() == 0)  # True if now running as root

Requires system privilege escalation tools (sudo, pkexec, UAC, or AppleScript) to be available and configured; behavior differs significantly across Windows, macOS, and Linux.

Verify before relying

  • Whether the package works correctly with modern Python versions (no explicit version support declared).
  • Current compatibility with contemporary UAC, AppleScript, and Linux privilege escalation mechanisms.
  • Whether dormancy since 2018-05-22 indicates unresolved bugs or simply stable, feature-complete code.

Package facts

License MIT (permissive)
Python support not specified
Install friction high — source build required
Runtime dependencies none
Maintenance dormant — 3,006 days since the last release
Last repo commit
First released
Downloads 111,879/month — #12,392 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: elevate-0.1.3.tar.gz

Tags

request root privileges pythonelevate to admin pythonsudo wrapper pythonuac elevation pythonprivilege escalation scriptrun as root pythonadministrative privileges python
privilege-escalationcross-platformsystem-admin

More Utilities packages