Python Package

Performance Optimization

Profiling and tuning Python code for speed and resource efficiency.

Early Access: Until 2026-12-31

For mgpy, performance only matters after correctness and signal quality are stable. Fast wrong reports are worse than slower correct ones.

Key points

  • CLI: On Windows the examples use the recommended py -3.12 -m <module> ... form (for example py -3.12 -m manifestguard ...). On Linux/macOS this usually maps to python3.12 -m ....
  • Measure where runtime is spent first: imports, dependency scans, report serialization or deeper analysis.
  • Optimizations should target real bottlenecks instead of guesses.
  • For CLI tools, stable response time matters more than flashy micro-benchmarks.

Recommended mgpy workflow

  1. Measure the baseline run and the extended run separately so expensive checks stay visible.
  2. Split heavy work into clearly named phases and enable it only when needed.
  3. Export the same mgpy report before and after performance work to ensure no capability was lost.

Quick start

py -3.12 -m manifestguard check --report .manifestguard/before.json
py -3.12 -m manifestguard check --extended --report .manifestguard/after.json
py -3.12 -m manifestguard export-metrics --output metrics.json

Requirements

Columns
Installation interpreter
Python 3.12 + pip
Recommended default path for installation and CLI calls.
Project target versions
Python 3.8 to 3.12
These are the project/runtime targets mgpy can analyze.
mgpy runtime
Validated on Python 3.10 to 3.13
The tool runtime itself is covered for this range.
CLI invocation
Windows: py -3.12 -m manifestguard
Linux/macOS usually maps to python3.12 -m manifestguard.
Runtime packages
tomlkit, click, pydantic, packaging, watchdog, PyNaCl, rfc8785
tomli is only added for Python below 3.11.
Offline / wheel install
Optional via pip --no-index or wheel
Useful for air-gapped or approved bundle distribution paths.