Skip to content

[Feature]: Add --json output flag for programmatic usage #12

@pipe1os

Description

@pipe1os

Problem Description

Currently, modelinfo prints rich terminal UI tables. Other scripts or CI/CD pipelines might want to consume the exact VRAM calculations and model parameters programmatically.

Proposed Solution

  1. Add a --json boolean flag to the argparse configuration in src/modelinfo/cli.py.
  2. Before calling print_model_info or print_compare_info, check if args.json is True.
  3. If it is, bypass the rich UI rendering entirely and print the raw metadata and footprint calculation dictionaries to stdout using json.dumps(..., indent=2).

Alternatives Considered

None.

Additional Context

It touches the very end of cli.py and standard argparse functionality. It is completely isolated from the mathematical engines and binary parsers, making it an excellent first issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions