Python Package

Type Hints

Adding and validating Python type annotations to improve static analysis coverage.

Early Access: Until 2026-12-31

Type hints make mgpy reports more precise because public API boundaries, return values and data models become easier to validate.

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 ....
  • Annotate public functions, data models and return objects first.
  • Combine type hints with clear docstrings instead of maintaining duplicate and conflicting information.
  • If the package should be consumed as typed code, py.typed and stable imports belong to the complete solution.

Recommended mgpy workflow

  1. Start with the main entry points and exit points of the library.
  2. After each annotation batch, run MyPy or an equivalent type checker against real usage paths.
  3. Run mgpy afterwards so packaging and API contracts stay aligned.

Quick start

python -m mypy src
py -3.12 -m manifestguard check --extended
py -3.12 -m manifestguard schema --output openapi.json