Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

mptool

Latest version: v1.5.0

Overview

Last scanned
23 Nov 2026
Published
23 Nov 2026
PyPI package Publisher: oveoyas
4 Versions
422 Downloads

Scan summary

mptool was last scanned on 23 Nov 2026 at version 1.5.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 4 versions; the latest 2 were published within 6 days (18–23 Nov 2026).
  • Findings: No rules fired in version 1.5.0.
  • Downloads: 422 downloads.

Versions

4 versions published
Versions and the rules that fired in each
VersionPublishedStatus
1.5.0 LATEST 23 Nov 2026 No rules fired
1.4.0 18 Nov 2026 No rules fired
1.3.0 11 Nov 2026 No rules fired
1.2.0 3 Nov 2026 Not shown

No rules fired in 1.5.0

Findings

Findings for v1.5.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 1.5.0; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

Enumeration and sampling of minimal pathways in metabolic (sub)networks

This repository contains a Python package with implementations of methods for metabolic pathway enumeration and sampling [1].

Minimal pathways (MPs) are minimal sets of reactions that need to be active (have non-zero flux) in a metabolic (sub)network to satisfy all constraints on the network as a whole [1]. They can also be defined as the set of support-minimal flux patterns from elementary flux vectors (EFVs) [2].

An MP can be found by direct minimization of a mixed-integer linear program (MILP) or by iterative minimization of multiple linear programs (LPs). Both approaches are implemented for enumeration (enumerate_mps): the iterative method (default) additionally enumerates minimal cut sets (MCSs), using either a binary integer program (mcs_method='bip', default) [3] or a Berge minimal-hitting-set enumerator (mcs_method='berge'). Iterative enumeration can be accelerated by a graph defined by the known MPs to predict unknown MPs (graph=True). By default it deletes one reaction at a time and answers most of its LP checks from a store of cut sets read from Farkas certificates; it can instead delete reactions in multiple-reaction chunks (chunks), which does not use that store. Random sampling of MPs (sample_mps), for when complete enumeration is infeasible, is always iterative: by default it draws uniform random orderings and deletes a single reaction at a time (weights=None, chunks=None) [1]. It can optionally bias the ordering with per-reaction weights, delete in chunks, and favour reactions not yet seen in a sampled MP (adaptive=True). Sampled MPs favour MPs with few reactions of their own; see Sampling. Sampling returns the sampled MPs together with an acceptance rate (the fraction of completed draws — those producing a valid MP — that yield a previously-unseen MP).

Requirements

To run the code in this repository you will need Python (≥3.9) and the Gurobi Optimizer (≥12.0.0). A Gurobi license is required (an academic license is sufficient).

Installation

You can install mptool using pip:

pip install mptool

This will also install the minimal requirements cobra, gurobipy, networkx, numpy, and scipy. The test dependency pytest is available via the optional test extra (pip install mptool[test]).

Command-line usage

The CLI exposes both entry points as subcommands:

python -m mptool enumerate <model file> [--subset FILE] [--bounds FILE] [options]
python -m mptool sample <model file> --n-samples N [--weights FILE] [options]

A model in SBML (.xml or .sbml, also gzipped as .xml.gz or .sbml.gz), JSON (.json), or MATLAB (.mat) format is required. --subset accepts a text file with one reaction ID per line restricting which reactions can appear in MPs (the candidate set); --bounds accepts a CSV file (one reaction_id,lb,ub per line) overriding model bounds for the listed reactions. The sample subcommand additionally accepts --weights (a CSV reaction_id,weight per line, in the original namespace) and requires at least one of --n-samples or --max-t to terminate.

On enumerate, --method direct requires --no-graph — graph acceleration applies to the iterative method only — and is not compatible with --chunks:

python -m mptool enumerate <model file> --method direct --no-graph

See python -m mptool enumerate --help and python -m mptool sample --help for the full option lists.

Back-translating compressed CLI output

The CLI prints each MP as it is found, essential reactions included, so the printed MPs are the ones the run returns. Without --export they are the only output, which is why --no-verbose requires --export. Their reaction IDs are in mptool's preprocessed namespace, not your input model's. With compression on (the default) these include fused flux-coupled clusters (A+B); reversible candidate reactions are also split into a forward half and a reverse half (X_rev), regardless of compression.

To map these IDs back to your original model, pass --export: the run bundle then contains mapping.csv — a headerless new_id,orig_id,coef table — alongside mps.txt/mcs.txt, covering every ID that can appear in the output. Load it with mptool.load_mapping, or translate results directly with mptool.translate_mps / mptool.translate_mcs.

Example usage

The examples below use the e_coli_core model, available from BiGG [4].

import mptool as mpt

# Load model and set a minimal growth rate requirement
model = mpt.load_cobra_model('e_coli_core.xml')
model.reactions.BIOMASS_Ecoli_core_w_GAM.lower_bound = 0.1
Enumeration

All combinations below enumerate the same set of MPs (and MCSs where applicable) in the model's boundary reactions — every minimal combination of metabolite uptakes and secretions that supports growth. This subset is small enough that enumeration finishes within seconds.

subset = model.boundary

# Iterative LP-based enumeration (default) with graph-based prediction
# and BIP minimal-cut enumeration.
mps, mcs, complete = mpt.enumerate_mps(model, subset=subset)

# Iterative without graph acceleration.
mps, mcs, complete = mpt.enumerate_mps(model, subset=subset, graph=False)

# Iterative with the Berge minimal-hitting-set enumerator for MCSs
# (alternative to the default 'bip').
mps, mcs, complete = mpt.enumerate_mps(model, subset=subset,
                                       mcs_method='berge')

# Direct MILP minimization: finds one MP per solve; no MCSs returned.
# Reliable while the fluxes MPs need are well above Gurobi's
# FeasibilityTol and above ub * IntFeasTol (about 1e-6 at bounds of
# 1000). Below that it can miss MPs; it then warns and returns
# complete=False. The iterative method is exact.
mps, mcs, complete = mpt.enumerate_mps(model, subset=subset,
                                       method='direct', graph=False)

# Lossless FVA-based compression is on by default, so the MPs above use
# compressed reaction IDs (see Back-translation below).  Without it:
mps, mcs, complete = mpt.enumerate_mps(
    model, subset=subset, preprocess_kwargs={'compress': False})
Sampling

When complete enumeration is infeasible, random sampling is more practical. sample_mps runs until n_samples distinct MPs have been collected, max_draws draws have completed, or max_t seconds have elapsed, whichever comes first (at least one is required). Duplicates do not count toward n_samples, so if the model has fewer distinct MPs than that — or fewer that can be drawn: a reaction with weight 0 can make MPs undrawable — a run with neither max_t nor max_draws never ends. Set one of them unless you know there are enough; a seeded run stopped by max_draws is reproducible, one stopped by max_t is not. Reproducible results need threads=1. With threads=0 Gurobi picks the thread count and can race several LP methods, so fastercc's LP count can differ between runs, though its result does not. Interrupting a run loses the MPs found so far. max_t budgets the sampling loop only — preprocessing runs before the clock starts, so total runtime is preprocessing plus max_t. The same holds for max_t in enumerate_mps. It returns a 2-tuple (mps, acceptance): mps is a list of MPs in sampling order (so reaction frequencies and convergence statistics can be recomputed directly from it) and acceptance is the acceptance rate — the fraction of completed draws that yielded a new MP rather than a duplicate (a low rate signals the MP space is nearly exhausted; prefer enumerate_mps then). With return_counts=True it returns (mps, acceptance, counts), where counts[i] is the number of draws that returned mps[i]. The full model is used here (no subset argument).

import random

# Uniform sampler (default): single-reaction-deletion ordering, no weights.
mps, acceptance = mpt.sample_mps(model, n_samples=100)

# Chunked deletion: removes up to `chunks` candidates per LP instead of one;
# degrades gracefully to single-reaction deletion when fewer remain.
mps, acceptance = mpt.sample_mps(model, n_samples=100, chunks=4)

# Weighted sampler: prior weights bias the random ordering
# (higher weight → reaction more likely to be retained in sampled MPs).
weights = {r.id: random.random() for r in model.reactions}
mps, acceptance = mpt.sample_mps(model, n_samples=100, weights=weights)

# Adaptive sampler: reactions not yet seen in a sampled MP are kept longer,
# so every reaction that occurs in some MP is found sooner.
mps, acceptance = mpt.sample_mps(model, n_samples=0, adaptive=True, max_t=60)

# A fixed number of draws, with how many of them returned each MP.
mps, acceptance, counts = mpt.sample_mps(model, n_samples=0, max_draws=1000,
                                         return_counts=True)

Sampled MPs are not a uniform sample of the MP space. A draw is the MP that avoids the earliest reactions it can along the ordering, so MPs with few reactions of their own are drawn more often, and so, for example, are MPs that share few reactions with others. Frequencies counted per draw are therefore biased. mps holds each distinct MP once, and frequencies over the distinct MPs found approach the true ones as more of them are found. Neither weights nor adaptive=True removes this bias.

Weights are relative: reaction r is kept longer than s with odds w_r : w_s, so any scale works (raw scores such as BLAST bit scores included) and multiplying every weight by the same factor changes nothing. A reaction with weight 0, or missing from weights, is tried before every positive-weight reaction and removed whenever possible; list a reaction to give it a say. An MP is never drawn while another MP's weight-0 reactions are a proper subset of its own, and every other MP can be drawn, so 0 excludes wherever an alternative exists while a small positive weight only disfavours. Each direction of a reversible reaction carries the full weight. Keys that name no reaction in the subset are ignored, but a UserWarning is raised when none of them does.

With preprocess=True (the default), compression does not change the distribution of sampled MPs, though a given seed gives different MPs with and without it. Without compression, a chain of fully coupled reactions is removed, or found to be needed, as soon as the first of them is tried. With it, each subset member of a merged cluster draws its own key from its weight (every member counts as 1 without weights), and the cluster is placed at the earliest. This needs the mapping that preprocessing returns, so a model compressed beforehand and sampled with preprocess=False orders each merged reaction as one reaction, and its sampled MPs are distributed differently.

adaptive=True multiplies the weight of every reaction that is in none of the distinct MPs found so far by N, the number found, and leaves the others at their weight (1 without weights; for a merged cluster, every member's weight). The boost starts with the second distinct MP, and a weight of 0 stays 0. Once every reaction that occurs in some MP has been seen, sampling continues as without adaptive. conv_tol and conv_window are deprecated: their check stops at a roughly fixed number of distinct MPs rather than when estimates settle.

Back-translation

The returned MPs and MCSs use preprocessed reaction IDs: with compression (the default) a flux-coupled cluster is one reaction such as 'ACONTa+ACONTb', and with or without it the reverse half of a reversible reaction is 'X_rev'. return_mapping=True appends the preprocessed→original mapping to the return tuple. Each preprocessed reaction maps to a {original_id: coefficient} dict; signs encode direction.

mps, mcs, complete, mapping = mpt.enumerate_mps(
    model, subset=subset, return_mapping=True)

orig_mps = mpt.translate_mps(mps, mapping, subset=subset)
orig_mcs = mpt.translate_mcs(mcs, mapping, subset=subset)

Pass the same subset you enumerated over. The translation then names reversed reactions as X_rev, as in the preprocessed MPs, and leaves out reactions outside the subset that compression merged into a cluster with subset reactions. Expanding mapping[r] by hand does neither.

Preprocessing

enumerate_mps and sample_mps preprocess the model internally — copying it, applying user bounds, removing flux-inconsistent reactions (fastercc), optionally applying FVA-based bound tightening and lossless compression, and making the subset forward-irreversible. The same pipeline is exposed as a standalone function:

preprocessed, subset, mapping = mpt.preprocess_model(
    model, subset=['BIOMASS_Ecoli_core_w_GAM', 'EX_glc__D_e'],
    bounds={'BIOMASS_Ecoli_core_w_GAM': (0.1, 1000.0)},
    compress=True, tighten=True,
)
mps, mcs, complete = mpt.enumerate_mps(
    preprocessed, subset=subset, preprocess=False,
)

This is useful when the same model is reused across multiple enumeration / sampling calls — preprocessing is the expensive step and running it once amortises its cost. For sampling, note that sample_mps with preprocess=False has no mapping, so on a compressed model it orders each merged reaction as one reaction, and the sampled MPs are not distributed as without compression (see Sampling). Pass compress=False to preprocess_model if that matters.

Writing requirements functions

The requirements parameter of enumerate_mps / sample_mps accepts a callable that imposes additional feasibility criteria on top of LP feasibility. It is a top-level keyword argument and requires preprocess=False: preprocess the model yourself via preprocess_model and pass the result in. (It is not compatible with method='direct'.)

The callable has signature (model) -> (bool, set[str]); a plain bool return is also accepted (treated as (bool, set())). On each invocation it receives a fresh independent copy of the current Gurobi model and may freely mutate that copy without affecting the search. The copy is not solved before the callback runs, so a callback that inspects solution values must call model.optimize() itself. It returns a 2-tuple (feasible, zero_flux_ids):

  • feasible (bool): True if the active reactions satisfy the criterion.
  • zero_flux_ids (set[str]): IDs of the reactions that carry no flux in the callback's own checks. mptool deletes a reaction without a solve only if it is in this set and carries no flux in mptool's own LP solution, so the callback does not need to re-solve the main problem. Return an empty set if no such information is available.
The preprocessed namespace

Because requirements runs with preprocess=False, the callback sees the namespace of the model you passed in — the output of preprocess_model. That model is forward-irreversible, so every reaction has non-negative flux bounds: reversible reactions are split into a forward half (original name) and a reverse half (_rev suffix); a reaction PFK with lb=-10, ub=0 becomes PFK_rev with lb=0, ub=10. With compress=True, IDs may differ further from the original model (merged reactions use combined 'A+B' names; blocked reactions are absent).

Requirements functions must therefore be written against the preprocessed model. The cleanest approach is to preprocess once, inspect the resulting variable names, and write the function using those names:

Example

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases mptool

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Vulnerability Insights

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?

Cry2Wolf: How to Tell a Real Bug from a Nothingburger
AI & VibeSec

Cry2Wolf: Not Every Branded Bug Deserves a Fire Drill

Plug and Pray: Your AI Agents Are Taking Orders From Strangers
Research

Plug and Pray: Your AI Agents Are Taking Orders From Strangers

Frame 2085668439 (1)
Group 1261154229