Metadata-Version: 2.4
Name: is-admin-user
Version: 0.1.1
Summary: Check whether the current Python process is running as an administrator or root user.
Author: GGN_2015
License-Expression: MIT
Keywords: administrator,admin,root,privileges,windows,linux,macos
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# is-admin-user

Check whether the current Python process is running as an administrator.

`is-admin-user` is a tiny, dependency-free Python package that works across
Windows, Linux, and macOS. It exposes a programmable function interface for
checking whether the current process has administrative privileges.

## Installation

```bash
pip install is-admin-user
```

For local development:

```bash
pip install -e .
```

## Usage

### Python

```python
from is_admin_user import is_admin_user

if is_admin_user():
    print("Running as administrator/root")
else:
    print("Running as a standard user")
```

You can also use the shorter alias:

```python
from is_admin_user import is_admin

if is_admin():
    print("Administrative privileges are available")
```

### Command line

```bash
is-admin-user
```

The command prints `true` and exits with status code `0` when the current
process has administrator/root privileges. It prints `false` and exits with
status code `1` otherwise.

For scripts that only need the exit code:

```bash
is-admin-user --quiet
```

## Platform behavior

- Windows: returns `True` when the current process token is running with
  administrator privileges.
- Linux: returns `True` when the effective user ID is `0` (`root`).
- macOS: returns `True` when the effective user ID is `0` (`root`).

On Windows, an account that belongs to the Administrators group may still return
`False` if the Python process was not started with elevated privileges.

## API

### `is_admin_user() -> bool`

Returns `True` when the current Python process has administrator/root
privileges, otherwise returns `False`.

### `is_admin() -> bool`

Alias for `is_admin_user()`.

## Development

Run the test suite with:

```bash
python -m pytest
```
