elevate
Python library for requesting root privileges
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 elevateuv
uv add elevatepoetry
poetry add elevateInstalling 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
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pypsexecRuns commands on remote Windows hosts via…
permissive · top 15,000 on PyPI
oslo.rootwraposlo.rootwrap provides fine-grained filtering…
permissive · top 15,000 on PyPI
oslo.privseposlo.privsep helps applications safely perform…
permissive · top 15,000 on PyPI
py-machineidRetrieves the unique machine ID of a host…
permissive · top 5,000 on PyPI
django-prbacImplements parameterized role-based access…
unclear · top 15,000 on PyPI
bar-raiserBar-Raiser creates GitHub checks with inline…
permissive · top 15,000 on PyPI
pyobjc-framework-OSAKitProvides Python bindings to macOS's OSAKit…
permissive · top 15,000 on PyPI
iterm2Provides a Python scripting interface to…
copyleft · top 15,000 on PyPI
pyobjc-framework-ScriptingBridgeProvides Python bindings to macOS's…
permissive · top 15,000 on PyPI
google-cloud-privilegedaccessmanagerPython client library for Google Cloud…
permissive · top 15,000 on PyPI