maina
Call non-Python CLIs from Python. Describe a tool once in a YAML manifest;
Tool(name) installs or finds the executable, maps keyword arguments to argv,
runs the process, and returns a structured result — no hand-written install,
argv, or environment plumbing.
maina ships the engine and the manifest contract, not a tool catalog: you register your own manifests (or your app does).
Install
pip install maina # or: uv add maina
Python 3.11.4 or newer, on Linux or macOS.
A first tool
my_tools/greet.yaml — wrap the echo already on your PATH:
cli: echo
install: {backend: path}
args:
message: {positional: true, required: true}
from pathlib import Path
import maina
app = maina.register(maina.Runtime.preferred(), registry_dirs=[Path("my_tools")])
result = app.tool("greet")(message="hello from maina")
print(result.ok, result.exit_code, repr(result.raw))
# True 0 'hello from maina\n'
Swap backend: path for github, npm, pip, or script and maina downloads
and caches the tool for you (digest-pinned if you give it a sha256). The
quickstart walks through a
real shellcheck manifest with a JSON parser.
What you get
- Five install backends — an executable already on
PATH, GitHub release assets, npm packages, pip packages (one venv per tool), and repo-local scripts — withmise-provisioned language runtimes when a manifest pins one. - Manifest to argv — flags, positionals, repeats, defaults, subcommand
families, and
extendsinheritance. Commands are argv lists, never a shell string. - Structured results — raw stdout, a parsed value (
jsonand friends, or your own parser), exit code, stderr, timing.raise_for_status()when you want exceptions. - Safe-by-default runs — per-call
timeout, bounded output,env_allowto keep secrets out of third-party binaries, verified archive extraction. - A CLI —
maina list | describe | validate | prepare | run. - Typed — ships
py.typed; errors derive fromMainaError.
Platform support and stability
Linux and macOS are supported. Windows is not: the install lock is a no-op there and archive extraction assumes Unix semantics.
maina is Beta (0.x). Tool, the manifest schema, ToolResult, and the exception
types are the stable core. MainaApp, register, the process-session helpers
(runtime, use, isolated), and the backend/runtime protocols may change before 1.0.
Documentation
The user guide covers the
quickstart,
manifest schema,
install backends,
parsers,
extending maina and the
CLI.
Worked catalogs live in examples/,
including 30 real CLIs in examples/wild_catalog.
Security
A registered registry directory is trusted code — it can ship a parsers/*.py that
maina imports and runs in-process, and Runtime.preferred() honours $MAINA_REGISTRY
unless you pass use_env=False. Read the
security model before pointing
maina at a catalog you did not write, and report vulnerabilities as described in the
security policy.
Contributing
See contributing guide. MIT licensed.
Metadata
Release files for maina 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| maina-0.1.0.tar.gz | 91.5 kB | Without provenance | Details for maina-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| maina-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for maina-0.1.0-py3-none-any.whl |
Total release size: 202.0 kB
Release files / maina-0.1.0.tar.gz
| Download URL | maina-0.1.0.tar.gz |
|---|---|
| Size | 91.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
02451e7f08d5934da4f4dceda47787c12db4dad3d28c5b64746cefd6ed844b4e
|
|
BLAKE2b-256 checksum How to use checksums |
639545a3cac396be33bb6917e83d962e68ff01252b5310f97d1bee644a036e67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / maina-0.1.0-py3-none-any.whl
| Download URL | maina-0.1.0-py3-none-any.whl |
|---|---|
| Size | 110.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b71a913246c1e0e9587918009a7202d78e563116a43bf3c4f121776bece244d1
|
|
BLAKE2b-256 checksum How to use checksums |
47b96df3ce9817efe204d99023b6f10f142f738ded8d25405f6a2721b9be6817
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for maina 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.