Metadata-Version: 2.4
Name: minimega
Version: 3.4.0
Summary: Python API for minimega
Author-email: minimega dev team <minimega-dev@sandia.gov>
License-Expression: GPL-3.0-only
Project-URL: homepage, https://sandia-minimega.github.io/minimega/
Project-URL: repository, https://github.com/sandia-minimega/minimega
Project-URL: changelog, https://github.com/sandia-minimega/minimega/releases/
Project-URL: documentation, https://sandia-minimega.github.io/minimega/
Project-URL: issues, https://github.com/sandia-minimega/minimega/issues
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: System Administrators
Classifier: Intended Audience :: Telecommunications Industry
Classifier: Natural Language :: English
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
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: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Security
Classifier: Topic :: System :: Clustering
Classifier: Topic :: System :: Distributed Computing
Classifier: Topic :: System :: Emulators
Classifier: Topic :: System :: Networking
Classifier: Topic :: System :: Operating System
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown

minimega Python bindings
========================

`minimega` is the Python client package for controlling a running minimega
instance over its UNIX domain socket. The bindings are autogenerated from
minimega's command definitions and expose command docstrings directly in Python.

These bindings do not start minimega for you. You must already have a running
minimega instance and permission to access its command socket.

## Requirements

- Python 3.10 or newer
- A running minimega instance
- Access to the minimega command socket, which defaults to:

  `/tmp/minimega/minimega`

By default, that socket is often only readable/writable by root.

## Install

```bash
pip install minimega
```

## Quick start

```python
import minimega

with minimega.connect() as mm:
    for resp in mm.version():
        print(resp["Response"])
```

To print tabular command output:

```python
import minimega

with minimega.connect() as mm:
    minimega.print_rows(mm.vm_info())
```

To scope commands to a namespace:

```python
import minimega

with minimega.connect() as mm:
    with mm.namespace("lab") as ns:
        ns.vm_info()
```

## Response model

Use `close()` or a `with minimega.connect() as mm:` block to close the UNIX
socket when the client is no longer needed.

One connection is serial: all responses from one command must be consumed
before another command is issued on the same connection. If a command produces
additional responses, consume them with `streamResponses()` or discard them with
`minimega.discard(...)`.

Create one connection per process. Do not pickle a connected client or share it
across `multiprocessing` workers.

Use `cc_filtered(...)` to scope command-and-control filters and automatically
clear the filter on exit:

```python
with minimega.connect() as mm:
    with mm.cc_filtered("uuid=abc"):
        mm.cc_exec_once("pkill iperf3")
```

## More information

- Main documentation: https://sandia-minimega.github.io/minimega/
- Python bindings article: https://sandia-minimega.github.io/minimega/articles/python/
- Generated Python API reference: https://sandia-minimega.github.io/minimega/reference/python/
- Command API usage details: https://sandia-minimega.github.io/minimega/articles/usage/#command-port-and-the-local-command-flag
- Issue tracker: https://github.com/sandia-minimega/minimega/issues
