Metadata-Version: 2.4
Name: pymdm
Version: 0.7.0
Summary: Cross-platform utility package for MDM deployment scripts (Jamf Pro, Intune).
Author-email: Andrew Lerman <info@liquidzoo.io>
Keywords: it,mdm,jamf,intune,endpoint,deployment
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: requests
Requires-Dist: requests>=2.32.5; extra == "requests"
Provides-Extra: managed
Provides-Extra: docs
Requires-Dist: myst-parser; extra == "docs"
Requires-Dist: sphinx>=7.3.7; extra == "docs"
Requires-Dist: sphinx-copybutton; extra == "docs"
Requires-Dist: sphinx-design; extra == "docs"
Requires-Dist: sphinx-iconify>=0.2.1; extra == "docs"
Requires-Dist: shibuya>=2025.11.10; extra == "docs"
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: pre-commit>=4.6.0; extra == "dev"
Requires-Dist: pymdm[docs,requests]; extra == "dev"
Requires-Dist: pytest>=8.2.2; extra == "dev"
Requires-Dist: pytest-cov>=7.0.0; extra == "dev"
Requires-Dist: ruff>=0.5.1; extra == "dev"
Dynamic: license-file

# pymdm

A Python utility package for macOS MDM deployment scripts, built for [MacAdmins Python](https://github.com/macadmins/python) (`#!/usr/local/bin/managed_python3`) and Jamf Pro workflows. Windows/Intune support is included for teams managing mixed-platform fleets.

📖 **[Full documentation →](https://pymdm.readthedocs.io/en/latest/)**

## What's Included

| Feature | macOS (Jamf) | Windows (Intune) |
|---|---|---|
| JamfParamParser | Yes | -- |
| IntuneParamParser | -- | Yes |
| GenericParamParser | Yes | Yes |
| Dialog (swiftDialog) | Yes | Graceful no-op |
| CommandRunner | Yes | Yes |
| TextTools | Yes | Yes |
| SystemInfo | Yes | Yes |
| MdmLogger | Yes | Yes |
| WebhookSender | Yes | Yes |
| DarwinDefaults | Yes | -- |
| DarwinServiceManager | Yes | -- |
| Win32Registry | -- | Yes |
| Win32ServiceManager | -- | Yes |

See the [User Guide](https://pymdm.readthedocs.io/en/latest/user-guide/index.html) for what each piece does.

> [!NOTE]
> **Windows/Intune support is experimental.** The Windows code paths are unit-tested but have not yet been validated on real Windows hardware. Treat them as a starting point rather than a guarantee. Bug reports and contributions from Windows/Intune admins are very welcome.

## Installation

```bash
pip install pymdm[requests]
```

`requests` is an optional extra because the primary target, MacAdmins [`managed_python3`](https://github.com/macadmins/python), already bundles it, so a plain `pip install pymdm` is enough there. The uv, source, and fleet-deployment paths are in the [installation guide](https://pymdm.readthedocs.io/en/latest/user-guide/install.html).

## Quick Example (macOS / Jamf Pro)

```python
#!/usr/local/bin/managed_python3
"""Example Jamf Pro policy script."""

from pymdm import MdmLogger, CommandRunner, SystemInfo, WebhookSender
from pymdm.mdm import get_provider

params = get_provider("jamf")    # explicit; get_provider() now defaults to GenericParamParser
logger = MdmLogger(debug=params.get_bool(4), output_path="/var/log/my_script.log")
runner = CommandRunner(logger=logger)
logger.log_startup("my_script", version="1.0.0")

try:
    serial = SystemInfo.get_serial_number()
    hostname = SystemInfo.get_hostname()
    logger.info(f"Running on {hostname} ({serial})")

    output = runner.run(["/usr/bin/sw_vers", "-productVersion"])
    logger.info(f"macOS version: {output}")

    webhook = WebhookSender(url=params.get(5), logger=logger)
    webhook.send(hostname=hostname, serial=serial, status="success")
except Exception as e:
    logger.log_exception("Script failed", e, exit_code=1)
```

Windows/Intune, platform helpers, and per-module usage live in the [Quick Start](https://pymdm.readthedocs.io/en/latest/user-guide/quickstart.html).

## Development

```bash
git clone https://github.com/liquidz00/pymdm.git
cd pymdm
make install-dev   # dev dependencies (includes docs tooling)
make test
make format
make help          # list every target
```

See [CONTRIBUTING](CONTRIBUTING.md) to get started, and the [CHANGELOG](CHANGELOG.md) for release notes and version migration steps.

## Requirements

- Python 3.12+
- `requests` (bundled with [MacAdmins Python](https://github.com/macadmins/python))

## License

[Apache 2.0](LICENSE)
