Skip to main content

maina

maina

CI License: MIT Python 3.11.4+

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 — with mise-provisioned language runtimes when a manifest pins one.
  • Manifest to argv — flags, positionals, repeats, defaults, subcommand families, and extends inheritance. Commands are argv lists, never a shell string.
  • Structured results — raw stdout, a parsed value (json and 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_allow to keep secrets out of third-party binaries, verified archive extraction.
  • A CLI — maina list | describe | validate | prepare | run.
  • Typed — ships py.typed; errors derive from MainaError.

What's in the name?

The myna (also spelled maina) is a bird, and the logo is a Common myna. Birds spend their lives carrying things from one place to another, and that is just what this project does: it carries a call from Python over to a program written in another language, and brings the answer back as data. The bird is where the name comes from.

A Common myna perched on a stone post
A Common myna. Photo by Hobbyfotowiki, Wikimedia Commons (CC0).

Platform support

Linux and macOS are supported. Windows is not: the install lock is a no-op there and archive extraction assumes Unix semantics.

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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for maina 0.1.1
File Size Uploaded Provenance Actions
maina-0.1.1.tar.gz 91.8 kB Without provenance Details for maina-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for maina 0.1.1
File Interpreter ABI Platform Actions
maina-0.1.1-py3-none-any.whl Python 3 none any Details for maina-0.1.1-py3-none-any.whl

Total release size: 202.4 kB

Release files / maina-0.1.1.tar.gz

Download URL maina-0.1.1.tar.gz
Size 91.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ccbcf9ce9d21f835f30a499b108f7e162be4d0576508c5ee244a97815c6b09f8
BLAKE2b-256 checksum
How to use checksums
e96398a38259b3240ecad50c7cbd6d67c4da1df42d2cee8c2288bd9aa1bef6f9
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.1-py3-none-any.whl

Download URL maina-0.1.1-py3-none-any.whl
Size 110.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46dff3d55806b56f458bae43483f843a86f505bd72342ed937d01ff8f30ce692
BLAKE2b-256 checksum
How to use checksums
2ab7e8bc9ae741f0b0954640252b03c385e0c88c12a98a786552c2b781174e4c
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.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page