Skip to main content

mathexec

Python SDK for MathExec — call your published model endpoints from code.

pip install mathexec

Quick start

from mathexec import Model

model = Model.load("your-model-id")
result = model.predict({"age": 25, "income": 50000})
print(result["predictions"])     # [1]
print(result["probabilities"])   # [0.92]

Get an API key

  1. Sign in at mathexec.com
  2. Open Settings → API keys
  3. Create a key — it starts with mx_live_…. Copy it now; the full value is only shown once.
  4. Pass it as api_key=, or set the MATHEXEC_API_KEY env var and read it yourself.

Public models don't need a key. Private models, rate-limited usage, and list_models() do.

Usage

Predict on one sample

from mathexec import Model

model = Model.load("project/experiment-3", api_key="mx_live_…")

# Named features
model.predict({"age": 25, "income": 50000})

# Positional features
model.predict([25, 50000])

Predict in batch

results = model.predict_batch([
    {"age": 25, "income": 50000},
    {"age": 45, "income": 80000},
])
results["predictions"]    # [1, 0]
results["probabilities"]  # [0.92, 0.31]

sklearn-style convenience

model.predict_label({"age": 25, "income": 50000})   # 'yes'
model.predict_proba({"age": 25, "income": 50000})   # 0.92

Model metadata

model.info["name"]            # "Churn classifier"
model.info["metrics"]         # {"accuracy": 0.92, "roc_auc": 0.94, ...}
model.task_type               # 'classification'
model.class_labels            # ['no', 'yes']
model.positive_class          # 'yes'

List your models

from mathexec import list_models

models = list_models(api_key="mx_live_…")
for m in models:
    print(m["model_id"], m["name"])

Self-hosted server

Model.load("id", base_url="http://localhost:8001", api_key="mx_live_…")

Errors

from mathexec import Model, MathExecError

try:
    model = Model.load("does-not-exist")
except MathExecError as e:
    print(e)   # "Model 'does-not-exist' not found."

MathExecError is raised for:

  • 404 — model not found / not accessible
  • 429 — rate limited
  • 400 — bad input (e.g. wrong feature names or types)

For 5xx the underlying requests.HTTPError propagates.

License

MIT

Metadata

Release files for mathexec 0.1.0

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

Source distribution (sdist)

Source distribution for mathexec 0.1.0
File Size Uploaded Provenance Actions
mathexec-0.1.0.tar.gz 6.9 kB Without provenance Details for mathexec-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 14.1 kB

Release files / mathexec-0.1.0.tar.gz

Download URL mathexec-0.1.0.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c68e956ed2c7d7053b385d8618f8b14a2767d329138145993ac772f7e9d6d013
BLAKE2b-256 checksum
How to use checksums
f6beaebda39209f8c819737ceb3d609f0074775d75f8bf5cc57360a0f6cf9862
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release files / mathexec-0.1.0-py3-none-any.whl

Download URL mathexec-0.1.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d6c3b688359765cae1da2e9f6b662221517f9b698289a3fb765abea4af513b5
BLAKE2b-256 checksum
How to use checksums
b021787dc5b6e5af591b9535bec3083c7ef3f6e7fcb52ef0d0e32009a04e1d23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Security for mathexec 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.

Release history Release notifications | RSS feed

This release

0.1.0 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